Skip to content
DeepForgeby svx
Intermediateml-fundamentalssupervised-learningunsupervised-learningmetrics

ML From Scratch

28 problems·~12h·4 stages

Implement the classic machine learning toolkit with nothing but Python lists and loops. You will build regression, k-NN, k-means, decision trees, naive Bayes, PCA, and boosting, plus the metrics that tell you whether they work. Ideal for anyone who has called fit() and predict() but never written them.

Your progress

0/28 · 0%

Path readiness 0%Easy 0% · Medium 0% · Hard 0%

Continue path · Accuracy

What you will learn

  • Implement regression, k-NN, k-means, trees, and naive Bayes in pure Python
  • Split data honestly and compute the core classification and regression metrics
  • Derive closed-form ridge regression and run power iteration for PCA
  • Build boosting and matrix-factorization update steps from the maths

Before you start

1Data and Metrics

0/7

Machine learning starts with clean features and honest measurement. Standardize columns, encode categories, split folds, and compute accuracy, MSE, and distance.

Stage checkpoint

0/2 to pass

A checkpoint is a short retrieval test drawn from this stage: solve 2 of 3 from memory to mark the stage complete. The stage stays open either way.

Tried this set and did not pass? Record it — the next set swaps in fresh problems from the same stage.
LabRecommended next stepLogistic Regression, From ScratchEasy

2Supervised Core

0/7

Fit the workhorse models: the sigmoid, linear regression, k-NN, and the loss gradients that train them, from MSE to binary cross-entropy.

Stage checkpoint

0/2 to pass

A checkpoint is a short retrieval test drawn from this stage: solve 2 of 3 from memory to mark the stage complete. The stage stays open either way.

Tried this set and did not pass? Record it — the next set swaps in fresh problems from the same stage.
LabRecommended next stepLogistic Regression, From ScratchEasy

3Trees, Clusters, and Ensembles

0/8

Split data by impurity, group it with k-means, and combine weak learners. Entropy, Gini, information gain, and AdaBoost's reweighting rule.

Stage checkpoint

0/2 to pass

A checkpoint is a short retrieval test drawn from this stage: solve 2 of 3 from memory to mark the stage complete. The stage stays open either way.

Tried this set and did not pass? Record it — the next set swaps in fresh problems from the same stage.
LabRecommended next stepLogistic Regression, From ScratchEasy

4Regularization, Latent Structure, and Bayes

0/6

Control model complexity and find structure: ridge regression, naive Bayes, covariance matrices, power iteration, explained variance, and matrix-factorization SGD.

Stage checkpoint

0/2 to pass

A checkpoint is a short retrieval test drawn from this stage: solve 2 of 3 from memory to mark the stage complete. The stage stays open either way.

Tried this set and did not pass? Record it — the next set swaps in fresh problems from the same stage.
LabRecommended next stepLogistic Regression, From ScratchEasy

Capstone

Lab

Close the path with one real artifact from the catalog.

Logistic Regression, From Scratch

Take the classifier you wrote in the supervised stage onto held-out rows and beat the majority-class baseline.