LOSS FUNCTION PART-1

Bhagyashree Dixit
2 min readOct 23, 2022

--

WHAT IS LOSS FUNCTION?

-The loss function guesses how your algorithm is modeling the given dataset.

-We can estimate loss value if the predicted value is lower then your loss function will output a higher number. If the predicted value is pretty good then your loss function will output a lower number.

WHY LOSS FUNCTION IS IMPORTANT?

-Loss function is very important in the statistical models.

-It represents how your model is working by giving the actual data with the predicted one.

Loss function can be classified into two different categories:

-Regression loss

-Classification loss

LOSS FUNCTION IN REGRESSION:

1. Mean squared error

2. Mean absolute error

MEAN SQUARED ERROR(MSE):

  • Mathematical formula:
fig.2: MSE

-Here y(i) is the actual output and y(i)* is the predicted output

-The mean squared error is the most common loss function. It is the difference between your model’s actual value and predicted value which is squared and divided by the total number of actual values.

-The MSE is always a positive value since we are always squaring the errors.

MEAN ABSOLUTE ERROR(MAE):

  • The mean absolute error is used to evaluate the regression model.
  • MAE is the average of the absolute differences between the predicted and actual values.
  • Mathematical formula:
fig.3: MAE

Which is best to use MAE or MSE?

-If the data is corrupted by outliers in our model then it is better to use MAE loss function to the model.But if the outliers shows the data which is important for the business then we should go for MSE loss function.

what is the difference between MAE and MSE?

fig.4: Difference between MAE and MSE

--

--