We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
530行里 调用classify方法,给定的第二项输入应该是完整的数据labels,且顺序和数据集顺序应该一致
同时优化了classify方法的写法 更加直观
def classify(inputTree, featLabels, testVec): # 获取决策树结点 # 当前树节点的key首项 表明选择的特征类型 keyLabel = list(inputTree.keys())[0] # 对应类型的特征树 currDict = inputTree[keyLabel] # 获取特征类型在特征中的index featIndex = featLabels.index(keyLabel) # 获取当前的特征叶子 或者是 特征树 judgeValue = currDict.get(testVec[featIndex]) # 如果是树就继续向下走 如果是叶子输出 if type(judgeValue).__name__ == 'dict': return classify(judgeValue, featLabels, testVec) else: return judgeValue
The text was updated successfully, but these errors were encountered:
No branches or pull requests
530行里 调用classify方法,给定的第二项输入应该是完整的数据labels,且顺序和数据集顺序应该一致
同时优化了classify方法的写法 更加直观
The text was updated successfully, but these errors were encountered: