Cost Function

A Cost function is used to gauge the performance of the Machine Learning model. A Machine Learning model devoid of the Cost function is futile. Cost Function helps to analyze how well a Machine Learning model performs. A Cost function basically compares the predicted values with the actual values. Appropriate choice of the Cost function contributes to the credibility and reliability of the model.

Loss function vs. Cost function

  • A function that is defined on a single data instance is called Loss function.

Image for post

Absolute loss of Regression

  • A function that is defined on an entire data instance is called the Cost function.

Image for post

Mean Absolute Error of Regression

Cost functions of Regression

Regression tasks deal with continuous data. Cost functions available for Regression are,

  • Mean Absolute Error
  • Mean Squared Error
  • Root Mean Squared Error
  • Root Mean Squared Logarithmic Error

Mean Absolute Error

Mean Absolute Error(MAE) is the mean absolute difference between the actual values and the predicted values.

  • MAE is more robust to outliers. The insensitivity to outliers is because it does not penalize high errors caused by outliers.
  • The drawback of MAE is that it isn’t differentiable at zero and many Loss function Optimization algorithms involve differentiation to find optimal values for Parameters.

Image for post

#machine-learning #cost-function #data-science #optimization

Cost functions of Regression and its Optimization Techniques in Machine Learning
2.55 GEEK