Squared error
Squared error is a measure of discrepancy equal to the square of the difference between a predicted or fitted value and its corresponding observed or target value.
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
Squared error is a loss measure computed as the squared difference between a predicted and observed numeric value.
- How it is used
- Guides regression fitting by defining the residual-sum-of-squares objective for linear models and a gradient signal for boosting.
- How deep it goes
- Connects the objective to linear-regression coefficients and boosting gradients, without deriving the squared-loss formula.
- Examples
- Uses a scikit-learn linear-regression pipeline with RMSE scoring and a from-scratch gradient-boosting regression loop.
- What you can do after
- Apply it via scikit-learn and XGBoost by selecting regression objectives and interpreting squared-error-based training workflows.
Read how Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI explains squared error →
Statistics Every Programmer Needs
The sum of squared residuals is the sum of the squared differences between observed response values and their fitted values.
- How it is used
- Uses squared residuals to fit linear regression and evaluate how closely predictions match observed responses.
- How deep it goes
- Derives SSE through residuals and SST–SSR decomposition, but stops short of discussing optimization algorithms or loss-function variants.
- Examples
- Uses marathon stage1 and stage2 times, fitted values, a sum-of-squares table, and NumPy calculations.
- What you can do after
- Evaluate regression fit by calculating SSE directly from residuals and validating it against SST minus SSR.
Read how Statistics Every Programmer Needs explains squared error →
Grokking Machine Learning
A regression error metric equal to the sum of squared differences between observed and predicted target values.
- How it is used
- Measures how well a linear regression model’s line fits the observed data points.
- How deep it goes
- Defines the metric as a sum of squared vertical distances and compares good and poor fits visually.
- Examples
- Compares squared distances from data points to good- and poor-fitting regression lines.
- What you can do after
- Evaluate a linear regression fit by interpreting the sum of squared distances from points to its line.
Timeless Algorithms, The Foundational Ideas
Squared-error loss measures prediction error by squaring the difference between a predicted and observed value.
- How it is used
- Uses squared discrepancies to fit regression models and quantify prediction loss during neural-network training.
- How deep it goes
- Explains residual weighting and Gaussian-likelihood equivalence, then connects loss to neural-network training without detailing its derivatives.
- Examples
- Works through a study-hours and exam-score regression, including a predicted score and residual.
- What you can do after
- Understand how squared errors define regression fitting and provide a training signal for neural-network updates.
Read how Timeless Algorithms, The Foundational Ideas explains squared error →
Deep Learning with R, Third Edition
Squared error is a discrepancy measure equal to the square of the difference between a prediction and its target.
- How it is used
- Trains a linear classifier by providing a differentiable discrepancy between predictions and binary targets.
- How deep it goes
- Defines the formula and implements averaging, then applies gradient updates without deriving the gradients mathematically.
- Examples
- Uses two synthetic two-dimensional point classes, R/TensorFlow code, loss logs, and a plotted decision boundary.
- What you can do after
- Apply via TensorFlow and R by defining squared loss and minimizing it with gradient-based parameter updates.
Read how Deep Learning with R, Third Edition explains squared error →
Also covered in
- Causal Inference for Data Science
- Ensemble Methods for Machine Learning
- Cyber Threat Hunting
- Grokking Machine Learning, Second EditionIn early access (MEAP)
- Geometry for Programmers
- Demand Forecasting Best Practices
What to know first
- linear regressionLinear regression is a statistical method that models a numeric response as a linear function of one or more predictor variables with fitted parameters.
- independent variableAn independent variable is an input or explanatory variable used to model, explain, or predict variation in an outcome, without necessarily causing it.
- neural networkA neural network is a computational model composed of interconnected, parameterized units or transformations that learn to map inputs to outputs.
- gradient boostingGradient boosting is an ensemble-learning technique that sequentially adds predictive models fitted to reduce a loss by following its gradient.
Related concepts
- elbow methodused by · The elbow method is a heuristic for selecting model complexity or a parameter value by locating where increasing it yields diminishing improvement in an evaluation criterion.
- ordinary least squaresaddressed by · Ordinary least squares is a method for estimating model parameters by minimizing the sum of squared differences between observed values and model predictions.
- absolute errorcontrasts with · Absolute error is an error measure based on the nonnegative absolute difference between an observed value and its prediction, optionally aggregated across observations.
- meanaddressed by · The mean is a measure of central location equal to the arithmetic average of numerical observations, or the probability-weighted average of a random variable’s possible values.
- mean squared errorequivalent to · Mean squared error is the arithmetic mean of the squared differences between corresponding predicted and reference numerical values.
Questions about squared error
What is squared error?
Squared error is a measure of discrepancy equal to the square of the difference between a predicted or fitted value and its corresponding observed or target value.
Which Manning books explain squared error?
Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI, Statistics Every Programmer Needs, Grokking Machine Learning, Timeless Algorithms, The Foundational Ideas and Deep Learning with R, Third Edition.
What should I know before learning squared error?
Manning books that teach squared error usually introduce linear regression, independent variable, neural network and gradient boosting first.
What is the difference between squared error and absolute error?
Squared error is a measure of discrepancy equal to the square of the difference between a predicted or fitted value and its corresponding observed or target value. Absolute error is an error measure based on the nonnegative absolute difference between an observed value and its prediction, optionally aggregated across observations.
What is squared error also called?
Squared error is also called residual sum of squares or sum of squared residuals.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




