From 2ab01c5d77e11acad98908c284c68e929b3e6524 Mon Sep 17 00:00:00 2001 From: Ben Letham Date: Fri, 8 Sep 2017 07:59:52 -0700 Subject: [PATCH] Fix flaky unit test --- R/tests/testthat/test_prophet.R | 4 ++-- python/fbprophet/tests/test_prophet.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/tests/testthat/test_prophet.R b/R/tests/testthat/test_prophet.R index 7f02f12..9344528 100644 --- a/R/tests/testthat/test_prophet.R +++ b/R/tests/testthat/test_prophet.R @@ -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. diff --git a/python/fbprophet/tests/test_prophet.py b/python/fbprophet/tests/test_prophet.py index a36af0f..5b94e3b 100644 --- a/python/fbprophet/tests/test_prophet.py +++ b/python/fbprophet/tests/test_prophet.py @@ -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.