Ordinary Least Squares and Ridge Regression
Ordinary Least Squares: We illustrate how to use the ordinary least squares (OLS) model,
LinearRegression, on a single feature of the diabetes dataset. We train on a subset of the data, evaluate on a test set, and visualize the predictions.Ordinary Least Squares and Ridge Regression Variance: We then show how OLS can have high variance when the data is sparse or noisy, by fitting on a very small synthetic sample repeatedly. Ridge regression,
Ridge, reduces this variance by penalizing (shrinking) the coefficients, leading to more stable predictions.
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause


