Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Month 2 — Classical ML (Scikit-learn)

🎯 Goal of this month

By the end of the month you will be able to:

  • Turn a real business problem into an ML task (regression / classification / clustering)
  • Build a complete ML pipeline with Scikit-learn
  • Evaluate a model and understand error types
  • Create production-grade models with XGBoost/LightGBM
  • Participate in a Kaggle competition and reach the top 30%

Weekly breakdown

WeekTopicTime
Week 1ML foundations + Regression10-12 hours
Week 2Classification + Clustering10-12 hours
Week 3Feature Engineering + Evaluation8-10 hours
Week 4Ensembles (XGBoost/LightGBM) + Kaggle12-15 hours

Chapter order

  1. Introduction to ML — terms, process, training/test split
  2. Regression — predicting a continuous value
  3. Classification — separating into classes
  4. Clustering — unsupervised grouping
  5. Feature Engineering — preparing and creating features
  6. Model Evaluation — metrics and validation
  7. Ensemble Methods — Random Forest, XGBoost, LightGBM
  8. Exercises — additional exercises and Kaggle tasks

What can you do by the end of the month?

  • Solve 80% of tabular data problems (regression, classification, clustering)
  • Write reproducible code using Scikit-learn Pipeline
  • Save a model with joblib and serve it via FastAPI
  • Reach Kaggle top 30% with XGBoost/LightGBM
  • Explain the ROI of an ML model to the business

Tip for Backend Dev

Like writing a REST API in backend, in ML there’s the fit() → predict() pattern:

# Backend pattern
@app.post("/users")
def create_user(data: UserIn):
    user = User(**data.dict())
    db.add(user)
    return user

# ML pattern
model = LogisticRegression()
model.fit(X_train, y_train)        # "train"
predictions = model.predict(X_test) # "predict"

This pattern is the same for all sklearn models — if you know LinearRegression, you also know RandomForest.

MLOps integration (from the start)

Backend dev’s advantage — production thinking. When writing your first model, already think about:

  1. Reproducibilityrandom_state=42 everywhere
  2. Savingjoblib.dump(model, 'model.pkl')
  3. Versioningmodel_v1.pkl, model_v2.pkl
  4. Schema — input/output validation with Pydantic
  5. Logging — timestamp and input for every prediction

These topics are covered deeper in Month 6 (MLOps), but start from day one.

Start

Start with Introduction to ML.