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


import os
import sys
import argparse
import numpy as np
import theano
import dlearn.stats as stats
    import matplotlib.pyplot as plt
from dlearn.utils.serialize import load_data, save_data
        t = target[:, j].ravel()
        fpr, tpr, thresh = stats.roc(o, t)
        auc = stats.auc(fpr, tpr)
        ret[j] = (auc, fpr, tpr, thresh)

    return ret


def show_stats(ret):

    n_cols = 4
    n_rows = len(ret) // n_cols + 1

    for j, (auc, fpr, tpr, thresh) in enumerate(ret):
        # Plot stats
        plt.subplot(n_rows, n_cols, j)
        plt.plot(fpr, tpr)
        plt.title('AUC = {:.2f}%'.format(auc * 100))

    plt.show()


if __name__ == '__main__':
    dataset_file = 'data_{0}.pkl'.format(args.dataset[0])
    model_file = 'model_{0}.pkl'.format(args.model[0])
    out_file = 'stats.pkl' if args.output is None else \
               'stats_{0}.pkl'.format(args.output)

    if not args.display_only:
        dataset = load_data(dataset_file)

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


# Path: examples/human_sar/evaluate.py
import os
import sys
import argparse
import numpy as np
import theano
import dlearn.stats as stats
    import matplotlib.pyplot as plt
from dlearn.utils.serialize import load_data, save_data

        t = target[:, j].ravel()
        fpr, tpr, thresh = stats.roc(o, t)
        auc = stats.auc(fpr, tpr)
        ret[j] = (auc, fpr, tpr, thresh)

    return ret


def show_stats(ret):

    n_cols = 4
    n_rows = len(ret) // n_cols + 1

    for j, (auc, fpr, tpr, thresh) in enumerate(ret):
        # Plot stats
        plt.subplot(n_rows, n_cols, j)
        plt.plot(fpr, tpr)
        plt.title('AUC = {:.2f}%'.format(auc * 100))

    plt.show()


if __name__ == '__main__':
    dataset_file = 'data_{0}.pkl'.format(args.dataset[0])
    model_file = 'model_{0}.pkl'.format(args.model[0])
    out_file = 'stats.pkl' if args.output is None else \
               'stats_{0}.pkl'.format(args.output)

    if not args.display_only:
        dataset = load_data(dataset_file)

        model = load_data(model_file)