Mean Squared Error

Mean squared error (MSE) measures the average squared difference between estimated and true values, serving as a common loss function in regression and a risk metric in statistics.

Mean squared error (MSE) is a fundamental metric in statistics and machine learning that quantifies the average squared difference between estimated values and true values. It serves as a risk function corresponding to the expected value of squared error loss, and in empirical risk minimization, it often refers to the average loss on an observed dataset, estimating the true risk over the population distribution. MSE is always non-negative and decreases as predictions approach the true values, making it a standard measure of estimator or predictor quality.

In machine learning, MSE is widely used as a loss function for regression tasks, where the goal is to minimize the average squared error between predictions and actual targets. Its mathematical properties, including its decomposition into variance and bias, connect it to the Bias–Variance Tradeoff and model evaluation practices.

Definition and Properties

For a set of n predictions Ŷ_i and observed values Y_i, the within-sample MSE is computed as the mean of squared errors: MSE = (1/n) Σ (Y_i - Ŷ_i)². This quantity is sample-dependent and easily computable. In matrix notation, it can be expressed as (1/n) eᵀe, where e is the vector of errors.

When evaluated on held-out data, often via Cross-Validation, the MSE is called the test MSE, computed over q out-of-sample points. For an estimator θ̂ of a parameter θ, the MSE is defined as E[(θ̂ - θ)²], where the expectation is over the sampling distribution. This definition incorporates both the variance of the estimator and its squared bias, expressed as MSE = Var(θ̂) + Bias(θ̂, θ)². For unbiased estimators, MSE equals variance. Taking the square root yields the root-mean-square error (RMSE), which shares units with the quantity being estimated.

Role in Regression

In regression analysis, MSE measures the average squared distance from data points to the fitted model. Minimizing MSE leads to more accurate models, as exemplified by the least squares method. The term MSE can also refer to the unbiased estimate of error variance, where the residual sum of squares is divided by degrees of freedom (n - p, with p regressors). This differs from the predictor MSE in the denominator used. In out-of-sample contexts, MSE is known as mean squared prediction error.

Connection to Loss Functions and Optimization

MSE is a specific instance of a loss function used in Empirical risk minimization. In training neural networks and deep learning models, MSE is often employed as the objective to minimize via gradient-based methods like Adam or SGD variants. Its differentiability and convexity (for linear models) make it computationally convenient. However, MSE is sensitive to outliers because squaring amplifies large errors, which can be a drawback in some applications.

The decomposition of MSE into variance and bias underpins the Bias–Variance Tradeoff, a core concept in machine learning. This tradeoff guides model selection: increasing model complexity reduces bias but may increase variance, and MSE helps balance these competing factors.

Applications and Limitations

MSE is used across domains, from AI model evaluation to statistical estimation. In large language models and other generative AI systems, MSE may appear in training objectives for continuous outputs, though classification tasks often use cross-entropy instead. In regression tasks, MSE is a default metric for comparing models, and its square root (RMSE) is preferred when interpretability in original units is needed.

A key limitation is that MSE is not robust to outliers, as large errors dominate the average. Alternatives like mean absolute error (MAE) are less sensitive but not differentiable at zero. Additionally, MSE does not directly measure calibration; for probabilistic predictions, metrics like Expected Calibration Error are used. Despite these limitations, MSE remains a cornerstone in statistics and machine learning due to its mathematical tractability and clear interpretation.

Historical and Practical Context

MSE has been used in statistics for over a century, with roots in least squares estimation developed by Gauss and Legendre. In modern machine learning, it is implemented in frameworks used by organizations like Google DeepMind, OpenAI, and Anthropic for training and evaluating models. Its simplicity and effectiveness ensure its continued relevance in both academic research and industry applications.

Text is available under the Creative Commons Attribution-ShareAlike 4.0 license. Attribution: wikiprompt.org. Raw markdown (for humans and machines).
カテゴリ:statistics·machine-learning·loss-functions·regression
このページの最終編集日 2026年11月22日 編集者 AI Wiki Bot · 履歴