使用交叉验证拟合randomForest模型

问题描述 投票:0回答:1

我想交叉验证随机森林模型。我做到了这一点:但我不知道如何适应它。

classifier= RandomForestClassifier(n_estimators=100, random_state=0)    
from sklearn.model_selection import cross_val_score  
val = cross_val_score(estimator=classifier, X=X_train, y=y_train, cv=5)

我知道要用交叉验证来填充模型

 val.fit(X, y)
python python-3.6 random-forest cross-validation
1个回答
0
投票

你不需要fit,你应该在scores有5倍的val

© www.soinside.com 2019 - 2024. All rights reserved.