ML Algorithms from Scratch
Linear Regression, Logistic Regression, Decision Tree, KNN, and Naive Bayes implemented from scratch using NumPy — MSDS Coursework
| MSDS Coursework | Batangas State University | 2025–2026 |
Overview
Implemented 5 classical ML algorithms entirely from first principles using NumPy — no sklearn for the core logic, just math and manual formula implementation. Each algorithm is paired with a step-by-step written explanation, dataset, and output figures.
Algorithms Implemented
| Algorithm | Dataset | Key Result |
|---|---|---|
| Linear Regression | TV Marketing (200 samples) | Pearson’s r = 0.782 |
| Logistic Regression | Pima Indians Diabetes (768 samples) | Sigmoid probability visualisation |
| Decision Tree | Iris (150 samples) | Train: 78.57% / Test: 71.05% |
| K-Nearest Neighbors | Pima Indians Diabetes (768 samples) | Best k=5, Accuracy: 72.73% |
| Naive Bayes | Iris (150 samples) | Accuracy: 90.00% |
What Each Implementation Covers
- Formula derivation and manual step-by-step computation
- No sklearn for core algorithm logic — only for data splitting and evaluation metrics
- Written explanation (Markdown + PDF) with figures for each algorithm
- Validation on real-world datasets
Tech Stack: Python · NumPy · Pandas · Matplotlib · Seaborn · Google Colab