trekhleb/homemade-machine-learning

🤖 Python examples of popular machine learning algorithms with interactive Jupyter demos and math being explained

Open original source ↗

From the publisher

README & documentation

Source preview

Read the project’s overview, installation instructions and usage examples. The original README is the source of truth.

[](https://mybinder.org/v2/gh/trekhleb/homemade-machine-learning/master?filepath=notebooks) For Octave/MatLab version of this repository please check machine-learning-octave project. The purpose of this repository is not to implement machine learning algorithms by using 3rd party library one-liners but rather to practice implementing these algorithms from scratch and get better understanding of the mathematics behind each algorithm. That's why all algorithms implementations are called "homemade" and not intended to be used for production. In supervised learning we have a set of training data as an input and a set of labels or "correct answers" for each training set as an output. Then we're training our model (machine learning algorithm parameters) to map the input to the output correctly (to do correct prediction). The ultimate purpose is to find such model parameters that will successfully continue correct input→output mapping (predictions) even for new input examples. In regression problems we do real value predictions. Basically we try to draw a line/plane/n-dimensional…

trekhleb/homemade-machine-learning on GitHub A short preview, not the full document.

Read the full README ↗ · Preview checked 2026-10-27T05:30:21.636Z

Inside the original README — Document outline
  1. Homemade Machine Learning
  2. Supervised Learning
  3. Regression
  4. 🤖 Linear Regression
  5. Classification
  6. 🤖 Logistic Regression
  7. Unsupervised Learning
  8. Clustering
  9. 🤖 K-means Algorithm
  10. Anomaly Detection
  11. 🤖 Anomaly Detection using Gaussian Distribution
  12. Neural Network (NN)

Headings are captured from the source. Links open the publisher’s document, not a locally hosted copy.

Links from the README

References supplied by the publisher, not independently verified endorsements. Check the destination before downloading files or entering credentials.

Documentation belongs to its respective authors. Reported project/model license: MIT. A listing is not a grant of reuse or training rights. Confirm the document’s own terms at the source.

What this repository does

🤖 Python examples of popular machine learning algorithms with interactive Jupyter demos and math being explained

Repository facts

Owner
trekhleb
Primary language
Jupyter Notebook
Stars
24,843
Forks
4,184
Open issues + pull requests
30
License
MIT
Archived
No
Default branch
master
Created
2018-11-01T04:34:19.000Z
Last push
2025-11-23T04:22:46.000Z

Topics and intended use

Owner-supplied topics: algorithm, jupyter, jupyter-notebook, machine-learning, machine-learning-algorithms, machinelearning, python

Review the README for scope, installation, examples and limitations. We do not run repository code or certify it.

Evaluate before installing

Review licensing and dependencies, inspect recent commits and unresolved issues, and test in an isolated environment before production use. Stars and forks alone cannot answer these questions.

README and project files

Issues and maintenance discussion

Releases and changelog

Source and freshness

Source: GitHub. Metadata observed 2026-11-01T12:19:42.808Z. Daily imports are snapshots, not real-time monitoring.

Popularity and source listings do not establish security, suitability, licensing rights or benchmark performance.

Open original source

Related repositories

jackfrued/Python-100-Days

microsoft/generative-ai-for-beginners

rasbt/LLMs-from-scratch

microsoft/ML-For-Beginners

microsoft/AI-For-Beginners

pathwaycom/llm-app