<jupyter_start><jupyter_text>Intuition and Introduction*Maximum Likelihood Estimation*, or MLE, is a technique for guessing *unknown parameters* for *models* of observed data. Specifically, the *Maximum Likelihood Estimator* for an unknown parameter is the value which maximizes the probability of the observed data. To understand how this works intuitively, consider the following example (or just skip straight to the [math](math)). Imagine you flip a penny 100 times, and it lands heads every time. You probably have some internal model of how coin flips work - for example, it's reasonable to assume that each toss is independent of the other coin tosses. However, there's a key parameter in this model you're missing: for a weighted coin, you don't know the probability $p$ that any individual toss will come up as heads. However, you've observed that the penny landed heads 100 times in a row, so you infer that $p$ is pretty close to $1$, because that makes the observed data more probable.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 100, 1).astype(float)/100
plt.plot(x, x ** 100, c = 'cornflowerblue')
plt.title('Likelihood of 100 Coins Flips Landing Heads')
plt.xlabel('Likelihood of 1 Flip Landing Heads')
plt.show()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup