<jupyter_start><jupyter_text>Setup<jupyter_code>import matplotlib as mpl

from bounded_rand_walkers.functions import Freehand, Freehand2, Gaussian
from bounded_rand_walkers.test_sampling import test_1d, test_2d

mpl.rc_file("matplotlibrc")<jupyter_output><empty_output><jupyter_text>Testing the 1D sampler<jupyter_code>fig, axes = plt.subplots(2, 1, sharex=True, figsize=(5, 4))
test_1d(
    cpp_pdf_name="gauss",
    python_pdf=Gaussian(width=0.2),
    N=int(1e5),
    seed=1,
    width=0.2,
    axes=axes,
)
fig.tight_layout()<jupyter_output><empty_output><jupyter_text>Increasing the number of samples<jupyter_code>test_1d(N=int(1e7), seed=1)<jupyter_output><empty_output><jupyter_text>Testing the 2D sampler<jupyter_code>test_2d(
    cpp_pdf_name="gauss",
    python_pdf=Gaussian(width=0.2),
    N=int(1e4),
    bins=40,
    seed=1,
    width=0.2,
)
plt.gcf().tight_layout()<jupyter_output><empty_output><jupyter_text>Increasing the number of samples<jupyter_code>test_2d(cpp_pdf_name="gauss", bins=200, N=int(1e7), seed=1, width=0.2)
plt.gcf().tight_layout()<jupyter_output><empty_output><jupyter_text>Sample from the pdf used for Figure 5<jupyter_code>extent = 1
test_2d(
    cpp_pdf_name="freehand2",
    python_pdf=Freehand2(width=2.0),
    bins=30,
    xlim=(-extent, extent),
    ylim=(-extent, extent),
    width=2.0,
    N=int(1e5),
    seed=1,
)
plt.gcf().tight_layout()<jupyter_output><empty_output><jupyter_text>Increased `N`<jupyter_code>extent = 1
test_2d(
    cpp_pdf_name="freehand2",
    xlim=(-extent, extent),
    ylim=(-extent, extent),
    width=2.0,
    N=int(1e7),
    seed=1,
)
plt.gcf().tight_layout()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14647377938517178, 'fraction_numerical': 0.037371910789632305, 'mean_word_length': 6.312775330396476, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '589472', 'license': 'MIT', 'n_tokens_mistral': 748, 'n_tokens_neox': 710, 'n_words': 89, 'path': 'examples/sampler_verification.ipynb', 'repo_name': 'akuhnregnier/bounded-rand-walkers', 'size': '1659'}