Machine learning with scikit-learn

Machine learning is less about the algorithm than about asking the right question and not fooling yourself with the answer. We go through the whole workflow with scikit-learn, from a raw table to a model you can trust, save and put behind an API.

Duration: 3 days · Level: intermediate

For: analysts, scientists and developers who want to add machine learning to their toolbox.

Prerequisites: being comfortable with Python and pandas.

Machine learning with scikit-learn

Day 1 — Framing and first models

  • What machine learning can, and can't, do for you
  • Framing the problem: supervised, unsupervised, what to predict
  • Features, target and the scikit-learn API: fit, predict, transform
  • Splitting your data: train and test
  • A first regression: linear models
  • Measuring errors: MAE, RMSE, R²
  • A first classification: logistic regression, k nearest neighbours
  • Accuracy lies: confusion matrix, precision, recall, F1
  • Decision trees and random forests

Day 2 — Doing it properly

  • Overfitting and underfitting: the bias/variance trade-off
  • Cross-validation
  • Feature engineering: scaling, encoding categories, missing values
  • Chaining it all with pipelines and ColumnTransformer
  • Tuning hyperparameters with grid and random search
  • Unbalanced classes
  • Avoiding data leaks
  • Grouping without labels: clustering with k-means
  • Reducing dimensions with PCA

Day 3 — Into production

  • Interpreting a model: feature importance and permutation
  • Saving and loading models with joblib and skops
  • Serving predictions behind a web API
  • Monitoring a model that ages
  • A word on gradient boosting: XGBoost, LightGBM
  • A word on deep learning: when scikit-learn is no longer enough
  • A project from start to finish on your data

Elevate Your Python Proficiency!