test_prophet.R (prophet-1.0) | : | test_prophet.R (prophet-1.1) | ||
---|---|---|---|---|
skipping to change at line 128 | skipping to change at line 128 | |||
test_that("logistic_floor", { | test_that("logistic_floor", { | |||
skip_if_not(Sys.getenv('R_ARCH') != '/i386') | skip_if_not(Sys.getenv('R_ARCH') != '/i386') | |||
skip_on_os('mac') # Resolves mysterious CRAN build issue | skip_on_os('mac') # Resolves mysterious CRAN build issue | |||
m <- prophet(growth = 'logistic') | m <- prophet(growth = 'logistic') | |||
history <- train | history <- train | |||
history$floor <- 10. | history$floor <- 10. | |||
history$cap <- 80. | history$cap <- 80. | |||
future1 <- future | future1 <- future | |||
future1$cap <- 80. | future1$cap <- 80. | |||
future1$floor <- 10. | future1$floor <- 10. | |||
m <- fit.prophet(m, history, algorithm = 'Newton') | m <- fit.prophet(m, history) | |||
expect_true(m$logistic.floor) | expect_true(m$logistic.floor) | |||
expect_true('floor' %in% colnames(m$history)) | expect_true('floor' %in% colnames(m$history)) | |||
expect_equal(m$history$y_scaled[1], 1., tolerance = 1e-6) | expect_equal(m$history$y_scaled[1], 1., tolerance = 1e-6) | |||
expect_equal(m$fit.kwargs, list(algorithm = 'Newton')) | ||||
fcst1 <- predict(m, future1) | fcst1 <- predict(m, future1) | |||
m2 <- prophet(growth = 'logistic') | m2 <- prophet(growth = 'logistic') | |||
history2 <- history | history2 <- history | |||
history2$y <- history2$y + 10. | history2$y <- history2$y + 10. | |||
history2$floor <- history2$floor + 10. | history2$floor <- history2$floor + 10. | |||
history2$cap <- history2$cap + 10. | history2$cap <- history2$cap + 10. | |||
future1$cap <- future1$cap + 10. | future1$cap <- future1$cap + 10. | |||
future1$floor <- future1$floor + 10. | future1$floor <- future1$floor + 10. | |||
m2 <- fit.prophet(m2, history2, algorithm = 'Newton') | m2 <- fit.prophet(m2, history2) | |||
expect_equal(m2$history$y_scaled[1], 1., tolerance = 1e-6) | expect_equal(m2$history$y_scaled[1], 1., tolerance = 1e-6) | |||
}) | }) | |||
test_that("get_changepoints", { | test_that("get_changepoints", { | |||
history <- train | history <- train | |||
m <- prophet(history, fit = FALSE) | m <- prophet(history, fit = FALSE) | |||
out <- prophet:::setup_dataframe(m, history, initialize_scales = TRUE) | out <- prophet:::setup_dataframe(m, history, initialize_scales = TRUE) | |||
history <- out$df | history <- out$df | |||
m <- out$m | m <- out$m | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added |