<jupyter_start><jupyter_text>Find model "ranking"And the AP values: overall and stratified by object size.  Baseline - max values<jupyter_code>max_pivot = df.pivot_table(index='model_config', values=['AP', 'APl', 'APm', 'APs'], aggfunc='max').sort_values('AP', ascending=False)
to_latex_topN(max_pivot, caption='The best (baseline) results for all models.', label='table:bestAP', 
    print=False,  # change here if needed
)
to_markdown_topN(max_pivot)<jupyter_output><empty_output><jupyter_text>Average values over Q = 1..100<jupyter_code>avg_pivot = df.pivot_table(index='model_config', values=['AP', 'APl', 'APm', 'APs']).sort_values('AP', ascending=False)
to_latex_topN(avg_pivot, caption='The average scores for all models over all $Q \in [1 .. 100]$.', 
    label='table:avgAP', float_format='%.3f',
    print=False,
)
to_markdown_topN(avg_pivot)<jupyter_output><empty_output><jupyter_text>Interactive search for rank perturbations, by Q cut-offCheck the order deviaton from max, by adjusting cutoff Quality for Average AP:<jupyter_code>@interact
def average_consistent_with_max(cutoff=(1, 70)):
    cut_pivot = df[df.quality >= cutoff].pivot_table(index='model_config', values=['AP']).sort_values('AP', ascending=False)
    change = max_pivot.index != cut_pivot.index
    print(f'For cutoff Q >= {cutoff}:', end=' ')
    if not change.any():
        print('Same ordering as max_pivot')
        return
    places = np.where(change)[0] + 1
    old = max_pivot.index[change].to_numpy()
    d = dict(zip(old, places))
    new = cut_pivot.index[change].to_numpy()
    new_places = cut_pivot.index[change].map(d).to_numpy()
    print('Places', places)
    print(old)
    print('become', new_places)
    print(new)
@interact
def average_consistent_with_max(quality=(1, 100)):
    cut_pivot = df[df.quality == quality].pivot_table(index='model_config', values=['AP']).sort_values('AP', ascending=False)
    change = max_pivot.index != cut_pivot.index
    print(f'For quality Q == {quality}:', end=' ')
    if not change.any():
        print('Same ordering as max_pivot')
        return
    places = np.where(change)[0] + 1
    old = max_pivot.index[change].to_numpy()
    d = dict(zip(old, places))
    new = cut_pivot.index[change].to_numpy()
    new_places = cut_pivot.index[change].map(d).to_numpy()
    print('Places', places)
    print(old)
    print('become', new_places)
    print(new)<jupyter_output><empty_output><jupyter_text>WiPBelow follows unfinished stuff.   Table of AP by Q<jupyter_code>aps = df.pivot(index='quality', columns='model_config', values='AP')
#aps = aps.reindex(columns=max_pivot.index)
aps<jupyter_output><empty_output><jupyter_text>Plotting the AP against Q<jupyter_code>aps[:15].plot();
aps[aps.index % 5 == 0]
p = aps.plot(title='AP for Q = 1..100');
p.get_figure().savefig('models_AP_001_100.pdf')
p;
p = aps[5:20].plot(title='AP for Q = 5..20');
p.get_figure().savefig('models_AP_005_020.pdf')
p;
p = aps[35:].plot(title='AP for Q = 35..100');
p.get_figure().savefig('models_AP_035_100.pdf')
p;
aps[20:35].plot();<jupyter_output><empty_output><jupyter_text>Plot AP against RMSE<jupyter_code>#aps[20:35].plot(x='');
df.columns
df.pivot(index='mean_squared_error', columns='model_config', values='AP').plot();
df.groupby('model_config').plot(x='structural_similarity', y='AP', ax=plt.gca())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1658711217183771, 'fraction_numerical': 0.019988066825775655, 'mean_word_length': 5.815040650406504, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '254589', 'license': 'MIT', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1224, 'n_words': 221, 'path': 'results/2020-10-18-tables-and-plots.ipynb', 'repo_name': 'tgandor/urban_oculus', 'size': '3352'}