Learn R Programming

measures (version 0.3)

multiclass.Brier: Multiclass Brier score

Description

Defined as: (1/n) sum_i sum_j (y_ij - p_ij)^2, where y_ij = 1 if observation i has class j (else 0), and p_ij is the predicted probability of observation i for class j. From http://docs.lib.noaa.gov/rescue/mwr/078/mwr-078-01-0001.pdf.

Usage

multiclass.Brier(probabilities, truth)

Arguments

probabilities

[numeric] matrix of predicted probabilities with columnnames of the classes

truth

vector of true values

Examples

Run this code
# NOT RUN {
n = 20
set.seed(122)
truth = as.factor(sample(c(1,2,3), n, replace = TRUE))
probabilities = matrix(runif(60), 20, 3)
probabilities = probabilities/rowSums(probabilities)
colnames(probabilities) = c(1,2,3)
multiclass.Brier(probabilities, truth)
# }

Run the code above in your browser using DataLab