Logistic Regression from Scratch - NumPy implementation with L1 and L2 ,cross-validation, Grid-Search, and sklearn benchmarks. Complete math derivations + code
About this project
Logistic Regression from Scratch (Math + Numpy) This repository is my full implementation of Binary Logistic Regression using only NumPy : Full implementation of logistic regression L1(Lasso) & L2(Ridge) Regularization cross-validation and hyperparameter tuning From Scratch Step-by-Step Jupyter Notebook with explanations PDF documentation of Logistic Regression math and theory Benchmark against scikit-learn 📋Table of Contents Topics Covered Implementation Details Results How to Run Video Explanation References 📚Topics Covered Core Model Logistic (Sigmoid) Function Log-Likelihood and Cross-Entropy Loss Batch, Stochastic, and Mini-Batch Gradient Descent Newton-Raphson (Iteratively Reweighted Least Squares) Regularization: L1 (Lasso), L2 (Ridge) Model Evaluation Accuracy, Precision, Recall, F1-Score ROC Curve & AUC Decision Boundary Visualization Cross Validation & Hyperparameter Tuning K-Fold & Stratified K-Fold Cross Validation Grid Search for Learning Rate & Regularization Strength Benchmarks Heart Disease Prediction Breast Cancer Prediction Benchmark vs scikit-learn LogisticRegression ⚙️Implementation Details Fully object-oriented design (class-based)
From the project README on
GitHub
- Stars
- 29
- Forks
- 4
- Last push
- 22 Oct 2025
Add this badge to your README
Show that your project is listed on Made in Algeria.
[](https://www.madeinalgeria.dev/projects/logisticlearn)