MAE vs MSE
Picking the Right Loss Function Changes Everything in Linear Regression
MAE vs MSE
Picking the Right Loss Function Changes Everything in Linear Regression

A practical breakdown of L1 and L2 loss — what they measure, how they behave, and which one your model actually needs.
Most people learning linear regression focus on the algorithm. But one of the most important decisions you’ll make is something that comes before training even starts — how you measure error.
Loss tells your model what “wrong” looks like. Choose the wrong loss function and your model will optimize for the wrong thing — no matter how good your data is.
Let’s break down the two most common loss functions and when to use each.
WHAT IS LOSS?
Loss is simply a number that measures how far a model’s predictions are from the actual values. The goal of training is to minimize this number as much as possible. Crucially, loss focuses on the distance between predicted and actual values — not the direction. So we always remove the sign when calculating it.
L1 Loss: Mean Absolute Error(MAE)
Takes the absolute difference between the predicted and actual value for each data point, then averages them. Every error is penalized equally — a big mistake counts proportionally, not exponentially.
MAE = (1/n) × Σ |actual − predicted|
- Robust to Outliers
- Easy to Interpret
- Not smooth at zero
- Slower OPtimization
L2 Loss: Mean Squared Error(MSE)
Squares the difference between predicted and actual values before averaging. This means large errors are penalized much more heavily than small ones — outliers have an outsized impact on the model.
MSE = (1/n) × Σ (actual − predicted)²
- Smooth Gradient
- Penalizes Large Errors
- Senstive to Outliers
- Units are Squared
MAE VS MSE

HOW TO CHOOSE :

Pro tip: If you use MSE but want your error back in the same units as your label, use RMSE (Root Mean Squared Error) — just take the square root of MSE. It’s the most common metric used in reporting because it’s interpretable and penalizes large errors.
At the end of the day, there’s no universally “better” loss function. The right choice depends on your data, your outliers, and — critically — what kind of errors are most costly for your business problem.
In a fraud detection model, missing a fraud case (large error) should be penalized heavily → MSE. In a demand forecasting model where outlier spikes are seasonal noise → MAE keeps your model grounded.
Loss function selection isn’t a footnote. It’s a design decision.
Are you team MAE or MSE? Or do you reach for something else — Huber loss perhaps? 👇 Drop it in the comments.
메타데이터
- post_id
- 9084d2e57fc4
- slug
- mae-vs-mse-9084d2e57fc4
- url
- https://medium.com/@imsami13062004/mae-vs-mse-9084d2e57fc4
- canonical_url
- https://medium.com/@imsami13062004/mae-vs-mse-9084d2e57fc4
- author_url
- https://medium.com/@imsami13062004
- status
- ok
- fetched_at
- 2026-06-12 10:20:10