提交 758be028 编写于 作者: 片刻小哥哥's avatar 片刻小哥哥

py 3.x 修改版本问题

上级 11f94b0e
......@@ -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怎么开始对照树来做分类
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册