A hands-on repository for implementing machine learning algorithms from scratch, with a focus on understanding the mathematics, optimization, and system design behind modern ML models.
This project bridges the gap between theory and real-world ML engineering.
Most machine learning libraries hide the underlying mechanics.
This repository focuses on:
- Building algorithms from first principles
- Understanding how models learn
- Writing clean, modular, production-style Python code
- Developing intuition for model performance and limitations
- Implement core ML algorithms without high-level frameworks
- Strengthen understanding of optimization and learning dynamics
- Build reusable ML components
- Prepare for advanced ML systems and MLOps workflows
ml-systems-lab/
β
βββ src/
β βββ perceptron/
β β βββ perceptron.py
β β βββ xor.py
β β βββ init.py
β βββ backpropagation/
β β βββ backpropagation.py
β β βββ init.py
β β
β βββ linear_models/
β β βββ linear_regression.py
β β βββ logistic_regression.py
β β βββ init.py
β β
β βββ utils/
β β βββ metrics.py
β β βββ data_utils.py
β β βββ init.py
β β
β βββ init.py
β
βββ notebooks/
β βββ experiments.ipynb
β
βββ tests/
β βββ test_perceptron.py
β β βββ xor.py
β βββ test_linear_models.py
β
βββ data/
β βββ (datasets go here)
β
βββ examples/
β βββ perceptron_example.py
β
βββ requirements.txt
βββ README.md
βββ .gitignore
- Perceptron (binary classification)
- XOR (basic multilayer perceptron)
- Linear Regression
- Logistic Regression
- Neural Networks (MLP)
- Decision Trees
- Support Vector Machines (SVM)
import numpy as np
from src.perceptron.perceptron import Perceptron
X = np.array([[0,0], [0,1], [1,0], [1,1]])
y = np.array([0, 0, 0, 1])
model = Perceptron(input_dim=2, learning_rate=0.1)
model.train(X, y)- Pure NumPy implementations (no ML frameworks)
- Modular and extensible design
- Clear training loops and update rules
- Easy to debug and experiment with
- Structured like a real ML codebase
- Clarity over cleverness
- Understanding over abstraction
- Engineering discipline over shortcuts
Each algorithm is implemented with:
- Direct math-to-code mapping
- Explicit training procedures
- Reusable components
- Python
- NumPy
- (Planned) Pandas
- (Planned) Matplotlib
Derrick Nyongesa
Data Scientist | Electrical & Electronics Engineer
Focus: Understanding Machine Learning Algorithims