AIExplainer
Machine Learning Intermediate 2 min read

What is squared loss?

A measure of the difference between predicted and actual values, used to train machine learning models

Squared loss is a way to calculate the error between what a model predicts and what actually happens. It does this by taking the difference between the two values, squaring it, and then using this result to adjust the model's parameters to make better predictions in the future.

Imagine you're trying to hit a target with a bow and arrow. The squared loss is like measuring how far off your arrow is from the center of the target, but instead of just measuring the distance, you're measuring the area of a square with that distance as its side. This means that if you're really far off, the 'penalty' is much bigger than if you're just a little bit off.

A company might use squared loss to train a model that predicts house prices based on features like the number of bedrooms and square footage. The model would try to minimize the squared loss between its predictions and the actual prices of houses it's trained on.

Squared loss is used as a loss function in machine learning to train models, especially in regression problems where the goal is to predict a continuous value.

One common misconception is that squared loss is the only way to measure error in machine learning. However, there are other loss functions like mean absolute error or cross-entropy loss that are used depending on the problem type.

The concept of squared loss has its roots in ordinary least squares, a method used in statistics for linear regression that dates back to the early 19th century.

mean squared error MSE L2 loss

Three products for different needs — explore what’s relevant to you.