accuracy

Measures the over all performance of the classification model in terms of fraction of predictions made by the classifier that are correct. Interpretation: Accuracy is the fraction of number of correct predictions out of all examples, where the best value is 1 and the worst is 0.

Syntax

Score = accuracy(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
Accuracy of the classifier.
Type: double
Dimension: scalar

Example

Usage of accuracy

targets = [0 1 0 1];
predictions = [1 1 1 1];
score1 = accuracy(targets, predictions);
> score1
score1 = 0.5