View source: R/orderedprob-ranked_prob_score.R
ranked_prob_score | R Documentation |
Compute the ranked probability score (RPS) for a classification model using ordered classes.
ranked_prob_score(data, ...)
## S3 method for class 'data.frame'
ranked_prob_score(data, truth, ..., na_rm = TRUE, case_weights = NULL)
ranked_prob_score_vec(truth, estimate, na_rm = TRUE, case_weights = NULL, ...)
data |
A |
... |
A set of unquoted column names or one or more
|
truth |
The column identifier for the true class results
(that is an ordered |
na_rm |
A |
case_weights |
The optional column identifier for case weights.
This should be an unquoted column name that evaluates to a numeric column
in |
estimate |
A matrix with as many columns as factor levels of |
The ranked probability score is a Brier score for ordinal data that uses the
cumulative probability of an event (i.e. Pr[class <= i]
for i
= 1,
2, ..., C
classes). These probabilities are compared to indicators for the
truth being less than or equal to class i
.
Since the cumulative sum of a vector of probability predictions add up to one, there is an embedded redundancy in the data. For this reason, the raw mean is divided by the number of classes minus one.
Smaller values of the score are associated with better model performance.
A tibble
with columns .metric
, .estimator
,
and .estimate
and 1 row of values.
For grouped data frames, the number of rows returned will be the same as the number of groups.
For ranked_prob_score_vec()
, a single numeric
value (or NA
).
Ranked probability scores can be computed in the same way for any number of classes. Because of this, no averaging types are supported.
Max Kuhn
Wilks, D. S. (2011). Statistical Methods in the Atmospheric Sciences. Academic press. (see Chapter 7)
Janitza, S., Tutz, G., & Boulesteix, A. L. (2016). Random forest for ordinal responses: prediction and variable selection. Computational Statistics and Data Analysis, 96, 57-73. (see Section 2)
Lechner, M., & Okasa, G. (2019). Random forest estimation of the ordered choice model. arXiv preprint arXiv:1907.02436. (see Section 5)
Other class probability metrics:
average_precision()
,
brier_class()
,
classification_cost()
,
gain_capture()
,
mn_log_loss()
,
pr_auc()
,
roc_auc()
,
roc_aunp()
,
roc_aunu()
library(dplyr)
data(hpc_cv)
hpc_cv$obs <- as.ordered(hpc_cv$obs)
# You can use the col1:colN tidyselect syntax
hpc_cv %>%
filter(Resample == "Fold01") %>%
ranked_prob_score(obs, VF:L)
# Groups are respected
hpc_cv %>%
group_by(Resample) %>%
ranked_prob_score(obs, VF:L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.