# Path: dlearn/utils/serialize.py
# def save_data(data, fpath):
#     with open(fpath, 'wb') as f:
#         cPickle.dump(data, f, cPickle.HIGHEST_PROTOCOL)


import os
import sys
import dlearn.stats as stats
    import matplotlib.pyplot as plt
from scipy.io import loadmat
from dlearn.utils.serialize import save_data

homepath = os.path.join('..', '..')

if not homepath in sys.path:
    sys.path.insert(0, homepath)



def compute_stats(output, target):
    n = target.shape[1]
    ret = [0] * n
    for j in xrange(n):
        o = output[:, j].ravel()
        t = target[:, j].ravel()
        fpr, tpr, thresh = stats.roc(o, t)
        auc = stats.auc(fpr, tpr)
        ret[j] = (auc, fpr, tpr, thresh)


# Path: dlearn/utils/serialize.py
# def save_data(data, fpath):
#     with open(fpath, 'wb') as f:
#         cPickle.dump(data, f, cPickle.HIGHEST_PROTOCOL)


# Path: examples/human_sar/evaluate_svm.py
import os
import sys
import dlearn.stats as stats
    import matplotlib.pyplot as plt
from scipy.io import loadmat
from dlearn.utils.serialize import save_data


homepath = os.path.join('..', '..')

if not homepath in sys.path:
    sys.path.insert(0, homepath)



def compute_stats(output, target):
    n = target.shape[1]
    ret = [0] * n
    for j in xrange(n):
        o = output[:, j].ravel()
        t = target[:, j].ravel()
        fpr, tpr, thresh = stats.roc(o, t)
        auc = stats.auc(fpr, tpr)
        ret[j] = (auc, fpr, tpr, thresh)


    return ret