Skip to content

Commit

Permalink
#896 Update documentation of log score (#918)
Browse files Browse the repository at this point in the history
* use neg_log_score

* update docs, revert previous change

* update docs
  • Loading branch information
nikosbosse authored Sep 24, 2024
1 parent 4335407 commit 851c4cc
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 10 deletions.
1 change: 1 addition & 0 deletions R/metrics-binary.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ brier_score <- function(observed, predicted) {
#' @importFrom methods hasArg
#' @export
#' @keywords metric
#' @family log score functions
#' @rdname scoring-functions-binary
logs_binary <- function(observed, predicted) {
assert_input_binary(observed, predicted)
Expand Down
1 change: 1 addition & 0 deletions R/metrics-nominal.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#' @export
#' @keywords metric
#' @rdname scoring-functions-nominal
#' @family log score functions
#' @examples
#' factor_levels <- c("one", "two", "three")
#' predicted_label <- factor(c("one", "two", "three"), levels = factor_levels)
Expand Down
14 changes: 9 additions & 5 deletions R/metrics-sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,23 @@ se_mean_sample <- function(observed, predicted) {
#' [`logs_sample()`][scoringRules::scores_sample_univ] function from the
#' \pkg{scoringRules} package.
#'
#' The log score is the negative logarithm of the predictive density evaluated
#' at the observed value.
#'
#' The function should be used to score continuous predictions only.
#' While the Log Score is in theory also applicable
#' to discrete forecasts, the problem lies in the implementation: The Log score
#' needs a kernel density estimation, which is not well defined with
#' integer-valued Monte Carlo Samples. The Log score can be used for specific
#' discrete probability distributions. See the scoringRules package for
#' more details.
#' to discrete forecasts, the problem lies in the implementation: The function
#' uses a kernel density estimation, which is not well defined with
#' integer-valued Monte Carlo Samples.
#' See the scoringRules package for more details and alternatives, e.g.
#' calculating scores for specific discrete probability distributions.
#' @inheritParams ae_median_sample
#' @param ... Additional arguments passed to
#' [logs_sample()][scoringRules::logs_sample()] from the scoringRules package.
#' @inheritSection illustration-input-metric-sample Input format
#' @return Vector with scores.
#' @importFrom scoringRules logs_sample
#' @family log score functions
#' @examples
#' observed <- rpois(30, lambda = 1:30)
#' predicted <- replicate(200, rpois(n = 30, lambda = 1:30))
Expand Down
19 changes: 14 additions & 5 deletions man/logs_sample.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/scoring-functions-binary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions man/scoring-functions-nominal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 851c4cc

Please sign in to comment.