<jupyter_start><jupyter_text>Reading data<jupyter_code>data, scores, test_users = read_data('Results for MovieLen', 'ML')
all_metrics = combine_all_metrics(scores, data)
all_metrics.head()<jupyter_output><empty_output><jupyter_text>Stability<jupyter_code>plt.figure(figsize=(12, 5))
sns.boxplot(
    x='rank', y='Stability', hue='model',
    data=all_metrics.query('rank in @ display_ranks')
)<jupyter_output><empty_output><jupyter_text>HR<jupyter_code>plt.figure(figsize=(12, 5))
sns.boxplot(
    x='rank', y='HR', hue='model',
    data=all_metrics.query('rank in @ display_ranks')
)
sns.lmplot(x='HR', y='Stability', hue='model', data=all_metrics, height=10)<jupyter_output><empty_output><jupyter_text>MRR<jupyter_code>plt.figure(figsize=(12, 5))
sns.boxplot(
    x='rank', y='MRR', hue='model',
    data=all_metrics.query('rank in @ display_ranks')
)
sns.lmplot(x='MRR', y='Stability', hue='model', data=all_metrics, height=10)<jupyter_output><empty_output><jupyter_text>Coverage<jupyter_code>plt.figure(figsize=(12, 5))
sns.boxplot(
    x='rank', y='COV', hue='model',
    data=all_metrics.query('rank in @ display_ranks')
)
sns.lmplot(x='COV', y='Stability', hue='model', data=all_metrics, height=10)<jupyter_output><empty_output><jupyter_text>========  Other views  HR<jupyter_code>metric = 'HR'

plt.figure(figsize=(12, 8))
# sns.lineplot(data=mrr_data, x='rank', y='mrr', hue='model', err_style='bars', ci=95, err_kws=dict(capsize=10, capthick=2))
sns.lineplot(data=scores[metric]['long'], x='rank', y=metric, hue='model')
metric = 'HR'

plt.figure(figsize=(12, 8))
ax = sns.regplot(data=scores[metric]['wide'], x='PureSVD', y='PSI')
ax.plot([0.01, 0.14], [0.01, 0.14])
ax.set_title(metric);
metric = 'HR'

g = sns.lmplot(
    data=scores[metric]['wide'].loc[[10, 30, 50, 70]].reset_index(),
    x="PureSVD", y="PSI", hue="rank",
    height=10
)
g.ax.plot([0.02, 0.15], [0.02, 0.15], ls=':', lw=5)
g.ax.set_title(metric);
# Use more informative axis labels than are provided by default
# g.set_axis_labels("Snoot length (mm)", "Snoot depth (mm)")<jupyter_output><empty_output><jupyter_text>MRR<jupyter_code>metric = 'MRR'

plt.figure(figsize=(12, 8))
# sns.lineplot(data=mrr_data, x='rank', y='mrr', hue='model', err_style='bars', ci=95, err_kws=dict(capsize=10, capthick=2))
sns.lineplot(data=scores[metric]['long'], x='rank', y=metric, hue='model')
plt.figure(figsize=(12, 8))
ax = sns.regplot(data=scores[metric]['wide'], x='PureSVD', y='PSI')
ax.plot([0.005, 0.05], [0.005, 0.05])
ax.set_title(metric);
# Plot sepal width as a function of sepal_length across days
g = sns.lmplot(
    data=scores[metric]['wide'].loc[[10, 30, 50, 70]].reset_index(),
    x="PureSVD", y="PSI", hue="rank",
    height=10
)
g.ax.plot([0.002, 0.05], [0.002, 0.05], ls=':', lw=5)
g.ax.set_title(metric);
# Use more informative axis labels than are provided by default
# g.set_axis_labels("Snoot length (mm)", "Snoot depth (mm)")<jupyter_output><empty_output><jupyter_text>Coverage<jupyter_code>metric = 'COV'

plt.figure(figsize=(12, 8))
# sns.lineplot(data=mrr_data, x='rank', y='mrr', hue='model', err_style='bars', ci=95, err_kws=dict(capsize=10, capthick=2))
sns.lineplot(data=scores[metric]['long'], x='rank', y=metric, hue='model')
plt.figure(figsize=(12, 8))
ax = sns.regplot(data=scores[metric]['wide'], x='PureSVD', y='PSI')
# ax.plot([0.005, 0.05], [0.005, 0.05])
ax.set_title(metric);
# Plot sepal width as a function of sepal_length across days
g = sns.lmplot(
    data=scores[metric]['wide'].loc[[10, 30, 50, 70]].reset_index(),
    x="PureSVD", y="PSI", hue="rank",
    height=10
)
g.ax.plot([0.1, 0.2], [0.1, 0.2], ls=':', lw=5)
g.ax.set_title(metric);
# Use more informative axis labels than are provided by default
# g.set_axis_labels("Snoot length (mm)", "Snoot depth (mm)")<jupyter_output><empty_output><jupyter_text>Stability<jupyter_code>stab_avg = pd.concat(
    [
        data[alg]['Stability_df'].groupby(['rank', 'step'])[['Stability']].mean()
        for alg in algs
    ],
    keys = algs,
    axis=0
).rename_axis(index=['model', 'rank', 'step']).reset_index()
stab_avg.head()
fig, axes = plt.subplots(len(algs), 1, figsize=(12, len(algs)*8))
for ax, alg in zip(axes, algs):
    sns.boxplot(ax=ax, x="rank", y="Stability", hue="step", showfliers=False,
                data=data[alg]['Stability_df'].query('rank in @display_ranks'))
    ax.set_title(alg);
# sns.despine(offset=10, trim=True)
plt.figure(figsize=(16, 12))
plt.scatter(
    x=data[algs[0]]['Stability_df']['Stability'].sort_index(), # SVD
    y=data[algs[1]]['Stability_df']['Stability'].sort_index(), # PSI
    alpha=0.2
)
plt.plot([0, 1], [0, 1], c='r');<jupyter_output><empty_output><jupyter_text>UPD<jupyter_code>upd_all = np.load(f'Results for MovieLen/ML_UPD_AllUsers.npz')['arr_0']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2131694102938112, 'fraction_numerical': 0.03709106063763284, 'mean_word_length': 6.868852459016393, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, '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': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '74947', 'license': 'MIT', 'n_tokens_mistral': 2135, 'n_tokens_neox': 1968, 'n_words': 317, 'path': 'View_ML_Results.ipynb', 'repo_name': 'evfro/Stable_Recommendations', 'size': '4799'}