Skip to content

About

Building a Logistic Regression Model from scratch without using any built-in algorithm in python.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Logistic Regression from Scratch in Python

This project demonstrates how to build a logistic regression classifier from scratch using only NumPy—no machine learning libraries like scikit-learn were used for the algorithm itself. The goal is to understand and implement the underlying math, including the sigmoid function, gradient descent, and cross-entropy (log) loss.


📚 What This Project Covers

  • Logistic Regression fundamentals
  • Implementation of the sigmoid activation function
  • Loss function: Cross Entropy (Log Loss)
  • Manual gradient descent optimization
  • Accuracy evaluation on a real-world dataset (National Institute of Diabetes and Digestive and Kidney Diseases.)

🧠 Math Behind It

The logistic regression algorithm is built upon:

Sigmoid Function

$$ \hat{y} = \frac{1}{1 + e^{-z}} $$

Cross-Entropy Loss

$$ L = -\frac{1}{N} \sum \left[ y \cdot \log(\hat{y}) + (1 - y) \cdot \log(1 - \hat{y}) \right] $$

  • Gradient Descent for updating weights and bias.

🧪 Dataset Used


🛠️ Libraries Used

Only essential libraries were used:

numpy
pandas
scikit-learn (for data preprocessing and train-test split)

About

Building a Logistic Regression Model from scratch without using any built-in algorithm in python.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages