Xác thực Mô hình trong Python
Kasey Jones
Data Scientist
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import RandomForestClassifier
rfr = RandomForestRegressor(random_state=1111)
rfc = RandomForestClassifier(random_state=1111)


n_estimators: số cây trong rừng
max_depth: độ sâu tối đa của cây
random_state: hạt giống ngẫu nhiên
from sklearn.ensemble import RandomForestRegressor
rfr = RandomForestRegressor(n_estimators=50, max_depth=10)
rfr = RandomForestRegressor(random_state=1111)
rfr.n_estimators = 50
rfr.max_depth = 10
In mức độ quan trọng của từng cột đối với mô hình
for i, item in enumerate(rfr.feature_importances_):
print("{0:s}: {1:.2f}".format(X.columns[i], item))
weight: 0.50
height: 0.39
left_handed: 0.72
union_preference: 0.05
eye_color: 0.03
Xác thực Mô hình trong Python