MSS, or Mean Squared Error, is a common metric used to evaluate the performance of a machine learning model. It quantifies the average squared difference between the predicted values and the actual values.
Formula for MSS:
The formula for calculating MSS is:
MSS = 1/n * Σ(yi - ŷi)²
Where:
- n is the number of data points.
- yi is the actual value of the ith data point.
- ŷi is the predicted value of the ith data point.
Calculating MSS:
- Calculate the difference between the actual and predicted values: For each data point, subtract the predicted value from the actual value.
- Square each difference: Square the result from step 1 for each data point.
- Sum the squared differences: Add up all the squared differences from step 2.
- Divide the sum by the number of data points: Divide the result from step 3 by the total number of data points.
Example:
Let's say we have a model that predicts house prices. The actual prices and the predicted prices for five houses are:
House | Actual Price | Predicted Price |
---|---|---|
1 | $500,000 | $480,000 |
2 | $600,000 | $620,000 |
3 | $700,000 | $680,000 |
4 | $800,000 | $790,000 |
5 | $900,000 | $870,000 |
Following the steps above:
-
Differences:
- House 1: $500,000 - $480,000 = $20,000
- House 2: $600,000 - $620,000 = -$20,000
- House 3: $700,000 - $680,000 = $20,000
- House 4: $800,000 - $790,000 = $10,000
- House 5: $900,000 - $870,000 = $30,000
-
Squared Differences:
- House 1: $20,000² = $400,000,000
- House 2: -$20,000² = $400,000,000
- House 3: $20,000² = $400,000,000
- House 4: $10,000² = $100,000,000
- House 5: $30,000² = $900,000,000
-
Sum: $400,000,000 + $400,000,000 + $400,000,000 + $100,000,000 + $900,000,000 = $2,200,000,000
-
Divide: $2,200,000,000 / 5 = $440,000,000
Therefore, the MSS for this model is $440,000,000.
Conclusion:
MSS is a valuable metric for evaluating the accuracy of machine learning models. A lower MSS indicates a better-performing model with predictions closer to the actual values.