Python3入门机器学习之11.4随机森林和Extra-Trees
程序员文章站
2022-07-14 14:38:34
...
Python3入门机器学习
11.4 随机森林和Extra-Trees
1.随机森林:
from sklearn.ensemble import RandomForestClassifier
rf_clf = RandomForestClassifier(n_estimators=500, random_state=666, oob_score=True)
rf_clf.fit(X, y)
rf_clf.oob_score_
2.Extra-Trees:
from sklearn.ensemble import ExtraTreesClassifier
et_clf = ExtraTreesClassifier(n_estimators=500, bootstrap=True, oob_score=True, random_state=666)
et_clf.fit(X, y)
et_clf.oob_score_
上一篇: 2019.5.31今日算法题
下一篇: 面试题总结