Ensemble Methods ใน Python
Román de las Heras
Data Scientist, Appodeal
base_estimatorn_estimatorsoob_scoreest_bag.oob_score_max_samples: จำนวนตัวอย่างที่ดึงให้แต่ละ estimatormax_features: จำนวน feature ที่ดึงให้แต่ละ estimatorbootstrap: กำหนดว่าดึงตัวอย่างแบบ with replacement หรือไม่Classification
from sklearn.ensemble import RandomForestClassifier
clf_rf = RandomForestClassifier(
# parameters...
)
Regression
from sklearn.ensemble import RandomForestRegressor
reg_rf = RandomForestRegressor(
# parameters...
)
พารามิเตอร์ Bagging:
n_estimatorsmax_featuresoob_scoreพารามิเตอร์เฉพาะ Tree:
max_depthmin_samples_splitmin_samples_leafclass_weight ("balanced")
Ensemble Methods ใน Python