Skip to content

Commit

Permalink
avoid locked binding
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Jul 18, 2023
1 parent d139a58 commit 45a369a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 3 additions & 4 deletions tests/testthat/test-mixtures.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
library("data.table")

test_that("Generating Mixtures works", {
data <- setDT(example_data)
weights <- c(0.2, 0.3, 0.4, 0.1)
mix <- mixture_from_samples(data, weights = weights)
first_sample_models <- data[
mix <- mixture_from_samples(example_data, weights = weights)
first_sample_models <- example_data[
sample_nr == 1 & date == min(date) & geography == "Tatooine"
]
first_sample_mix <- mix[
first_sample_mix <- example_data[
sample_nr == 1 & date == min(date) & geography == "Tatooine"
]
expect_equal(nrow(data), nrow(mix) * 4)
Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ library("data.table")

test_that("Generating CRPS weights works", {
splitdate <- as.Date("2020-03-28")
data <- setDT(example_data)

traindata <- data[date <= splitdate]
testdata <- data[date > splitdate]
traindata <- example_data[date <= splitdate]
testdata <- example_data[date > splitdate]

weights <- crps_weights(traindata)
expect_equal(unname(round(weights, 4)), c(0.0003, 0.9989, 0.0004, 0.0003))
Expand Down

0 comments on commit 45a369a

Please sign in to comment.