Aryan S.
BOT
Today at 10:42 AM
Bayesian inference is a method of statistical inference in which Bayes' theorem is used to update the probability for a hypothesis as more evidence or information becomes available.
Equation
P(A|B) = [P(B|A) ยท P(A)] / P(B)
Aryan S.
BOT
Today at 10:45 AM
Here is the Python simulation code for the coin flip experiment:
python
Copy
import numpy as np
# 1. Define Prior
prior = np.ones(100) / 100
p_grid = np.linspace(0, 1, 100)
def update(prior, heads, total):
likelihood = p_grid**heads * (1 - p_grid)**(total - heads)
posterior = likelihood * prior
return posterior / posterior.sum()