随即森林/Extra-Tress/回归问题

随机森林

key: 随机森林
value:基模型 为Decision Tree 的Bagging 进一步增强随机性

value: Decision Tree
value:最优维度、最优阈值随即森林/Extra-Tress/回归问题_第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_


rf_clf = RandomForestClassifier(n_estimators=500, max_leaf_nodes = 16, random_state=666,oob_score=True)

rf_clf.fit(X,y)

#随机划分

from sklearn.ensemble import ExtraTreesClassifier

rf_clf = ExtraTreesClassifier(n_estimators=500, random_state=666,oob_score=True,bootstrap=True)

rf_clf.fit(X,y)

rf_clf.oob_score_

#回归问题

from sklearn.ensemble import BaggingRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import ExtraTreesRegressor

你可能感兴趣的:(机器学习,随即森林)