mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-17 08:40:56 +00:00
unaddressed warnings from unit tests (#450)
* unaddressed warnings from unit tests * devtools wants Encoding set or it complains through testthat::check()
This commit is contained in:
parent
792278f487
commit
1722e99554
2 changed files with 21 additions and 6 deletions
|
|
@ -32,3 +32,4 @@ LazyData: true
|
||||||
RoxygenNote: 6.0.1
|
RoxygenNote: 6.0.1
|
||||||
VignetteBuilder: knitr
|
VignetteBuilder: knitr
|
||||||
SystemRequirements: C++11
|
SystemRequirements: C++11
|
||||||
|
Encoding: UTF-8
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,11 @@ test_that("fit_predict_no_seasons", {
|
||||||
|
|
||||||
test_that("fit_predict_no_changepoints", {
|
test_that("fit_predict_no_changepoints", {
|
||||||
skip_if_not(Sys.getenv('R_ARCH') != '/i386')
|
skip_if_not(Sys.getenv('R_ARCH') != '/i386')
|
||||||
m <- prophet(train, n.changepoints = 0)
|
expect_warning({
|
||||||
expect_error(predict(m, future), NA)
|
# warning from prophet(), error from predict()
|
||||||
|
m <- prophet(train, n.changepoints = 0)
|
||||||
|
expect_error(predict(m, future), NA)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test_that("fit_predict_changepoint_not_in_history", {
|
test_that("fit_predict_changepoint_not_in_history", {
|
||||||
|
|
@ -36,8 +39,11 @@ test_that("fit_predict_changepoint_not_in_history", {
|
||||||
(ds < prophet:::set_date('2013-01-01')) |
|
(ds < prophet:::set_date('2013-01-01')) |
|
||||||
(ds > prophet:::set_date('2014-01-01')))
|
(ds > prophet:::set_date('2014-01-01')))
|
||||||
future <- data.frame(ds=DATA$ds)
|
future <- data.frame(ds=DATA$ds)
|
||||||
m <- prophet(train_t, changepoints=c('2013-06-06'))
|
expect_warning({
|
||||||
expect_error(predict(m, future), NA)
|
# warning from prophet(), error from predict()
|
||||||
|
m <- prophet(train_t, changepoints=c('2013-06-06'))
|
||||||
|
expect_error(predict(m, future), NA)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test_that("fit_predict_duplicates", {
|
test_that("fit_predict_duplicates", {
|
||||||
|
|
@ -291,7 +297,12 @@ test_that("holidays", {
|
||||||
lower_window = c(0, 0),
|
lower_window = c(0, 0),
|
||||||
upper_window = c(1, 1)
|
upper_window = c(1, 1)
|
||||||
)
|
)
|
||||||
|
# manual coercions to avoid below bind_rows() warning
|
||||||
|
holidays$holiday <- as.character(holidays$holiday)
|
||||||
|
holidays2$holiday <- as.character(holidays2$holiday)
|
||||||
holidays2 <- dplyr::bind_rows(holidays, holidays2)
|
holidays2 <- dplyr::bind_rows(holidays, holidays2)
|
||||||
|
# manual factorizing to avoid above bind_rows() warning
|
||||||
|
holidays2$holiday <- factor(holidays2$holiday)
|
||||||
m <- prophet(holidays = holidays2, fit = FALSE, holidays.prior.scale = 4)
|
m <- prophet(holidays = holidays2, fit = FALSE, holidays.prior.scale = 4)
|
||||||
out <- prophet:::make_holiday_features(m, df$ds)
|
out <- prophet:::make_holiday_features(m, df$ds)
|
||||||
priors <- out$prior.scales
|
priors <- out$prior.scales
|
||||||
|
|
@ -351,8 +362,11 @@ test_that("auto_weekly_seasonality", {
|
||||||
train.w <- DATA[1:N.w, ]
|
train.w <- DATA[1:N.w, ]
|
||||||
m <- prophet(train.w)
|
m <- prophet(train.w)
|
||||||
expect_false('weekly' %in% names(m$seasonalities))
|
expect_false('weekly' %in% names(m$seasonalities))
|
||||||
m <- prophet(train.w, weekly.seasonality = TRUE)
|
expect_warning({
|
||||||
expect_true('weekly' %in% names(m$seasonalities))
|
# prophet warning: non-zero return code in optimizing
|
||||||
|
m <- prophet(train.w, weekly.seasonality = TRUE)
|
||||||
|
expect_true('weekly' %in% names(m$seasonalities))
|
||||||
|
})
|
||||||
# Should be False due to weekly spacing
|
# Should be False due to weekly spacing
|
||||||
train.w <- DATA[seq(1, nrow(DATA), 7), ]
|
train.w <- DATA[seq(1, nrow(DATA), 7), ]
|
||||||
m <- prophet(train.w)
|
m <- prophet(train.w)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue