Python 的 Ensemble 方法
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 的 Ensemble 方法