fx notes

Search

Search IconIcon to open search

RMSE

Last updated Oct 17, 2024 Edit Source

Root Mean Squared Error (RMSE) is a widely used metric in statistics and machine learning to evaluate the accuracy of a model’s predictions. It measures the average magnitude of the errors between predicted values and actual values, giving more weight to larger errors due to the squaring of differences.

# How to Calculate RMSE

  1. Calculate the Errors: For each predicted value $(\hat{y}_i​)$and actual value $({y}_i​)$, compute the difference (error):

    $ei=\hat{y}_i - y_i​$

  2. Square the Errors: Square each error to remove negative signs and give more weight to larger errors:

    $e_i^2$

  3. Calculate the Mean of Squared Errors: Find the average of these squared errors:

    $\text{MSE} = \frac{1}{n} \sum_{i=1}^{n} e_i^2$

  4. Take the Square Root: Finally, take the square root of the mean squared error:

    $\text{RMSE} = \sqrt{\text{MSE}} = \sqrt{\frac{1}{n} \sum_{i=1}^{n} e_i^2}$

# Now in VEX

// point wrangle

1
2
3
4
5
6
7
float input;
float output;

@e = output - input;
@se = pow(@e, 2);

// @e is the local error

Promote the attribute to detail using average mode and rename it to @mse

// detail wrangle

1
@rmse = sqrt(@mse);

# What RMSE Tells Us

In short, RMSE is a handy way to summarize how accurate our predictions are, especially in regression tasks!

Here’s a list of other ways to measure error: Measuring Error


sources / further reading:


Interactive Graph