Markov Chains, Python.
scale=0.5) # Calculate likelihoods likelihood_current = likelihood(mu_current, observed_data) likelihood_proposal = likelihood(mu_proposal, observed_data) # Acceptance probability p_accept = min(1, likelihood_proposal / likelihood_current) # Accept proposal? accept = np.random.rand() < p_accept if