def measure_fantasy_divergences():
    columns = ['name1', 'name2', 'size', 'acc1', 'acc2', 'ratiodiff', 'pearson', 'spearman', 'spear1on2', 'spear2on1', 'loss', 'loss1on2', 'loss2on1', 'kl']
    if (not os.path.isfile('../measuredivergence/fantasy_divergences.tsv')):
        with open('../measuredivergence/fantasy_divergences.tsv', mode='a', encoding='utf-8') as f:
            scribe = csv.DictWriter(f, delimiter='\t', fieldnames=columns)
            scribe.writeheader()
    goldstandards = ['iter11_size80_ratio0', 'iter12_size80_ratio0', 'iter13_size80_ratio0']
    size = 80
    modeldata = pd.read_csv('../measuredivergence/modeldata.tsv', sep='\t', index_col='name')
    for gold in goldstandards:
        for itera in [11, 12]:
            for pct in range(0, 105, 5):
                ratio = (pct / 100)
                testname = ((((('iter' + str(itera)) + '_size') + str(size)) + '_ratio') + str(pct))
                if (testname == gold):
                    continue
                else:
                    row = dict()
                    (row['pearson'], row['spearman'], row['loss'], row['kl'], row['spear1on2'], row['spear2on1'], row['loss1on2'], row['loss2on1']) = get_divergences(gold, testname, itera, size, pct)
                row['name1'] = gold
                row['name2'] = testname
                row['size'] = size
                row['acc1'] = modeldata.loc[(gold, 'accuracy')]
                row['acc2'] = modeldata.loc[(testname, 'accuracy')]
                row['ratiodiff'] = ratio
                with open('../measuredivergence/fantasy_divergences.tsv', mode='a', encoding='utf-8') as f:
                    scribe = csv.DictWriter(f, delimiter='\t', fieldnames=columns)
                    scribe.writerow(row)
def measure_fantasy_divergences():
    columns = ['name1', 'name2', 'size', 'acc1', 'acc2', 'ratiodiff', 'pearson', 'spearman', 'spear1on2', 'spear2on1', 'loss', 'loss1on2', 'loss2on1', 'kl']
    if (not os.path.isfile('../measuredivergence/fantasy_divergences.tsv')):
        with open('../measuredivergence/fantasy_divergences.tsv', mode='a', encoding='utf-8') as f:
            scribe = csv.DictWriter(f, delimiter='\t', fieldnames=columns)
            scribe.writeheader()
    goldstandards = ['iter11_size80_ratio0', 'iter12_size80_ratio0', 'iter13_size80_ratio0']
    size = 80
    modeldata = pd.read_csv('../measuredivergence/modeldata.tsv', sep='\t', index_col='name')
    for gold in goldstandards:
        for itera in [11, 12]:
            for pct in range(0, 105, 5):
                ratio = (pct / 100)
                testname = ((((('iter' + str(itera)) + '_size') + str(size)) + '_ratio') + str(pct))
                if (testname == gold):
                    continue
                else:
                    row = dict()
                    (row['pearson'], row['spearman'], row['loss'], row['kl'], row['spear1on2'], row['spear2on1'], row['loss1on2'], row['loss2on1']) = get_divergences(gold, testname, itera, size, pct)
                row['name1'] = gold
                row['name2'] = testname
                row['size'] = size
                row['acc1'] = modeldata.loc[(gold, 'accuracy')]
                row['acc2'] = modeldata.loc[(testname, 'accuracy')]
                row['ratiodiff'] = ratio
                with open('../measuredivergence/fantasy_divergences.tsv', mode='a', encoding='utf-8') as f:
                    scribe = csv.DictWriter(f, delimiter='\t', fieldnames=columns)
                    scribe.writerow(row)