Commit e8dab1d3 by Pamela Osuna

confusion matrix added

parent 34062b83
import parser
import models as m
import roc_auc as ra
import sys
from confusion_matrix import confusion_matrix
import numpy as np
from sklearn.model_selection import train_test_split
......@@ -172,7 +172,7 @@ def run_kfold(X_train, X_test, y_train, y_test, params):
# calculate area under the curve
y_pred = model.predict(X_validation, batch_size = bs)
fpr, tpr, auc = ra.roc_auc(N_CLASSES, validation_Y_one_hot, y_pred)
fpr, tpr, auc = ra.roc_auc(N_CLASSES, y_test, y_pred)
total_auc += auc
print("Area under the curve:", auc)
......@@ -182,4 +182,8 @@ def run_kfold(X_train, X_test, y_train, y_test, params):
print("Average accuracy: ", total_acc)
print("Average area under the curve: ", total_auc)
return total_acc, total_auc
# confusion matrix
cm = confusion_matrix(y_test.argmax(axis=1), y_pred.argmax(axis=1))
return total_acc, total_auc, cm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment