Ehsan Esbati
Ehsan Esbati

Reputation: 35

Interpreting verbose output from sklearn Random Forest

Just wondering what the output message below means:

[Parallel(n_jobs=-2)]: Using backend ThreadingBackend with 11 concurrent workers.
[Parallel(n_jobs=-2)]: Done  28 tasks      | elapsed: 901.9min
[Parallel(n_jobs=-2)]: Done  50 out of  50 | elapsed: 1366.7min finished

What is a task here? Does it refer to each individual estimator, hence setting n_estimators=100 creates 100 tasks? Or is it related to something else?

Upvotes: 1

Views: 570

Answers (1)

Gamze
Gamze

Reputation: 21

#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_)

You can use verbose in GridSearchCV like this. If you send your code, I can help you to solve (:

Upvotes: 2

Related Questions