<jupyter_start><jupyter_text>Bayesian machine learning   Infer coin bias<jupyter_code>import pymc
import numpy as np
data = np.array([1, 1, 1, 1, 1, 1, 1, 0, 1])
beta = pymc.Beta('beta', 1, 1)
ber = pymc.Bernoulli('ber', beta, observed = True, value = data)

mcmc = pymc.MCMC([beta, ber])
mcmc.sample(1000, 500, 1)
np.mean(mcmc.trace("beta")[:])<jupyter_output>[-----------------100%-----------------] 1000 of 1000 complete in 0.0 sec
{'fraction_non_alphanumeric': 0.2350230414746544, 'fraction_numerical': 0.07373271889400922, 'mean_word_length': 3.484536082474227, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '210112', 'license': 'MIT', 'n_tokens_mistral': 202, 'n_tokens_neox': 171, 'n_words': 46, 'path': 'session4/L1_Baysian-machine-learning.ipynb', 'repo_name': 'jordanopensource/data-science-bootcamp', 'size': '434'}