Statistics for Machine Learning
analyzing data, estimating patterns, and understanding uncertainty in machine learning models
Core Concepts Covered
- Descriptive vs. inferential statistics
- Hypothesis testing, confidence intervals, and significance testing
- Maximum Likelihood Estimation (MLE) and parameter estimation
1. Descriptive vs. Inferential Statistics (Bessel's Correction)
Statistics provides the mathematical framework to summarize datasets, detect hidden patterns, and draw conclusions under uncertainty. It is broadly divided into two domains:
• Descriptive Statistics: Summarizes the numerical properties of an observed sample (such as the sample mean and sample variance ).
• Why Bessel's Correction () is Crucial: When computing sample variance, we divide by rather than :
Dividing by underestimates the true population variance because the sample data points are naturally closer to their own sample mean than they are to the true, unobserved population mean . Dividing by (Bessel's Correction) mathematically corrects this bias, providing an unbiased estimator of the population variance.
• Inferential Statistics: Uses sample data to make generalized predictions, test claims, or draw conclusions about a larger, unobserved population.
2. Hypothesis Testing, p-values, and A/B Testing
In machine learning, we use hypothesis testing to determine if our model improvements are statistically genuine or merely the result of random noise.
The A/B Test Example: Suppose your baseline model (A) has an accuracy of . You develop a new model (B) and test it on a sample of users, achieving an accuracy of . Is this improvement genuine, or did you just get lucky with a favorable sample of users? We resolve this using hypothesis testing:
• Null Hypothesis (): The default assumption that there is no real difference or effect (e.g., 'Model B has the same performance as Model A; the difference is random noise').
• Alternative Hypothesis (): The claim we want to prove (e.g., 'Model B is genuinely superior to Model A').
• Significance Level (): The threshold of risk we are willing to accept (typically set to or ). It is the probability of rejecting when it is actually true (Type I error).
• The -value: The probability of observing an accuracy difference of or greater if the null hypothesis is true. If the calculated -value is below our significance level (e.g., -value ), we reject the null hypothesis in favor of the alternative, concluding that Model B is statistically superior!
• Confidence Intervals (CI): A range of values likely to contain the true population parameter with a specified confidence level (e.g., confidence interval: ).
3. Parameter Estimation & Maximum Likelihood (MLE)
Machine learning is essentially the search for optimal parameters. We find these parameters using parameter estimation frameworks, most notably Maximum Likelihood Estimation (MLE).
The goal of MLE is to find the parameter values that maximize the likelihood of observing our actual dataset . Assuming samples are independent and identically distributed (i.i.d.), the joint likelihood is the product of individual sample probabilities:
Because multiplying probabilities causes numerical underflow, we maximize the log-likelihood function instead:
The Coin-Flip Derivation: If we flip a coin times and observe heads (successes), we model this using a Bernoulli distribution with success parameter . The likelihood function is: Taking the natural log converts the exponent multiplication into addition: To find the parameter value that maximizes this log-likelihood, we take the derivative with respect to , set it to 0, and solve: This proves mathematically that our intuitive estimate—the proportion of observed heads—is the mathematically optimal parameter maximizing the likelihood of our observations!
Interactive Practice Quiz
Test your understanding with instant feedback
Why do we divide by instead of when calculating the Sample Variance ?
If a hypothesis test yields a -value of and we set our significance level , what is our conclusion?
Which of the following describes the objective of Maximum Likelihood Estimation (MLE)?
Why do we maximize the 'Log-Likelihood' instead of the raw 'Likelihood' function in MLE?
In a coin-flip experiment with a Bernoulli distribution, if you observe 12 heads in 20 trials, what is the MLE value of the success probability parameter ?
Which of the following describes the difference between Descriptive and Inferential Statistics?
In hypothesis testing, what is a 'Type I Error'?
In hypothesis testing, what does a 'Type II Error' represent?
What is the correct interpretation of a '95% Confidence Interval' for a population mean?
If we observe successes in independent Bernoulli trials, what is the log-likelihood function for the success parameter ?
Further Readings
Explore these highly recommended external references to deepen your understanding
