Skip to content

This project provided practice with logistic regression and the cost functions MSE and log loss

Notifications You must be signed in to change notification settings

Nour-Sadek/Logistic-Regression-from-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Logistic Regression from Scratch

About

In this project, we will take a look at the logistic regression algorithm and build a custom binary classifier. The main idea of the project is to implement gradient descent for two different cost functions, devise a method to predict the probability that a given sample belongs to a certain class, and analyze training errors. And last but not least — put your models to the test on a real dataset.

Learning Outcomes of the Project:

Come to know logistic regression. Learn the math behind it and implement a solution that will be on par with the one from sklearn. Study two kinds of cost function — Mean Squared Error and Log Loss. These concepts will give you the freedom to combine different tools for solving complex problems.

Learning Outcomes of Each Stage of the Project

Stage 1 : Predict probabilities with a sigmoid function.

Stage 2 : Fit a method when the cost function is the Mean squared error.

Stage 3 : Build a fit method with a Log-loss cost function.

Stage 4 : Make the final touches on the algorithm and compare between models.

General Info

To learn more about this project, please visit HyperSkill Website - Logistic Regression from Scratch.

This project's difficulty has been labelled as Challenging where this is how HyperSkill describes each of its four available difficulty levels:

  • Easy Projects - if you're just starting
  • Medium Projects - to build upon the basics
  • Hard Projects - to practice all the basic concepts and learn new ones
  • Challenging Projects - to perfect your knowledge with challenging tasks

This Repository contains one .py file:

code.py - Contains the code used to complete the Logistic Regression models

Project was built using python version 3.11.3

How to Run

Download the code.py file to your local repository and open the project in your choice IDE and run the project. A custom regression model class was written and implemented to compare the performance of different models that use different cost functions to output the optimal weight parameters. Their performance was compared to the Logistic Regression model provided by sklearn. Please read each Stage's docstring to know the requirements of each stage and understand the output of the program.

About

This project provided practice with logistic regression and the cost functions MSE and log loss

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages