Creating fake data

Creating the sigmoid function which we will need later

Code to make the forward propagation

Defining the cost function

Defining the Gradient descent

Train the model

Plotting a graph with the CostList

Visualize the decision boundary on training set

Generating Final Prediction

Changing the values greater than 0.5 to 1 and lower than 0.5 to 0

Checking the accuracy score

Sci-kit Learn Implementation

Till now we have completely focused on creating our logistic regression model and then making prediction with its help from scratch. We have also calculated the accuracy score using our logistic regression model, now we will train the dataset using the logistic regression function of sklearn, and we will also calculate the accuracy score to see if our model is close or not.

On comparing the accuracy from both the models we find that they are almost similar, infact our model performed a little bit better.