<jupyter_start><jupyter_text>Coin test!<jupyter_code>from matplotlib import pyplot as plt
# simulate fair coin!
simulated_coin_flips = np.random.rand(10000, 100) > 0.5
simulated_coin_flips.shape
number_of_heads = simulated_coin_flips.sum(axis=1)
number_of_heads.shape
number_of_heads[:10]
# what fraction of experiments gave us values at least as big as 63?
(number_of_heads >= 63).mean()
# what fraction of experiments gave us values
# at least as EXTREME as 63?
((number_of_heads >= 63) | (number_of_heads <= 37)).mean()
plt.hist(number_of_heads, bins=np.arange(100));<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11, 'fraction_numerical': 0.043333333333333335, 'mean_word_length': 7.121621621621622, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '278622', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 241, 'n_tokens_neox': 216, 'n_words': 53, 'path': 'lectures/15-probability/in-class-demo.ipynb', 'repo_name': 'alexhuth/ndap-fa2020', 'size': '600'}