Loss in Machine Learning

Loss is a quantification of how inaccurate a specific example’s prediction is from the actual data. For example: if a model predicts an example will have a value of 4.5, and it actually has a value of 4.2, the loss would be 0.3

Squared Loss

The most popular loss function is squared loss. That is:

    \[(observation - prediction(x))^2\]

or another way:

    \[(y - y')^2\]

Mean squared error

Mean squared error (MSE) is the average squared loss per example. It can be calculated by dividing the sum of all squared losses by the number of examples. Eg:

    \[MSE = \frac{1}{N} \sum_{(x,y)\in D} (y - y')^2\]

In the above:

D: The data set
N: The number of examples in D
x: The set of features
y: The example’s label
y’: The predicted value of y. Eg: the mx + c (or b + w_1x_1) of our linear regression formula

Leave a Comment

Your email address will not be published. Required fields are marked *