Skip to content

Instantly share code, notes, and snippets.

@rohanjoseph93
Last active December 29, 2018 19:58
Show Gist options
  • Save rohanjoseph93/bc3db1e43adfc27d0f21710c4865f5d0 to your computer and use it in GitHub Desktop.
Save rohanjoseph93/bc3db1e43adfc27d0f21710c4865f5d0 to your computer and use it in GitHub Desktop.
#Logistic regression
from sklearn.linear_model import LogisticRegression
clf = LogisticRegression().fit(X_train,y_train)
y_pred = clf.predict(X_test)
# Model Evaluation metrics
from sklearn.metrics import accuracy_score,recall_score,precision_score,f1_score
print('Accuracy Score : ' + str(accuracy_score(y_test,y_pred)))
print('Precision Score : ' + str(precision_score(y_test,y_pred)))
print('Recall Score : ' + str(recall_score(y_test,y_pred)))
print('F1 Score : ' + str(f1_score(y_test,y_pred)))
#Logistic Regression Classifier Confusion matrix
from sklearn.metrics import confusion_matrix
print('Confusion Matrix : \n' + str(confusion_matrix(y_test,y_pred)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment