← all repositories
eriklindernoren/ML-From-Scratch

NumPy-only ML zoo: 30+ algorithms, zero black boxes

A readable reference for how classic machine learning actually works under the hood, from backprop to genetic algorithms.

32.3k stars Python ML FrameworksLearning
ML-From-Scratch
Velocity · 7d
+9.6
★ / day
Trend
cooling
star history

What it does

ML-From-Scratch is a collection of fundamental machine learning algorithms implemented in pure Python with NumPy. The repo covers supervised learning, unsupervised learning, reinforcement learning, and deep learning — everything from linear regression and SVMs to CNNs, GANs, and Deep Q-Networks.

The interesting bit

The author explicitly trades speed for transparency: no PyTorch, no TensorFlow, no opaque autograd. You get hand-rolled backprop, evolutionary neural networks trained by mutation and crossover, and even a genetic algorithm that evolves strings letter by letter. It is pedagogy through masochism, and it works.

Key highlights

  • 30+ implementations including XGBoost, DBSCAN, Restricted Boltzmann Machines, and Apriori association analysis
  • Each example prints a model summary showing layer shapes and parameter counts, like a tiny Keras built from np.dot
  • Working demos: polynomial regression on Swedish weather data, CartPole via DQN, MNIST generation with a GAN
  • Includes neuroevolution and particle swarm optimization of neural networks — gradient-free training methods rarely seen in introductory material

Caveats

  • The README warns that efficiency is explicitly not the goal; these are reference implementations, not production code
  • Some README sections are truncated in the source, so the full list of unsupervised and deep learning implementations is cut off

Verdict

Ideal for students, interview preppers, or anyone who has called .fit() a thousand times and finally wants to see the matrix math. Skip it if you need GPU acceleration or a library to ship tomorrow.

Frequently asked

What is eriklindernoren/ML-From-Scratch?
A readable reference for how classic machine learning actually works under the hood, from backprop to genetic algorithms.
Is ML-From-Scratch open source?
Yes — eriklindernoren/ML-From-Scratch is open source, released under the MIT license.
What language is ML-From-Scratch written in?
eriklindernoren/ML-From-Scratch is primarily written in Python.
How popular is ML-From-Scratch?
eriklindernoren/ML-From-Scratch has 32.3k stars on GitHub and is currently cooling off.
Where can I find ML-From-Scratch?
eriklindernoren/ML-From-Scratch is on GitHub at https://github.com/eriklindernoren/ML-From-Scratch.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.