<jupyter_start><jupyter_text>Hellinger Distance The Hellinger distance is used to quantify the similarity between two probability distributions. It is a bounded metric that measures the cumulative difference in density over all points in a probability space.$ H(P,Q) = \frac{1}{\sqrt{2}} \sqrt{ \sum^k_{i-1}(\sqrt{p_i}-\sqrt{q_i})^2 } $<jupyter_code># changing cwd
%cd ..<jupyter_output>c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp<jupyter_text>Load packages<jupyter_code>from src.inductive_bias import IB
ib = IB() #instantiate inductive bias package<jupyter_output><empty_output><jupyter_text>Time and Date of the experiment<jupyter_code>print(ib.date)<jupyter_output>2021-04-03 02:21:22.844601<jupyter_text>Load estimated and true posterior probabilities<jupyter_code>#convenient method to load everything
ib.load_all()<jupyter_output>[ c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp\clf\SimulationData.pickle ] loaded
[ c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp\clf\PosteriorData.pickle ] loaded
[ c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp\clf\TrainedCLF.pickle ] loaded
[ c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp\clf\EstimatedData.pickle ] loaded
[ c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp\clf\HellingerData.pickle ] loaded<jupyter_text>Compute hellinger distance between estimated and true posteriors<jupyter_code>ib.get_hellinger()<jupyter_output><empty_output><jupyter_text>Saves current hellinger distance<jupyter_code>ib.load_hellinger(save=True)<jupyter_output>saving current attributes..
completed after 0 seconds
saved as [ c:\Users\jongm\Desktop\temp_workspace\Python\JOVO\induced_bias_exp\clf\HellingerData.pickle ]<jupyter_text>Loads previously stored hellinger distance from `"clf/HellingerData.pickle"`<jupyter_code>ib.load_hellinger()
import matplotlib.pyplot as plt
from tqdm.notebook import tqdm
fig, axs = plt.subplots(5,4, figsize=(5*4, 5*5))
for j in tqdm(range(5)):
    for i in tqdm(range(4), leave=False):
        if j == 0:
            axs[j][i].set_title(ib.mtype[i])
        if i == 0:
            axs[j][i].set_ylabel(ib.dtype[j])

        axs[j][i].scatter(x=ib.mask[:,0], y=ib.mask[:,1],c=ib.hdist[0][j][i], cmap='binary')
        axs[j][i].set_xlim([-3,3])
        axs[j][i].set_ylim([-3,3])

plt.savefig(f'figs/[hellinger]_hellinger_sqbbox_{str(ib.date.date())}.png', bbox_inches='tight')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13536243492190628, 'fraction_numerical': 0.01682018422106528, 'mean_word_length': 6.347058823529411, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '548053', 'license': 'MIT', 'n_tokens_mistral': 993, 'n_tokens_neox': 947, 'n_words': 142, 'path': 'experiments/20210330_hellinger.ipynb', 'repo_name': 'jshin13/Inductive-bias-experiment', 'size': '2497'}