Skip to content

ToyML: Machine Learning from Scratch

ToyML Cover

Python PyPI Codecov Documentation Python CI

Ruff ty prek Zensical

There are machine learning algorithms implemented from scratch. Let's learn machine learning with simple toy code.

Models

  • Clustering: K-means
  • Clustering: DBSCAN
  • Clustering: Hierarchical (Bisecting K-means & AGNES)
  • Classification: KNN
  • Classification: Naive Bayes
  • Ensemble: AdaBoost
  • Ensemble: Isolation Forest

Installation

Requires Python 3.15 or later. The core package has no runtime dependencies.

pip install toyml

For dendrograms and cluster-tree plots:

pip install "toyml[plot]"

Development

Use uv for the locked environment and just for development commands:

just setup
just hooks
just check

See the contributing guide for individual lint, test, build, and Zensical preview commands.

Release notes

See GitHub Releases for version history and release notes.