Skip to content
New issue

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

第3章_决策树算法 - ApacheCN #426

Closed
jiangzhonglian opened this issue Aug 24, 2018 · 12 comments
Closed

第3章_决策树算法 - ApacheCN #426

jiangzhonglian opened this issue Aug 24, 2018 · 12 comments

Comments

@jiangzhonglian
Copy link
Member

jiangzhonglian commented Aug 24, 2018

https://ailearning.apachecn.org/#/docs/ml/3.决策树

kmeans聚类选择最优K值python实现:
https://blog.csdn.net/xyisv/article/details/82430107

@shenlixin
Copy link

缺少了 majorityCnt 方法的实现

@woaiios
Copy link

woaiios commented May 16, 2019

缺少了 majorityCnt 方法的实现

在底下的源码链接有。

@mengrennwpu
Copy link

决策树源码 DecisionTree中计算香农熵的第二种实现方法中的计算概率应该是:
probs = [p[1] * 1.0 / len(dataSet) for p in label_count.items()],而非probs = [p[1] / len(dataSet) for p in label_count.items()]

@jiangzhonglian
Copy link
Member Author

小哥哥,能不能提交一下PR? 这个代码完全是按照作者写得来优化的。
我没太懂你们讨论的点在哪里?

@x931890193
Copy link

决策树源码 DecisionTree中计算香农熵的第二种实现方法中的计算概率应该是:
probs = [p[1] * 1.0 / len(dataSet) for p in label_count.items()],而非probs = [p[1] / len(dataSet) for p in label_count.items()]

小哥哥 这两区别大吗?变小数?

@GodBearC
Copy link

为什么网页打不开

@jiangzhonglian
Copy link
Member Author

jiangzhonglian commented May 27, 2019

小哥哥,你再试试
https://ailearning.apachecn.org/#/docs/ml/3.决策树

@xLuge
Copy link

xLuge commented Jul 27, 2019

firstStr=inputTree.keys()[0] 这句话报错,TypeError: 'dict_keys' object is not subscriptable

@cool-face
Copy link

firstStr=inputTree.keys()[0] 这句话报错,TypeError: 'dict_keys' object is not subscriptable
这个解决了吗

@jiangzhonglian
Copy link
Member Author

jiangzhonglian commented Mar 13, 2020

这个主要是 3.x 升级了API,试试:

firstStr=list(inputTree.keys())[0]

如果方便的话,你们测试完,也可以提交一下最新代码!

@cool-face
Copy link

github还不太会用,不知道怎么提交,经过测试,以下两处需要修改,其他类似地方也据此修改即可。
1、 firstStr = list(inputTree.keys())
2、secondDict = inputTree.get(firstStr[0])

@jiangzhonglian
Copy link
Member Author

你改复杂呢,差不多的意思

# 获取tree的根节点对于的key值
firstStr = list(inputTree.keys())[0]
# 通过key得到根节点对应的value
secondDict = inputTree[firstStr]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants