In [1]:
import matplotlib.pyplot as plt
%matplotlib nbagg
import pandas as pd
from glob import glob
import numpy as np
import seaborn as sns
import os
sns.set_style('whitegrid')
In [2]:
def load_results(path):
files = sorted(glob(os.path.join(path, 'fold*_test.csv')))
results = pd.concat([pd.read_csv(fn, index_col=0) for fn in files])
results = results[['root', 'thirds', 'triads', 'sevenths', 'tetrads', 'majmin', 'mirex']]
return results
weighted = load_results('/home/bmcfee/working/chords/model_weighted/')
aug_weighted = load_results('/home/bmcfee/working/chords/model_aug_weighted/')
struct_weighted = load_results('/home/bmcfee/working/chords/model_struct_weighted/')
struct_aug_weighted = load_results('/home/bmcfee/working/chords/model_struct_aug_weighted/')
struct_aug_weighted_static = load_results('/home/bmcfee/working/chords/model_struct_aug_weighted_static/')
In [3]:
chordino = load_results('/home/bmcfee/git/chord_models/data/chordino/')
In [4]:
dnn = load_results('/home/bmcfee/git/chord_models/data/ejh2015_dnn/')
In [5]:
khmm = load_results('/home/bmcfee/git/chord_models/data/ejh2015_khmm/')
In [6]:
plain = load_results('/home/bmcfee/working/chords/model/')
In [7]:
aug = load_results('/home/bmcfee/working/chords/model_aug/')
In [8]:
struct = load_results('/home/bmcfee/working/chords/model_struct/')
In [9]:
struct_aug = load_results('/home/bmcfee/working/chords/model_struct_aug/')
In [10]:
deep = load_results('/home/bmcfee/working/chords/model_deep/')
In [11]:
deep_aug = load_results('/home/bmcfee/working/chords/model_deep_aug/')
In [12]:
deep_struct = load_results('/home/bmcfee/working/chords/model_deep_struct/')
In [13]:
deep_struct_aug = load_results('/home/bmcfee/working/chords/model_deep_struct_aug/')
In [14]:
results = pd.Panel({'Chordino': chordino,
'DNN': dnn,
'KHMM': khmm,
'CR1': plain,
'CR1+A': aug,
'CR1+S': struct,
'CR1+S+A': struct_aug,
'CR2': deep,
'CR2+A': deep_aug,
'CR2+S': deep_struct,
'CR2+S+A': deep_struct_aug,
})
In [15]:
results = results[['CR2+S+A', 'CR2+S', 'CR2+A', 'CR2',
'CR1+S+A', 'CR1+S', 'CR1+A', 'CR1',
'KHMM', 'DNN']]#, 'Chordino']]
In [67]:
plt.close('all')
In [68]:
SAVE = True
In [69]:
P = sns.pointplot
plt.figure(figsize=(8, 5))
for i, tab in enumerate(results.minor_axis, 1):
ax = plt.subplot(2,4,i)
P(data=results[:,:,tab], orient='h', join=False, palette='Paired', capsize=0.5, estimator=np.median)
plt.axhline(7.5, alpha=0.1, zorder=-1, color='k')
plt.axhline(3.5, alpha=0.1, zorder=-1, color='k')
plt.title(tab)
if i % 4 != 1:
plt.yticks([])
else:
labs = ax.yaxis.get_ticklabels()
ax.yaxis.set_ticklabels(labs, ha='left')
ax.yaxis.set_tick_params(pad=50)
plt.tight_layout()
if SAVE:
plt.savefig('/home/bmcfee/git/chord_models/paper/figs/crnn-scores.pdf', transparent=True, pad_inches=0)
!convert /home/bmcfee/git/chord_models/paper/figs/crnn-scores.pdf /home/bmcfee/git/chord_models/paper/figs/crnn-scores.eps
In [76]:
results.minor_xs('mirex').describe()
Out[76]:
In [16]:
khmm.describe().loc['50%']
Out[16]:
In [17]:
dnn.describe().loc['50%']
Out[17]:
In [18]:
deep_struct_aug.describe().loc['50%']
Out[18]:
In [19]:
deep_aug.describe().loc['50%']
Out[19]:
In [20]:
struct_aug.describe().loc['50%']
Out[20]:
In [21]:
aug.describe().loc['50%']
Out[21]:
In [52]:
deep_struct_aug.describe() - khmm.describe()
Out[52]:
In [53]:
deep_struct_aug.describe() - deep_aug.describe()
Out[53]:
In [37]:
deep.describe()
Out[37]:
In [38]:
deep_aug.describe()
Out[38]:
In [39]:
deep_struct.describe()
Out[39]:
In [40]:
deep_struct_aug.describe()
Out[40]:
In [993]:
plt.close('all')
In [81]:
(deep_struct_aug - deep_aug).hist()
Out[81]:
In [82]:
# KHMM has biggest gain over CR2SA
(deep_struct_aug['tetrads'] - deep_aug['tetrads']).argmax()
Out[82]:
In [83]:
(deep_struct_aug['tetrads'] - struct_aug['tetrads']).argmax()
Out[83]:
In [85]:
(deep_struct_aug - deep_aug).describe()
Out[85]:
In [84]:
(deep_struct_aug - struct_aug).describe()
Out[84]: