1. Home
  2. Data Science
  3. Scikit-learn
  4. What does passing sample_weight to fit() actually do?

Added 30 Nov -0001

What does passing sample_weight to fit() actually do?

  1. It multiplies each row's contribution to the loss by its weight, without resampling the data Correct answer
  2. It sorts the rows so that heavier samples are fitted first and influence the coefficients more
  3. It affects only predict, not the fitted coefficients, which are always learned unweighted
  4. It physically replicates rows in proportion to their weights before the fit begins to run

Correct answer

A. It multiplies each row's contribution to the loss by its weight, without resampling the data

14 views

MCQSEXAM

Explanation

Sample weights enter the objective as multipliers on per-row losses, so a weight of 2 counts a sample like two identical copies while the dataset size stays unchanged. They are the mechanism behind class_weight='balanced' and behind survey or exposure weighting. Weights change the learned coefficients or split thresholds, not the behaviour of predict.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? 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