1. Home
  2. Data Science
  3. Scikit-learn
  4. A call such as model.fit(X, y).predict(X) works in…

Added 30 Nov -0001

A call such as model.fit(X, y).predict(X) works in scikit-learn because fit returns:

  1. the training accuracy as a floating-point value
  2. the estimator itself, so that calls can be chained Correct answer
  3. a fitted copy, leaving the original unchanged
  4. a dictionary of the learned parameters

Correct answer

B. the estimator itself, so that calls can be chained

16 views

MCQSEXAM

Explanation

The API contract is that fit returns self, which is what allows fit and predict to be chained; the learned parameters are stored on that same object as attributes ending in an underscore.

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