**December 29, 2020**

The accuracy of every machine learning algorithm is measured using the cost function. Cost function calculates of the difference between the actual value of the target variable and its predicted value.

When you feed training data to the algorithm it predicts the value of target variable corresponding to each row, the cost function computes the difference between this value and the actual value of the target variable. This is how the learning takes place, when the difference between actual and predicted value is small the model learns that it has identified the right curve on the other hand if the difference is large then model understands the curve it identified is not suitable and starts looking for other curve.

Thus smaller the output of cost function better is the model prediction. But the of cost functions that almost eliminate the error rate for the given algorithm might result in overfitting.

Thus the choice of cost function for a given algorithm depends on the following two considerations:

- It accentuates the error value, i.e. difference between actual and predicted value.
- It is reduces the chance of overfitting.

by : Monis Khan

**Quick Summary**:

The accuracy of every machine learning algorithm is measured using the cost function. Cost function calculates of the difference between the actual value of the target variable and its predicted value. When you feed training data to the algorithm it predicts the value of target variable corresponding to each row, the cost function computes the […]