<jupyter_start><jupyter_text>Figures<jupyter_code>import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd

%matplotlib inline
res_df = pd.read_csv("../results/20200322_correct_nodes.csv")
res_df = res_df[res_df.delta != 0]
res_df.head()
res_df.shape
p = 0.5
spacing = 50

xticklabels = np.linspace(0, 1 - p, spacing + 1)[::10]
xticklabels[0] += 0.01
yticklabels = np.linspace(0, 250, spacing + 1)[::10] * 2
yticklabels[0] += 10

# Make figure with correct subplots
sns.set_context("talk", font_scale=1)
fig, ax = plt.subplots(
    1,
    3,
    gridspec_kw={"width_ratios": [1, 1, 0.05]},
    figsize=(13, 6),
    # sharex=True,
    # sharey=True,
    constrained_layout=True,
)

for i, metric in enumerate(["prec", "recall"]):
    sns.heatmap(
        np.flipud(res_df[metric].values.reshape(spacing, -1)),
        ax=ax[i],
        square=True,
        center=0,
        cmap="RdBu_r",
        cbar_kws=dict(shrink=0.7),
        xticklabels=["{:.2f}".format(x) for x in xticklabels],
        yticklabels=["{:.0f}".format(y) for y in yticklabels],
        cbar_ax=ax[-1],
        vmin=0,
        vmax=1,
    )
    ax[i].set_xticks(np.arange(0, ax[0].get_xlim()[1] + 1, 10))
    ax[i].set_yticks(np.arange(0, ax[0].get_ylim()[0] + 1, 10)[::-1])

ax[0].set_title("Precision")
ax[1].set_title("Recall")
fig.text(0.5, 1.05, f"Using Truth Label", fontsize=25, va="center", ha="center")
fig.text(-0.025, 0.5, "Sample Size", va="center", rotation="vertical")
fig.text(0.5, -0.05, "Effect Size", va="center", ha="center")

fig.savefig(f"./exp3_truth_label.png", dpi=300, bbox_inches="tight")
fig.savefig(f"./exp3_truth_label.pdf", dpi=300, bbox_inches="tight")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18953488372093022, 'fraction_numerical': 0.05465116279069768, 'mean_word_length': 3.9884057971014495, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '90584', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 784, 'n_tokens_neox': 722, 'n_words': 129, 'path': 'experiments/experiment_3/final/exp3_truth_labels_sorted_pvals.ipynb', 'repo_name': 'neurodata/dos_and_donts', 'size': '1720'}