<jupyter_start><jupyter_text>PTG Plotting RoutinesCreate a plot like figure 2 in the paper<jupyter_code>import matplotlib
from matplotlib.pyplot import figure
from matplotlib import pyplot as plt
import numpy as np
import pickle as pkl
# File where ptg info is stored
filename = #########
# The desired credible interval widths for the experiment
widths = [5e-3, 6e-3, 7e-3, 8e-3, 9e-3, 1e-2]
widths_str = ["5e-3", "6e-3", "7e-3", "8e-3", "9e-3", "1e-2"]
# The initial perturbations used in the experiment
inital = "200"
# Load data
with open(filename, 'rb') as f:
    data = pkl.load(f)
data_np = np.array(data)
# Plots
matplotlib.rcParams.update({'font.size': 35})
figure(figsize=(13,10))
plt.rc('xtick',labelsize=35)
plt.rc('ytick',labelsize=35)
ax = plt.gca() 

# Plot boxplots 
ax.boxplot(data, labels=widths_str, notch=False, widths=[.6] * len(widths), showfliers=False)

# Setup yticks
ax.set_yticklabels(["5e-3", "7e-3", "9e-3", "1.1e-2", "1.3e-2"][::-1])
ax.set_yticks([5e-3, 7e-3,  9e-3, 1.1e-2, 1.3e-2][::-1])

# Plot along x axis
ax.plot([i+1 for i in range(len(widths))], widths ,c="#92DCE5",linewidth=5.0)
ax.scatter([i+1 for i in range(len(widths))], widths, s=75)

# Setup labels
ax.set_title("Bayes{}, 200 Initial Perturbations".format("LIME"), fontsize=35)
ax.set_ylabel("Observed W")
ax.set_xlabel("Desired W")
plt.tight_layout()
plt.savefig("ptg.pdf")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1827266238401142, 'fraction_numerical': 0.05638829407566024, 'mean_word_length': 5.431192660550459, 'pattern_counts': {'":': 0, '<': 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': '628782', 'license': 'MIT', 'n_tokens_mistral': 627, 'n_tokens_neox': 590, 'n_words': 138, 'path': 'experiments/plotting/PTG Plots.ipynb', 'repo_name': 'TeodorChiaburu/Modeling-Uncertainty-Local-Explainability', 'size': '1401'}