continue from 140926-GBC


In [1]:
%matplotlib inline
from matplotlib import pylab as pl
import cPickle as pickle
import pandas as pd
import numpy as np
import os
import re
import math
import sys
import random

In [2]:
y = y_est = None

In [18]:
for target in ['Dog_1', 'Dog_2', 'Dog_3', 'Dog_4', 'Dog_5', 'Patient_1', 'Patient_2']:
    with open('/tmp/%s_predict.spkl'%target,'rb') as fp:
        y_target, y_est_target = pickle.load(fp)
    if y is None:
        y = y_target
        y_est = y_est_target
    else:
        y = np.hstack((y, y_target))
        y_est = np.hstack((y_est, y_est_target))

In [19]:
from sklearn.metrics import roc_auc_score
roc_auc_score(y, y_est)


Out[19]:
0.83617716127688813

In [20]:
fpout = open('../submissions/140926-predict.8.csv','w')
print >>fpout,'clip,preictal'

In [21]:
for target in ['Dog_1', 'Dog_2', 'Dog_3', 'Dog_4', 'Dog_5', 'Patient_1', 'Patient_2']:
    with open('/tmp/%s_test.spkl'%target,'rb') as fp:
        y_proba = pickle.load(fp)
    # write results
    for i,p in enumerate(y_proba):
        print >>fpout,'%s_test_segment_%04d.mat,%.15f' % (target, i+1, p)

In [22]:
fpout.close()

In [22]: