<jupyter_start><jupyter_text>Independence Simulations This module contains a benchmark of 20 simulations of various dependency structures to allow benchmark comparisons between included tests. It also can be used to see when to use which test if some information about the shape of the data distribution is already known. Importing simulations from `hyppo` is easy! All simulations are contained withing the `hyppo.sims` module and can be imported like all other Python packages. In this tutorial, we will show you what all of the independence simulations look like and as such import all of them.<jupyter_code>from hyppo.sims import (linear, exponential, cubic, joint_normal, step,
                      quadratic, w_shaped, spiral, uncorrelated_bernoulli, logarithmic,
                      fourth_root, sin_four_pi, sin_sixteen_pi, square, two_parabolas,
                      circle, ellipse, diamond, multiplicative_noise, multimodal_independence)<jupyter_output><empty_output><jupyter_text>These are some constants that are used in this notebook. If running these notebook, please only manipulate these constants.<jupyter_code># number of sample for noisy and not noisy simulations
NOISY = 100
NO_NOISE = 1000

# list containing simulations and plot titles
simulations = [
    (linear, "Linear"),
    (exponential, "Exponential"),
    (cubic, "Cubic"),
    (joint_normal, "Joint Normal"),
    (step, "Step"),
    (quadratic, "Quadratic"),
    (w_shaped, "W-Shaped"),
    (spiral, "Spiral"),
    (uncorrelated_bernoulli, "Uncorrelated Bernoulli"),
    (logarithmic, "Logarithmic"),
    (fourth_root, "Fourth Root"),
    (sin_four_pi, "Sine 4\u03C0"),
    (sin_sixteen_pi, "Sine 16\u03C0"),
    (square, "Square"),
    (two_parabolas, "Two Parabolas"),
    (circle, "Circle"),
    (ellipse, "Ellipse"),
    (diamond, "Diamond"),
    (multiplicative_noise, "Multiplicative"),
    (multimodal_independence, "Independence")
]<jupyter_output><empty_output><jupyter_text>The following code plots the simulation with noise where applicable in blue overlayed with the simulation with no noise in red. For specific equations for a simulation, please refer to the documentation corresponding to the desired simulation.<jupyter_code>def plot_sims():
    # set the figure size
    fig, ax = plt.subplots(nrows=4, ncols=5, figsize=(28,24))
    
    count = 0
    for i, row in enumerate(ax):
        for j, col in enumerate(row):
            count = 5*i + j
            sim, sim_title = simulations[count]
            
            # the multiplicative noise and independence simulation don't have a noise parameter
            if sim_title == "Multiplicative" or sim_title == "Independence":
                x, y = sim(NO_NOISE, 1)
                x_no_noise, y_no_noise = x, y
            else:
                x, y = sim(NOISY, 1, noise=True)
                x_no_noise, y_no_noise = sim(NO_NOISE, 1)

            col.scatter(x, y, c='b', label="noise", alpha=0.5)
            col.scatter(x_no_noise, y_no_noise, c='r', label="no noise")
            
            # make the plot look pretty
            col.set_title('{}'.format(sim_title))
            col.set_xticks([])
            col.set_yticks([])
            if count == 16:
                col.set_ylim([-1, 1])
            sns.despine(left=True, bottom=True, right=True)
                
    leg = plt.legend(bbox_to_anchor=(0.5, 0.1), bbox_transform=plt.gcf().transFigure,
                     ncol=5, loc='upper center')
    leg.get_frame().set_linewidth(0.0)
    for legobj in leg.legendHandles:
        legobj.set_linewidth(5.0)
    plt.subplots_adjust(hspace=.75)
plot_sims()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1002184598580011, 'fraction_numerical': 0.012561441835062807, 'mean_word_length': 3.0836120401337794, 'pattern_counts': {'":': 1, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '202058', 'license': 'Apache-2.0', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1091, 'n_words': 338, 'path': 'docs/tutorials/sims/indep_simulations.ipynb', 'repo_name': 'RebeccaYin7/hyppo', 'size': '3662'}