internalsGet Pro

Module 02 · Lesson 6 of 8Pro

scikit-learn: the fit and predict pattern

Level
Beginner
Topic
Python for machine learning
Reading time
14 min

When you finish this page you can

  1. Train a scikit-learn model with fit and score new rows with predict and predict_proba.
  2. Turn predicted probabilities into a ranked list with a fixed budget, instead of yes or no labels.
  3. Compare a model with its baselines on held-out rows, using the same calls for every approach.
  4. Put preprocessing inside a pipeline so training, testing and the weekly scoring job transform data the same way.
  1. Baselines: the simple model to beat13 min
  2. Data, features and labels14 min
  3. The ML toolkit: a map of libraries and platforms13 min

The model flags 3,100 customers, not 20,000

is our example online store. Its ML team works on a notebook sample of about 1 million orders, 200,000 customers and 50,000 products. Every Monday, Joseph’s growth team sends a ₹100 voucher to the 20,000 customers most likely to : to place no order in the next 60 days.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan