本文整理汇总了Python中fbprophet.Prophet.set_changepoints方法的典型用法代码示例。如果您正苦于以下问题:Python Prophet.set_changepoints方法的具体用法?Python Prophet.set_changepoints怎么用?Python Prophet.set_changepoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fbprophet.Prophet
的用法示例。
在下文中一共展示了Prophet.set_changepoints方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_override_n_changepoints
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import set_changepoints [as 别名]
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)
示例2: test_get_zero_changepoints
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import set_changepoints [as 别名]
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)
示例3: test_get_changepoints
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import set_changepoints [as 别名]
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])
示例4: test_get_changepoints
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import set_changepoints [as 别名]
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)
self.assertTrue(cp.max() < N)
mat = m.get_changepoint_matrix()
self.assertEqual(mat.shape[0], N // 2)
self.assertEqual(mat.shape[1], m.n_changepoints)