View source: R/summarise_scores.R
summarise_scores | R Documentation |
score()
Summarise scores as produced by score()
.
summarise_scores
relies on a way to identify the names of the scores and
distinguish them from columns that denote the unit of a single forecast.
Internally, this is done via a stored attribute, metrics
that stores
the names of the scores. This means, however, that you need to be careful
with renaming scores after they have been produced by score()
. If you
do, you also have to manually update the attribute by calling
attr(scores, "metrics") <- new_names
.
summarise_scores(scores, by = "model", across = NULL, fun = mean, ...)
summarize_scores(scores, by = "model", across = NULL, fun = mean, ...)
scores |
An object of class |
by |
Character vector with column names to summarise scores by. Default
is |
across |
Character vector with column names to summarise scores
across (meaning that the specified columns will be dropped). This is an
alternative to specifying |
fun |
A function used for summarising scores. Default is |
... |
Additional parameters that can be passed to the summary function
provided to |
A data.table with summarised scores. Scores are summarised according
to the names of the columns of the original data specified in by
or
across
using the fun
passed to summarise_scores()
.
library(magrittr) # pipe operator
scores <- score(as_forecast(example_sample_continuous))
# get scores by model
summarise_scores(scores,by = "model")
# get scores by model and target type
summarise_scores(scores, by = c("model", "target_type"))
# Get scores summarised across horizon, forecast date, and target end date
summarise_scores(
scores, across = c("horizon", "forecast_date", "target_end_date")
)
# get standard deviation
summarise_scores(scores, by = "model", fun = sd)
# round digits
summarise_scores(scores,by = "model") %>%
summarise_scores(fun = signif, digits = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.