Interact with the line and data points to see how MAE, MSE, RMSE, and $R^2$ quantify model performance in real-time.
In regression, our goal is to predict a continuous value, like a price or a temperature. But how do we know if our model's predictions are any good? Evaluation metrics are the tools we use to measure a model's performance and quantify its error. This lab visualizes four of the most common regression metrics, allowing you to see how they respond to changes in data and model fit in real-time.
Each metric tells a slightly different story about your model's errors. The interactive plot above shows the true data points (green dots), the model's prediction line (orange), and the errors, or residuals (dashed red lines), which are the distances between each true point and the line.
What it is: The average of the absolute differences between the true values and the predicted values.
Formula: $ \frac{1}{n} \sum_{i=1}^{n} |y_i - \hat{y}_i| $
Interpretation: It tells you, on average, how far off your predictions are. It's easy to understand because it's in the same units as the target variable. It treats all errors equally, big or small.
What it is: The average of the squared differences between the true and predicted values.
Formula: $ \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2 $
Interpretation: By squaring the errors, MSE penalizes larger errors much more heavily than smaller ones. This makes it sensitive to outliers. Its units are squared, which can make it hard to interpret directly.
What it is: The square root of the MSE.
Formula: $ \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2} $
Interpretation: RMSE is the most popular metric. Like MSE, it punishes large errors, but by taking the square root, it returns the error metric to the original units of the target variable, making it more interpretable than MSE.
What it is: The proportion of the variance in the dependent variable that is predictable from the independent variable(s).
Formula: $ 1 - \frac{\sum (y_i - \hat{y}_i)^2}{\sum (y_i - \bar{y})^2} $
Interpretation: $R^2$ ranges from 0 to 1. A score of 1.0 means the model perfectly explains the data's variance. A score of 0.0 means the model is no better than just predicting the mean of the target variable. A negative score means the model is even worse than that!
Use the controls and the interactive plot to build a strong intuition for these metrics.
In regression, our goal is to predict a continuous value, like a price or a temperature. But how do we know if our model's predictions are any good? Evaluation metrics are the tools we use to measure a model's performance and quantify its error. This lab visualizes four of the most common regression metrics, allowing you to see how they respond to changes in data and model fit in real-time.