import numpy as np
from sklearn.metrics import roc_curve, auc
import matplotlib.pyplot as plt

'''
test_np_array = np.random.random((5000, 919))
test_labels = np.random.randint(low = 0, high = 2, size = (5000, 919))
'''

# Alternate function definition in case the roc_curve function does not generate a good plot
# def generateROCplot(generatedLabels, actualLabels, stepSize = 0.01, startVal = 0.01, endVal = 0.99):


def generateROCplot(generatedLabels, actualLabels):
    index_vec = [1]*125 + [2]*690 + [3]*104
    auc_list = []
    for i in np.unique(index_vec):
        generatedLabelsClass = generatedLabels[:, index_vec == i]
        actualLabelsClass = actualLabels[:, index_vec == i]
        auc_vec = [0]*len(generatedLabelsClass[0])
        plt.figure()
        for j in range(0, len(generatedLabelsClass[0])):
            fpr, tpr, thresholds = roc_curve(actualLabelsClass[:,j], generatedLabelsClass[:,j])
            auc_vec[j] = auc(fpr, tpr)        
            plt.plot(fpr, tpr, 'k')
            plt.legend(loc='lower right')
            # plt.plot([0,1],[0,1],'r--')
            plt.xlim([-0.1,1.2])
            plt.ylim([-0.1,1.2])
            plt.ylabel('True Positive Rate')
            plt.xlabel('False Positive Rate')
            plt.hold(True)
        plt.show()
        auc_list += [auc_vec]
    return auc_list
        
# auc_output = generateROCplot(test_np_array, test_labels)

@@ -1400,8 +1400,360 @@
 labels)%0A
+%0A%0A# fileName should include location%0Adef generateLossCurve(fileName):%0A    f = open(fileName)%0A    defText = f.read().split('%5Cn')%0A    defText = defText%5B1:%5D%0A    x = %5B%5D%0A    y = %5B%5D    %0A    for line in defText:%0A        x += %5Bint(line.split(')')%5B0%5D)%5D%0A        y += %5Bfloat(line.split(')')%5B1%5D.split('=')%5B1%5D)%5D%0A    f.close()%0A    plt.plot(x, y, 'k')%0A    plt.show()%0A

Update evalUtils.py