1. Home
  2. Data Science
  3. Scikit-learn
  4. What does n_jobs=-1 change about a scikit-learn estimator…

Added 30 Nov -0001

What does n_jobs=-1 change about a scikit-learn estimator such as RandomForestClassifier?

  1. It sets the number of trees to the core count, overriding n_estimators entirely
  2. It spreads independent fits over all available cores, without changing the results Correct answer
  3. It repeats the fit once per available core and averages the resulting forests together
  4. It disables parallel execution, because -1 means a single worker thread here

Correct answer

B. It spreads independent fits over all available cores, without changing the results

14 views

MCQSEXAM

Explanation

n_jobs controls joblib parallelism over independent tasks such as trees or folds, so results are unchanged apart from floating-point ordering. It cannot parallelise a single sequential estimator, and oversubscription with nested parallelism can make fits slower. In GridSearchCV the same parameter parallelises candidate fits rather than the model itself.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs