def ROCcurve(y_pred, y_test):
    n_classes = y_pred.shape[1]
    fpr = dict()
    tpr = dict()
    roc_auc = dict()
    y_test1 = []
    for (index, row) in y_test.iteritems():
        if (row == 0):
            y_test1 += [[1, 0]]
        else:
            y_test1 += [[0, 1]]
    y_test1 = np.array(y_test1)
    for i in range(n_classes):
        (fpr[i], tpr[i], _) = roc_curve(y_test1[:, i], y_pred[:, i])
        roc_auc[i] = auc(fpr[i], tpr[i])
    (fpr['micro'], tpr['micro'], _) = roc_curve(y_test1.ravel(), y_pred.ravel())
    roc_auc['micro'] = auc(fpr['micro'], tpr['micro'])
    return (fpr, tpr, roc_auc)
def ROCcurve(y_pred, y_test):
    n_classes = y_pred.shape[1]
    fpr = dict()
    tpr = dict()
    roc_auc = dict()
    y_test1 = []
    for (index, row) in y_test.iteritems():
        if (row == 0):
            y_test1 += [[1, 0]]
        else:
            y_test1 += [[0, 1]]
    y_test1 = np.array(y_test1)
    for i in range(n_classes):
        (fpr[i], tpr[i], _) = roc_curve(y_test1[:, i], y_pred[:, i])
        roc_auc[i] = auc(fpr[i], tpr[i])
    (fpr['micro'], tpr['micro'], _) = roc_curve(y_test1.ravel(), y_pred.ravel())
    roc_auc['micro'] = auc(fpr['micro'], tpr['micro'])
    return (fpr, tpr, roc_auc)