Regularization is a crucial technique to prevent overfitting in machine learning models. When models become too complex, they can memorize training data rather than learning generalizable patterns.

In civil engineering applications, regularization helps create more robust models for tasks like predicting structural responses, material behavior, or system performance under varying conditions.
• Adjust polynomial degree and L1/L2 regularization sliders—L1 (Lasso) creates sparse coefficients, L2 (Ridge) smooths the curve
• Click the plot to add data points, or use "Generate New Data" and "Clear All Data" buttons
• Try high polynomial degrees with and without regularization to observe overfitting prevention

What polynomial degree causes overfitting without regularization? How does adding L1 or L2 regularization help?
High polynomial degree: Creates complex curves that may overfit without regularization
L1 regularization: Watch coefficients become exactly zero - automatic feature selection
L2 regularization: Smooths the curve and reduces oscillations
Bias-variance tradeoff: Higher regularization increases bias but reduces variance
Optimal balance: Find the sweet spot between underfitting and overfitting
y=6.4760.228x
Squared Errors
L1 Norm
L2 Norm
1
0.0
0.0
MSE=54
Mean Squared Error
MAE=6.28
Mean Absolute Error
Coefficients & Regularization Effects
Variable1x
Unregularized ai0-6.476-0.228
L1 Penalty λ1|ai0|
L2 Penalty λ2(ai0)2
Effective ai-6.476-0.228
Δ|ai|

Developed by Kevin Yu & Panagiotis Angeloudis