msikorski93 / Logistic-Regression-Classifier-From-Scratch

Logistic regression created in Python for binary classification.

Repository from Github https://github.commsikorski93/Logistic-Regression-Classifier-From-ScratchRepository from Github https://github.commsikorski93/Logistic-Regression-Classifier-From-Scratch

Logistic-Regression-Classifier-From-Scratch

 alt text  alt text  alt text  alt text  alt text

Logistic regression with the ability of implementing penalty terms. The class object is dedicated to binary classification and is compatible with scikit-learn's GridSearchCV method.
An example of its usage was performed on the WBCD dataset and returned the following estimates:

  • Accuracy: 0.9883
  • Recall: 0.9841
  • Precision: 0.9841
  • Error Rate: 0.0117
  • F1 Score: 0.9841
  • ROC: 0.9874
  • Specificity: 0.9907
  • Misclassified Samples: 2 (out of 171)

Code example:

from logistic_regression import LogisticRegression

log_model = LogisticRegression(learning_rate=0.01, C=0.1, num_iter=20, penalty='elasticnet', l1_ratio=0.7)
log_model.fit(X_train, y_train)

predictions = log_model.predict(X_test, threshold=0.6)

About

Logistic regression created in Python for binary classification.


Languages

Language:Jupyter Notebook 93.2%Language:Python 6.8%