Skip to content

Latest commit

 

History

History
62 lines (44 loc) · 4.83 KB

README.md

File metadata and controls

62 lines (44 loc) · 4.83 KB

Difficulty viewing large code files?

If you're having trouble viewing large code files on GitHub, you may find it helpful to download a ZIP file containing the entire repository. To do so, follow these steps:

  1. Click on the green "Code" button on the repository page.
  2. Select "Download ZIP" from the dropdown menu.
  3. Save the ZIP file to your computer.

This can be particularly useful if you're experiencing issues with GitHub's web interface or if you need to access the repository without an internet connection. If you have any questions or concerns, please don't hesitate to contact us. image

Logistic Regression Model for Binary Classification

Introduction

This is a logistic regression model for binary classification. It reads a CSV file containing input data with two attributes and a target class label, and pre-processes the data by removing unwanted columns and splitting it into training and test sets.

image

Functions

  1. sigmoid(z): computes the sigmoid of an input z.

image

image

  1. loss(Y, y_hat): computes the logistic regression loss.

image

image

3. gradients(X, Y, y_hat): computes the gradients of the loss w.r.t the weights.

image

image

  1. normalize(X): normalizes the input data.

image

image

  1. predict(X, w): predicts the class label of input data using the learned weights.

image

image

  1. plot_decision_boundary(X, w): plots the decision boundary for the input data.

image

image

  1. train(X, Y, epochs, eta): trains the logistic regression model on the input data using gradient descent. It returns the learned weights and the loss vs. epoch list.

image

image

image

image

image

Model Usage

  1. Using the trained model, predict the output class labels for the test set.
  2. Calculate the accuracy of the model on the test set by comparing the predicted class labels with the true class labels.

image

  1. Visualize the decision boundary by plotting the test set along with the decision boundary line, which is the line that separates the positive and negative classes.

image

Conclusion

After training and evaluating the logistic regression model, the results can be interpreted and conclusions drawn.