Skip to content

MLAlgorithms

Plain Python code implementing classic machine learning algorithms from scratch, for learning how they work.

Stars
11.2k
Forks
1.8k
Licence
MIT
Language
Python
Last update
1 months ago
Type
Learning resource

What it is

This is a collection of machine learning algorithms written in Python with numpy, scipy and autograd, kept short and readable. It covers topics such as linear and logistic regression, random forests, SVMs, k-means, PCA, t-SNE, gradient boosting and simple neural networks. The project aims to help people understand what happens inside these algorithms rather than to serve as a fast production library.

  • Read the linear model code to see how gradient-based training is written
  • Run the included examples such as python -m examples.linear_models
  • Modify an algorithm implementation to test an idea
  • Compare a from-scratch implementation against a standard library result

Great for

  • Students who want to see how algorithms work step by step
  • Developers who want to implement ML methods from scratch
  • Engineers who want to read code instead of optimized library internals
  • People who want small code to experiment with and modify

Not ideal for

  • Production systems that need speed or scale, since the code favors clarity over optimization
  • People who need a maintained, well-tested library with a stable release history, since the README does not describe a release process
  • Beginners with no Python experience, since the code assumes familiarity with numpy and the underlying math
Step-by-step guide: how to use MLAlgorithmsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Python · pip · git

    Clone the repository

    git clone https://github.com/rushter/MLAlgorithms

    Enter the project folder

    cd MLAlgorithms

    Install dependencies

    pip install scipy numpy

    Install in development mode

    python setup.py develop
  2. 2

    Run it

    • Clone the repository and enter the folder
    • Install scipy and numpy with pip
    • Run python setup.py develop
    • Run python -m examples.linear_models to see an example
  3. 3

    Get the most out of it

    • Run the Docker setup described in the README if you prefer not to install Python packages locally
    • Read the implementation files alongside the algorithm list to match code to theory
    • Use the examples folder as a starting point for your own experiments
    • Check the neuralnet folder for the deep learning implementations, which the README lists as MLP, CNN, RNN and LSTM

Downloads

Strengths

  • Code is designed to be short and easy to follow, according to the README
  • Covers a broad range of classic algorithms in one place
  • Usable without installation by running examples from the repository

Trade-offs

  • Not optimized, so it is slower than mainstream libraries, as the README implies by contrast
  • Requires comfort with Python and the math behind each algorithm
  • The README is brief and does not document an API or test coverage

How it compares

ProjectStarsTypeLevelUpdatedBest for
MLAlgorithms (this)11.2kLearning resourceintermediate1 months agoStudents who want to see how algorithms work step by step
annotated_deep_learning_paper_implementations67.6kLearning resourceintermediate4 days agoStudents learning how transformers, GANs, or optimizers work internally
mit-deep-learning10.5kLearning resourcebeginner2.8 years agoStudents following MIT deep learning courses
onnxruntime22.2kLibraryintermediate4 days agoDevelopers who want to deploy a trained model inside an application or service
nni14.4kLibraryintermediate2.3 years agoResearchers comparing hyperparameter tuning algorithms such as TPE, Hyperband, or Bayesian methods
petals10.7kLibraryintermediate2.2 years agoDevelopers who want to experiment with large open models like Llama 3.1 or BLOOM without owning the hardware to run them alone

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.