mirror of
https://github.com/apachecn/ailearning.git
synced 2026-04-05 11:40:08 +08:00
py 3.x 修改版本问题
This commit is contained in:
@@ -318,7 +318,7 @@ def classify(inputTree, featLabels, testVec):
|
||||
classLabel 分类的结果值,需要映射label才能知道名称
|
||||
"""
|
||||
# 获取tree的根节点对于的key值
|
||||
firstStr = inputTree.keys()[0]
|
||||
firstStr = list(inputTree.keys())[0]
|
||||
# 通过key得到根节点对应的value
|
||||
secondDict = inputTree[firstStr]
|
||||
# 判断根节点名称获取根节点在label中的先后顺序,这样就知道输入的testVec怎么开始对照树来做分类
|
||||
|
||||
Reference in New Issue
Block a user