Python 中的集成方法
Román de las Heras
Data Scientist, Appodeal
base_estimatorn_estimatorsoob_scoreest_bag.oob_score_max_samples:每个基学习器抽取的样本数。max_features:每个基学习器抽取的特征数。bootstrap:是否有放回抽样。分类
from sklearn.ensemble import RandomForestClassifier
clf_rf = RandomForestClassifier(
# parameters...
)
回归
from sklearn.ensemble import RandomForestRegressor
reg_rf = RandomForestRegressor(
# parameters...
)
Bagging 参数:
n_estimatorsmax_featuresoob_score树模型参数:
max_depthmin_samples_splitmin_samples_leafclass_weight("balanced")
Python 中的集成方法