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