calculate_rae#
- cinnabar.stats.calculate_rae(y_true: ndarray, y_pred: ndarray) float[source]#
Compute relative absolute error between true and predicted values.
Note
The RAE compares the mean absolute error of the predictions with a baseline model that always predicts the mean of the true values. It is calculated as:
\[RAE = \frac{\frac{1}{N} \sum_{i=1}^N |y_i - \hat{y}_i|}{\frac{1}{N} \sum_{i=1}^N |\bar{y} - \hat{y}_i|}\]where \(y_i\) is the predicted value, \(\hat{y}_i\) is the true value, and \(\bar{y}\) is the mean of the true values.
- Parameters:
y_true (ndarray with shape (N,)) – True values
y_pred (ndarray with shape (N,)) – Predicted values
- Returns:
rae – RAE between true and predicted values
- Return type:
float