Add test for cv in diagnostics

This commit is contained in:
Ryan Nazareth 2019-11-02 23:43:09 +00:00 committed by Ben Letham
parent c9e3a83188
commit 3134c7ff5a
2 changed files with 11 additions and 4 deletions

View file

@ -105,6 +105,14 @@ class TestDiagnostics(TestCase):
self.assertAlmostEqual(
((df_cv1['yhat'] - df_cv2['yhat']) ** 2).sum(), 0.0)
def test_cross_validation_uncertainty_disabled(self):
df = self.__df.copy()
m = Prophet(uncertainty_samples=0)
m.fit(df)
df_cv = diagnostics.cross_validation(
m, horizon='4 days', period='4 days', initial='115 days')
self.assertListEqual(['ds', 'yhat', 'y', 'cutoff'], df_cv.columns.tolist())
def test_performance_metrics(self):
m = Prophet()
m.fit(self.__df)

View file

@ -101,10 +101,9 @@ class TestProphet(TestCase):
m = Prophet(uncertainty_samples=0)
m.fit(train)
fcst = m.predict(future)
self.assertNotIn('yhat_lower', list(fcst.columns))
self.assertNotIn('yhat_upper', list(fcst.columns))
self.assertNotIn('trend_lower', list(fcst.columns))
self.assertNotIn('trend_upper', list(fcst.columns))
self.assertListEqual(['ds', 'trend', 'additive_terms', 'weekly',
'multiplicative_terms', 'yhat'], fcst.columns.tolist())
def test_setup_dataframe(self):
m = Prophet()