mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
Change dataset for flat growth test
This commit is contained in:
parent
6284fc0264
commit
181933b948
1 changed files with 11 additions and 8 deletions
|
|
@ -208,16 +208,19 @@ class TestProphet(TestCase):
|
||||||
|
|
||||||
def test_flat_growth(self):
|
def test_flat_growth(self):
|
||||||
m = Prophet(growth='flat')
|
m = Prophet(growth='flat')
|
||||||
N = DATA.shape[0]
|
x = np.linspace(0, 2 * np.pi, 8 * 7)
|
||||||
history = DATA.head(N // 2).copy()
|
history = pd.DataFrame({
|
||||||
|
'ds': pd.date_range(start='2020-01-01', periods=8 * 7, freq='d'),
|
||||||
|
'y': 30 + np.sin(x * 8.),
|
||||||
|
})
|
||||||
m.fit(history)
|
m.fit(history)
|
||||||
future = m.make_future_dataframe(N // 2, include_history=False)
|
future = m.make_future_dataframe(10, include_history=True)
|
||||||
fcst = m.predict(future)
|
fcst = m.predict(future)
|
||||||
m_ = m.params['m']
|
m_ = m.params['m'][0, 0]
|
||||||
k = m.params['k']
|
k = m.params['k'][0, 0]
|
||||||
self.assertEqual(k[0, 0], 0)
|
self.assertAlmostEqual(k, 0)
|
||||||
self.assertEqual(fcst['trend'].unique(), m_*m.y_scale)
|
self.assertAlmostEqual(fcst['trend'].unique()[0], m_ * m.y_scale)
|
||||||
self.assertEqual(np.round(m_[0,0]*m.y_scale), 26)
|
self.assertEqual(np.round(m_ * m.y_scale), 30.0)
|
||||||
|
|
||||||
def test_invalid_growth_input(self):
|
def test_invalid_growth_input(self):
|
||||||
msg = 'Parameter "growth" should be "linear", ' \
|
msg = 'Parameter "growth" should be "linear", ' \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue