In [2]:
%load_ext autoreload
%autoreload 2
import sys, os
sys.path.append('../..')
%matplotlib inline
import matplotlib.pylab as plt
from misc.config import c
from data_api import *
import cPickle
import pandas as pd
from data_api import *
results_dir = c['RESULTS_DIR']
In [3]:
all_results = {}
datasets = ['fourclass']
models = ['test_random']
paths = [ os.path.join(results_dir, model + '_' + dataset) for model in models for dataset in datasets ]
In [4]:
csv_results = {}
csv_dir = os.path.join(results_dir, 'csv')
for csv_file in os.listdir(csv_dir):
print csv_file
csv_results[csv_file] = pd.DataFrame.from_csv(os.path.join(csv_dir, csv_file))
In [18]:
f = csv_results['random_r2svm_segment']
In [74]:
len(V == 0.6438567)
Out[74]:
In [75]:
C[0:21]
Out[75]:
In [68]:
f.iloc[1*21+3]
Out[68]:
In [20]:
a = f[f['mean_acc'] == max(f['mean_acc'])]
In [24]:
a
Out[24]:
In [76]:
C = f['C'].values
In [77]:
V = f['mean_acc'].values
In [78]:
G = f['gamma'].values
In [79]:
g = set(G)
In [80]:
c = set(C)
In [81]:
len(g)
Out[81]:
In [82]:
len(c)
Out[82]:
In [38]:
C[0], C[20]
Out[38]:
In [49]:
V[4*21 + 1]
Out[49]:
In [45]:
set(C)
Out[45]:
In [48]:
set(G)
Out[48]:
In [83]:
plt.figure(figsize=(8, 6))
plt.imshow(V.reshape(14,21), interpolation='nearest', cmap=plt.cm.spectral)
plt.colorbar()
plt.show()
In [ ]:
f.loc[']
In [4]:
best_std = {model: {} for model in models}
for model in models:
for data in datasets:
if model + '_' + data in results_pd.keys():
df = results_pd[model + '_' + data]
scores = df.loc[df['mean_acc'].idxmax(),'acc_fold']
best_std[model][data] = np.mean([np.std(fold_scores) for fold_scores in scores]) * 100
In [5]:
print "Best std"
pd.DataFrame.from_dict(best_std)
Out[5]: