mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-07-30 20:18:11 +00:00
Fix flaky unit test
This commit is contained in:
parent
2e9768348b
commit
2ab01c5d77
2 changed files with 4 additions and 4 deletions
|
|
@ -83,7 +83,7 @@ test_that("logistic_floor", {
|
|||
future1 <- future
|
||||
future1$cap <- 80.
|
||||
future1$floor <- 10.
|
||||
m <- fit.prophet(m, history)
|
||||
m <- fit.prophet(m, history, algorithm = 'Newton')
|
||||
expect_true(m$logistic.floor)
|
||||
expect_true('floor' %in% colnames(m$history))
|
||||
expect_equal(m$history$y_scaled[1], 1., tolerance = 1e-6)
|
||||
|
|
@ -96,7 +96,7 @@ test_that("logistic_floor", {
|
|||
history2$cap <- history2$cap + 10.
|
||||
future1$cap <- future1$cap + 10.
|
||||
future1$floor <- future1$floor + 10.
|
||||
m2 <- fit.prophet(m2, history2)
|
||||
m2 <- fit.prophet(m2, history2, algorithm = 'Newton')
|
||||
expect_equal(m2$history$y_scaled[1], 1., tolerance = 1e-6)
|
||||
fcst2 <- predict(m, future1)
|
||||
fcst2$yhat <- fcst2$yhat - 10.
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class TestProphet(TestCase):
|
|||
future = DATA.tail(N // 2).copy()
|
||||
future['cap'] = 80.
|
||||
future['floor'] = 10.
|
||||
m.fit(history)
|
||||
m.fit(history, algorithm='Newton')
|
||||
self.assertTrue(m.logistic_floor)
|
||||
self.assertTrue('floor' in m.history)
|
||||
self.assertAlmostEqual(m.history['y_scaled'][0], 1.)
|
||||
|
|
@ -131,7 +131,7 @@ class TestProphet(TestCase):
|
|||
history2['cap'] += 10.
|
||||
future['cap'] += 10.
|
||||
future['floor'] += 10.
|
||||
m2.fit(history2)
|
||||
m2.fit(history2, algorithm='Newton')
|
||||
self.assertAlmostEqual(m2.history['y_scaled'][0], 1.)
|
||||
fcst2 = m2.predict(future)
|
||||
fcst2['yhat'] -= 10.
|
||||
|
|
|
|||
Loading…
Reference in a new issue