【问题标题】:warnings.warn("Estimator fit failed. The score on this train-test"warnings.warn("Estimator fit failed. the score on this train-test"
【发布时间】: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


    【解决方案1】:

    https://datascience.stackexchange.com/questions/81753/gridsearchcv-to-fine-tune-outputs-valueerror-and-fitfailedwarning

    尝试打印

    print(train_df.info()) print(test_df.info())
    

    在我的例子中,我使用了 0.0、0,5 和 1.0,因为我将 0 1 2 标准化。当我更改为 0 1 2 时,我的“y”。好用!!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-02
      • 2013-07-13
      • 2020-05-28
      • 2022-12-02
      • 1970-01-01
      • 1970-01-01
      • 2019-11-01
      • 1970-01-01
      相关资源
      最近更新 更多