mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
Fix test issues
This commit is contained in:
parent
ccde3a498f
commit
a88f6458ad
4 changed files with 4 additions and 4 deletions
|
|
@ -282,7 +282,7 @@ test_that("copy", {
|
||||||
m1 <- add_regressor(m1, 'binary_feature')
|
m1 <- add_regressor(m1, 'binary_feature')
|
||||||
m1 <- fit.prophet(m1, df)
|
m1 <- fit.prophet(m1, df)
|
||||||
m2 <- prophet:::prophet_copy(m1, cutoff)
|
m2 <- prophet:::prophet_copy(m1, cutoff)
|
||||||
changepoints <- changepoints[changepoints <= cutoff]
|
changepoints <- changepoints[changepoints < cutoff]
|
||||||
expect_equal(prophet:::set_date(changepoints), m2$changepoints)
|
expect_equal(prophet:::set_date(changepoints), m2$changepoints)
|
||||||
expect_true('custom' %in% names(m2$seasonalities))
|
expect_true('custom' %in% names(m2$seasonalities))
|
||||||
expect_true('binary_feature' %in% names(m2$extra_regressors))
|
expect_true('binary_feature' %in% names(m2$extra_regressors))
|
||||||
|
|
|
||||||
|
|
@ -1106,7 +1106,7 @@ class Prophet(object):
|
||||||
history = df[df['y'].notnull()].copy()
|
history = df[df['y'].notnull()].copy()
|
||||||
if history.shape[0] < 2:
|
if history.shape[0] < 2:
|
||||||
raise ValueError('Dataframe has less than 2 non-NaN rows.')
|
raise ValueError('Dataframe has less than 2 non-NaN rows.')
|
||||||
self.history_dates = pd.to_datetime(df['ds'].unique()).sort_values()
|
self.history_dates = pd.to_datetime(pd.Series(df['ds'].unique(), name='ds')).sort_values()
|
||||||
|
|
||||||
history = self.setup_dataframe(history, initialize_scales=True)
|
history = self.setup_dataframe(history, initialize_scales=True)
|
||||||
self.history = history
|
self.history = history
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,7 @@ class TestDiagnostics(TestCase):
|
||||||
m1.add_regressor('binary_feature')
|
m1.add_regressor('binary_feature')
|
||||||
m1.fit(df)
|
m1.fit(df)
|
||||||
m2 = diagnostics.prophet_copy(m1, cutoff=cutoff)
|
m2 = diagnostics.prophet_copy(m1, cutoff=cutoff)
|
||||||
changepoints = changepoints[changepoints <= cutoff]
|
changepoints = changepoints[changepoints < cutoff]
|
||||||
self.assertTrue((changepoints == m2.changepoints).all())
|
self.assertTrue((changepoints == m2.changepoints).all())
|
||||||
self.assertTrue('custom' in m2.seasonalities)
|
self.assertTrue('custom' in m2.seasonalities)
|
||||||
self.assertTrue('binary_feature' in m2.extra_regressors)
|
self.assertTrue('binary_feature' in m2.extra_regressors)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class TestSerialize(TestCase):
|
||||||
# Make sure json doesn't get too large in the future
|
# Make sure json doesn't get too large in the future
|
||||||
self.assertTrue(len(model_str) < 200000)
|
self.assertTrue(len(model_str) < 200000)
|
||||||
z = json.loads(model_str)
|
z = json.loads(model_str)
|
||||||
self.assertEqual(z['__fbprophet_version'], '0.6.1.dev0')
|
self.assertEqual(z['__fbprophet_version'], '0.7')
|
||||||
|
|
||||||
m2 = model_from_json(model_str)
|
m2 = model_from_json(model_str)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue