mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-17 08:40:56 +00:00
Add unit tests for disabling uncertainty estimation in R
This commit is contained in:
parent
6e51130f28
commit
8d0f23f8be
2 changed files with 22 additions and 0 deletions
|
|
@ -90,6 +90,18 @@ test_that("cross_validation_default_value_check", {
|
||||||
expect_equal(sum(dplyr::select(df.cv1 - df.cv2, y, yhat)), 0)
|
expect_equal(sum(dplyr::select(df.cv1 - df.cv2, y, yhat)), 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test_that("cross_validation_uncertainty_disabled", {
|
||||||
|
skip_if_not(Sys.getenv('R_ARCH') != '/i386')
|
||||||
|
for (uncertainty in c(0, FALSE)) {
|
||||||
|
m <- prophet(uncertainty.samples = uncertainty)
|
||||||
|
m <- fit.prophet(m = m, df = DATA, algorithm = "Newton")
|
||||||
|
df.cv <- cross_validation(
|
||||||
|
m, horizon = 4, units = "days", period = 4, initial = 115)
|
||||||
|
expected.cols <- c('y', 'ds', 'yhat', 'cutoff')
|
||||||
|
expect_equal(expected.cols, colnames(df.cv))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
test_that("performance_metrics", {
|
test_that("performance_metrics", {
|
||||||
skip_if_not(Sys.getenv('R_ARCH') != '/i386')
|
skip_if_not(Sys.getenv('R_ARCH') != '/i386')
|
||||||
m <- prophet(DATA)
|
m <- prophet(DATA)
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,16 @@ test_that("fit_predict_constant_history", {
|
||||||
expect_equal(tail(fcst$yhat, 1), 0)
|
expect_equal(tail(fcst$yhat, 1), 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test_that("fit_predict_uncertainty_disabled", {
|
||||||
|
skip_if_not(Sys.getenv('R_ARCH') != '/i386')
|
||||||
|
for (uncertainty in c(0, FALSE)) {
|
||||||
|
m <- prophet(train, uncertainty.samples = uncertainty)
|
||||||
|
fcst <- predict(m, future)
|
||||||
|
expected.cols <- c('ds', 'trend', 'additive_terms', 'weekly', 'multiplicative_terms', 'yhat')
|
||||||
|
expect_equal(expected.cols, colnames(fcst))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
test_that("setup_dataframe", {
|
test_that("setup_dataframe", {
|
||||||
history <- train
|
history <- train
|
||||||
m <- prophet(history, fit = FALSE)
|
m <- prophet(history, fit = FALSE)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue