MetricsWeighted (version 0.3.0)

accuracy: Accuracy

Description

Calculates weighted accuracy, i.e. the weighted proportion of elements in predicted that are equal to those in actual. The higher, the better.

Usage

accuracy(actual, predicted, w = NULL, ...)

Arguments

actual

Observed values.

predicted

Predicted values.

w

Optional case weights.

...

Further arguments passed to weighted_mean.

Value

A numeric vector of length one.

See Also

classification_error.

Examples

Run this code
# NOT RUN {
accuracy(c(0, 0, 1, 1), c(0, 0, 1, 1))
accuracy(c(1, 0, 0, 1), c(0, 0, 1, 1))
accuracy(c(1, 0, 0, 1), c(0, 0, 1, 1), w = 1:4)
# }

Run the code above in your browser using DataLab