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:
- Click on the green "Code" button on the repository page.
- Select "Download ZIP" from the dropdown menu.
- 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.
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.
- sigmoid(z): computes the sigmoid of an input z.
- loss(Y, y_hat): computes the logistic regression loss.
- normalize(X): normalizes the input data.
- predict(X, w): predicts the class label of input data using the learned weights.
- plot_decision_boundary(X, w): plots the decision boundary for the input data.
- 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.
- Using the trained model, predict the output class labels for the test set.
- Calculate the accuracy of the model on the test set by comparing the predicted class labels with the true class labels.
- 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.
After training and evaluating the logistic regression model, the results can be interpreted and conclusions drawn.