scikit-learn: fit, predict, transform

One interface for every model and preprocessor

35 min · interactive lesson with runnable code and 4 graded exercises.

What you'll be able to do

  • Separate hyperparameters (constructor) from learned attributes (coef_, mean_)
  • Use predict vs predict_proba and pick the positive-class column correctly
  • Explain fit, transform, fit_transform and what each may see
  • Spot the API mistakes that leak test data

The full lesson is free with an account.

The estimator

predict vs predict_proba

Transformers

Where leakage enters

fit stores state

The honest sequence