Skip to main content

ExplainedVariance

Metric
DashAI.back.metrics.regression.ExplainedVariance

Proportion of the target variance explained by the regression model.

The Explained Variance Score quantifies how much of the variability in the dependent variable is captured by the model's predictions. It is closely related to R², but does not penalise for a systematic bias (constant offset) in the predictions — a model with a fixed offset can achieve a high Explained Variance score while having a lower R².

::

EV(y, ŷ) = 1 - Var(y - ŷ) / Var(y)

Range: (-∞, 1]. A score of 1.0 means the model explains all variance; 0.0 means it performs no better than predicting the mean; negative values indicate that the model performs worse than the mean predictor.

References

Methods

score(true_values: 'DashAIDataset', predicted_values: 'np.ndarray') -> float

Defined on ExplainedVariance

Calculate the Explained Variance between true values and predicted values.

Parameters

true_values : DashAIDataset
A DashAI dataset with true values.
predicted_values : np.ndarray
A one-dimensional array with the predicted values for each instance.

Returns

float
Explained Variance score between true values and predicted values

get_metadata(cls: 'BaseMetric') -> Dict[str, Any]

Defined on BaseMetric

Get metadata values for the current metric.

Returns

Dict[str, Any]
Dictionary with the metadata

Compatible with