explainedvariance

Computes Explained Variance Regression Score from the actual and predicted outputs. It represents the amount of variance explained by the model with respect to variance of the actual output, where the best value is 1 and the worst is 0.

Syntax

Score = explainedvariance(targets,predictions)

Inputs

targets
Actual label for each observation.
Type: double
Dimension: vector
predictions
Predicted value for each observation.
Type: double
Dimension: vector

Outputs

Score
Explained variance of the regression model.
Type: double
Dimension: scalar

Example

Usage of explainedvariance

targets = [3, -0.5, 2, 7];
predictions = [2.5, 0.0, 2, 8];
score = explainedvariance(targets, predictions);
> score
score = 0.957173448