2019-06-24
阅读量:
492
拟合预测模型
拟合预测模型(此处为随机森林)
- 由于Random fored是来自sklearn.ensemble的集合模型(由许多树组成),因此导入RandomForestClassifier类
- 使用501树或“n_estimators”,标准为“熵”
- 通过.fit()方法使用属性X_train和y_train拟合模型
# Fitting Random Forest Classification
# to the Training set
from sklearn.ensemble import RandomForestClassifier
# n_estimators can be said as number of
# trees, experiment with n_estimators
# to get better results
model = RandomForestClassifier(n_estimators = 501,
criterion = 'entropy')
model.fit(X_train, y_train)






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论