logs_categorical | R Documentation |
Log score for categorical (nominal or ordinal) outcomes
The Log Score is the negative logarithm of the probability assigned to the observed value. It is a proper scoring rule. Small values are better (best is zero, worst is infinity).
logs_categorical(observed, predicted, predicted_label)
observed |
Factor of length n with N levels holding the observed values. |
predicted |
nxN matrix of predictive probabilities, n (number of rows) being the number of observations and N (number of columns) the number of possible outcomes. |
predicted_label |
Factor of length N, denoting the outcome
that the probabilities in |
A numeric vector of size n with log scores
Overview of required input format for nominal forecasts
Other log score functions:
logs_sample()
,
scoring-functions-binary
factor_levels <- c("one", "two", "three")
predicted_label <- factor(c("one", "two", "three"), levels = factor_levels)
observed <- factor(c("one", "three", "two"), levels = factor_levels)
predicted <- matrix(
c(0.8, 0.1, 0.1,
0.1, 0.2, 0.7,
0.4, 0.4, 0.2),
nrow = 3,
byrow = TRUE
)
logs_categorical(observed, predicted, predicted_label)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.