A minimalistic, educational machine learning library implemented from scratch in Python. This project is designed for learning and experimentation, providing clear, well-documented code for core ML algorithms and utilities.
- Core ML algorithms: KNN, Linear Regression, Logistic Regression, and more
- Utility modules: Activation functions, optimization, preprocessing, statistics, and linear algebra
- Simple, readable code for educational purposes
- Comprehensive tests for each module
git clone https://github.com/YOUR_USERNAME/mini_ml.git
cd mini_ml
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt- Use Git Bash or WSL for best compatibility.
- Follow the Linux instructions above inside your terminal.
Each module in src/ has its own documentation and usage guide:
- Activation Functions
- KNN
- Linear Algebra
- Linear Model
- Logistic Model
- Optimization
- Preprocessing
- Statistics
Each guide covers:
- Theory, math, and intuition
- Main functions/classes to use
- Short code examples
from src.knn import KNNClassifier
X_train = [[0, 0], [1, 1], [2, 2]]
y_train = [0, 1, 1]
knn = KNNClassifier(k=3)
knn.fit(X_train, y_train)
pred = knn.predict([[1.5, 1.5]])
print(pred)- Fork the repository and create a new branch from
main. - Add or improve features. Write tests for your code in the
tests/folder, following the existing style. - Run all tests with:
Ensure all tests pass. Add a screenshot of your terminal showing all tests passing to your PR.
uv sync uv run -m pytest
- Use semantic commit messages.
- Open a pull request.
See CONTRIBUTING.md for more details.
This project is for educational purposes. Contributions and feedback are welcome!