解释 sklearn 随机森林的详细输出

时间:2021-06-19 10:13:50

标签: python-3.x scikit-learn random-forest

只是想知道下面的输出消息是什么意思:

settings.json

这里的任务是什么?它是否指的是每个单独的估算器,因此设置 "multiCommand.commands": [ { "command": "multiCommand.commentDown", "sequence": [ "editor.action.addCommentLine", "cursorDown", ] }, ], 会创建 100 个任务?还是跟别的有关?

1 个答案:

答案 0 :(得分:2)

#model 4 - Random Forest Classifier with tuned hyperparameters
seed=42
pipeline_rf = pipe_imb(steps=[ ("vect", text.TfidfVectorizer(lowercase=False, ngram_range=(1,2), smooth_idf=True, min_df=0.001, max_df = 0.5)),
                               ('sampler', SMOTE(random_state=seed, sampling_strategy='minority')),
                               ('clf', RandomForestClassifier(random_state=seed))])

params = {
    'clf__n_estimators'     : [300,500]}


kfold = StratifiedKFold(n_splits = 3, random_state = 42, shuffle=True)
gridSearch_rf = GridSearchCV(pipeline_rf, param_grid = params, n_jobs=-1, cv=kfold,  verbose=0))
gridSearch_rf.fit(X_train,y_train)
print('Best parameters:', gridSearch_rf.best_params_)
print('Best CV score  :', gridSearch_rf.best_score_)

您可以像这样在 GridSearchCV 中使用 verbose。如果你发你的代码,我可以帮你解决(: