Skip to content

Commit

Permalink
Set cores for CRAN checks consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed Nov 29, 2023
1 parent 5495432 commit 169bad9
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 20 deletions.
4 changes: 3 additions & 1 deletion R/avail_forecasts.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#' @export
#' @keywords check-forecasts
#' @examples
#' \dontshow{data.table::setDTthreads(2) # only needed to avoid issues on CRAN}
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#'
#' avail_forecasts(example_quantile,
#' collapse = c("quantile"),
Expand Down
4 changes: 3 additions & 1 deletion R/pairwise-comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
#' @author Johannes Bracher, \email{johannes.bracher@@kit.edu}
#' @keywords scoring
#' @examples
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#'
#' scores <- score(example_quantile)
#' pairwise <- pairwise_comparison(scores, by = "target_type")
Expand Down
4 changes: 3 additions & 1 deletion R/pit.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
#' @seealso [pit()]
#' @importFrom stats runif
#' @examples
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#'
#' ## continuous predictions
#' true_values <- rnorm(20, mean = 1:20)
Expand Down
12 changes: 9 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#' @examples
#' library(ggplot2)
#' library(magrittr) # pipe operator
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#'
#' scores <- score(example_quantile) %>%
#' summarise_scores(by = c("model", "target_type")) %>%
Expand Down Expand Up @@ -582,7 +584,9 @@ make_na <- make_NA
#' @importFrom data.table dcast
#' @export
#' @examples
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#' scores <- score(example_quantile)
#' scores <- summarise_scores(scores, by = c("model", "range"))
#' plot_interval_coverage(scores)
Expand Down Expand Up @@ -835,7 +839,9 @@ plot_pairwise_comparison <- function(comparison_result,
#' @importFrom stats density
#' @return vector with the scoring values
#' @examples
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#'
#' # PIT histogram in vector based format
#' true_values <- rnorm(30, mean = 1:30)
Expand Down
4 changes: 3 additions & 1 deletion R/score.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
#'
#' @examples
#' library(magrittr) # pipe operator
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#'
#' check_forecasts(example_quantile)
#' score(example_quantile) %>%
Expand Down
8 changes: 6 additions & 2 deletions R/summarise_scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
#' provided to `fun`. For more information see the documentation of the
#' respective function.
#' @examples
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#' library(magrittr) # pipe operator
#'
#' scores <- score(example_continuous)
Expand Down Expand Up @@ -279,7 +281,9 @@ check_summary_params <- function(scores,
#' summary is present according to the value specified in `by`.
#' @examples
#' library(magrittr) # pipe operator
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' \dontshow{
#' data.table::setDTthreads(2) # restricts number of cores used on CRAN
#' }
#' score(example_quantile) %>%
#' add_coverage(by = c("model", "target_type")) %>%
#' summarise_scores(by = c("model", "target_type")) %>%
Expand Down
4 changes: 3 additions & 1 deletion man/add_coverage.Rd

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

4 changes: 3 additions & 1 deletion man/avail_forecasts.Rd

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

4 changes: 3 additions & 1 deletion man/pairwise_comparison.Rd

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

4 changes: 3 additions & 1 deletion man/pit_sample.Rd

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

4 changes: 3 additions & 1 deletion man/plot_interval_coverage.Rd

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

4 changes: 3 additions & 1 deletion man/plot_pit.Rd

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

4 changes: 3 additions & 1 deletion man/plot_score_table.Rd

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

4 changes: 3 additions & 1 deletion man/score.Rd

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

4 changes: 3 additions & 1 deletion man/summarise_scores.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# load common required test packages
library(ggplot2, quietly = TRUE)
suppressMessages(library(magrittr))
data.table::setDTthreads(2) # only needed to avoid issues on CRAN
data.table::setDTthreads(2) # restricts number of cores used on CRAN

# compute quantile scores
scores <- suppressMessages(score(example_quantile))
2 changes: 1 addition & 1 deletion vignettes/scoringutils.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ library(magrittr)
library(data.table)
library(ggplot2)
library(knitr)
data.table::setDTthreads(2) # only needed to avoid issues on CRAN
data.table::setDTthreads(2) # restricts number of cores used on CRAN
```

The `scoringutils` package provides a collection of metrics and proper scoring rules that make it simple to score probabilistic forecasts against the true observed values. You can find more information in the paper [Evaluating Forecasts with scoringutils in R](https://arxiv.org/abs/2205.07090) as well as the [Metrics-Vignette](https://epiforecasts.io/scoringutils/articles/metric-details.html) and the [Scoring forecasts directly Vignette](https://epiforecasts.io/scoringutils/articles/scoring-forecasts-directly.html).
Expand Down

0 comments on commit 169bad9

Please sign in to comment.