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.
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.
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.
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
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.