def test_override_n_changepoints(self): m = Prophet() history = DATA.head(20).copy() history = m.setup_dataframe(history, initialize_scales=True) m.history = history m.set_changepoints() self.assertEqual(m.n_changepoints, 15) cp = m.changepoints_t self.assertEqual(cp.shape[0], 15)
def test_get_zero_changepoints(self): m = Prophet(n_changepoints=0) N = DATA.shape[0] history = DATA.head(N // 2).copy() history = m.setup_dataframe(history, initialize_scales=True) m.history = history m.set_changepoints() cp = m.changepoints_t self.assertEqual(cp.shape[0], 1) self.assertEqual(cp[0], 0)
def test_get_changepoints(self): m = Prophet() N = DATA.shape[0] history = DATA.head(N // 2).copy() history = m.setup_dataframe(history, initialize_scales=True) m.history = history m.set_changepoints() cp = m.changepoints_t self.assertEqual(cp.shape[0], m.n_changepoints) self.assertEqual(len(cp.shape), 1) self.assertTrue(cp.min() > 0) cp_indx = int(np.ceil(0.8 * history.shape[0])) self.assertTrue(cp.max() <= history['t'].values[cp_indx])