Last active
February 18, 2020 16:21
-
-
Save dee-walia20/51394c12cec53d07c59c03293899e8f9 to your computer and use it in GitHub Desktop.
model_perf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Prediction from test dataset | |
from sklearn.metrics import classification_report, confusion_matrix, f1_score, precision_score, recall_score | |
model_name=[] | |
precision_array=[] | |
recall_array=[] | |
f1_array=[] | |
test_time=[] | |
print("Classifiation Report\n") | |
print("*****************************************************") | |
for i, pipeline in enumerate(pipelines): | |
start=time.time() | |
y_pred=pipeline.predict(X_test) | |
stop=time.time() | |
test_time.append(stop-start) | |
print(pipelines[i].steps[1][0].upper()) | |
model_name.append(pipelines[i].steps[1][0].upper()) | |
f1_array.append(round(f1_score(y_test, y_pred, average='weighted'),2)) | |
precision_array.append(round(precision_score(y_test, y_pred, average='binary'),2)) | |
recall_array.append(round(recall_score(y_test, y_pred, average='binary'),2)) | |
print("\n",classification_report(y_test, y_pred)) | |
print("*****************************************************") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment