In [29]:
%cd ~/NetBeansProjects/ExpLosion/
from notebooks.common_imports import *
from gui.user_code import get_demsar_diagram, pairwise_significance_exp_ids
from gui.output_utils import *
sns.timeseries.algo.bootstrap = my_bootstrap
sns.categorical.bootstrap = my_bootstrap
In [23]:
d = {'expansions__noise': 0.0,
'expansions__decode_handler': 'SignifiedOnlyFeatureHandler',
'expansions__k': 3,
'expansions__vectors__rep': 0,
'expansions__vectors__unlabelled_percentage': 100.0,
'expansions__vectors__unlabelled' : 'wiki',
'expansions__allow_overlap': 0,
'labelled': 'amazon_grouped-tagged',
'expansions__vectors__algorithm': 'word2vec',
'document_features_tr': 'J+N+AN+NN',
'document_features_ev': 'AN+NN',
'expansions__vectors__unlabelled_percentage':100,
'expansions__entries_of':None,
'expansions__vectors__composer__in': ['Add', 'Mult', 'Right', 'Left']
}
def _get(d):
return [x.id for x in Experiment.objects.filter(**d).\
order_by('expansions__vectors__algorithm', 'expansions__vectors__composer')]
w2v = _get(d)
d['expansions__vectors__algorithm'] = 'glove'
glove = _get(d)
d['expansions__vectors__algorithm'] = 'count_windows'
wins = _get(d)
d['expansions__vectors__algorithm'] = 'count_dependencies'
deps = _get(d)
print('wins', wins, '\nglove', glove, '\nw2v', w2v)
horder = ['deps', 'wins', 'glove', 'word2vec']
xorder = ['Add', 'Mult', 'Left', 'Right']
with sns.color_palette("cubehelix", 4):
diff_plot_bar( [deps, wins, glove, w2v], horder,
[Experiment.objects.get(id=id).expansions.vectors.composer for id in w2v],
xlabel='', hline_at=random_vect_baseline(),
hue_order=horder, order=xorder)
plt.savefig('plot-w2v-vs-glove.pdf', format='pdf', dpi=300, bbox_inches='tight', pad_inches=0.1)
# sanity check
from itertools import chain
for id in chain.from_iterable([wins, glove, w2v]):
print('id %d, score %.2f'%(id, Results.objects.get(id=id, classifier=CLASSIFIER).accuracy_mean))
In [32]:
pairwise_significance_exp_ids(zip(wins,deps), ['expansions__vectors__composer',
'expansions__vectors__algorithm'])
Out[32]:
In [33]:
pairwise_significance_exp_ids(zip(wins,glove), ['expansions__vectors__composer',
'expansions__vectors__algorithm'])
Out[33]:
In [ ]: