Model Selection: AIC vs BIC (2D)

Statistical learning isn't just about fitting a curve — it's about choosing which curve to trust. This lab generates noisy samples from a hidden polynomial, fits real least-squares polynomials of degree 1 through 10 to them, and computes the Akaike and Bayesian information criteria for every candidate. A three-panel 2D view shows the inspected fit overlaying the actual data and the true curve on top, training RSS falling monotonically with degree in the middle, and a bar chart of AIC (orange) and BIC (green) across all ten degrees at the bottom, each marked at its own minimum. Push the noise up, shrink the sample, or change the true underlying complexity, and watch how the two criteria disagree on how much model complexity is actually justified by the data.