【发布时间】:2021-09-15 09:21:50
【问题描述】:
FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details:
Traceback (most recent call last):
运行以下代码后,我遇到了上述错误。因此,我在分类报告中的精度和 F 分数得到 0.0。请帮我解决这个问题。
rfcl = RandomForestClassifier(n_estimators = 500,random_state=0)
rfcl = rfcl.fit(X_train, train_labels)
from sklearn.model_selection import GridSearchCV
param_grid = {
'max_depth': [7, 10],
'max_features': [4, 6],
'min_samples_leaf': [50, 100],
'min_samples_split': [150, 300],
'n_estimators': [301, 500]
}
rfcl = RandomForestClassifier()
grid_search = GridSearchCV(estimator = rfcl, param_grid = param_grid, cv=3)
grid_search.fit(X_train, train_labels)
【问题讨论】:
标签: python random-forest data-mining