本文整理汇总了Python中fbprophet.Prophet.piecewise_logistic方法的典型用法代码示例。如果您正苦于以下问题:Python Prophet.piecewise_logistic方法的具体用法?Python Prophet.piecewise_logistic怎么用?Python Prophet.piecewise_logistic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fbprophet.Prophet
的用法示例。
在下文中一共展示了Prophet.piecewise_logistic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_piecewise_logistic
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import piecewise_logistic [as 别名]
def test_piecewise_logistic(self):
model = Prophet()
t = np.arange(11.)
cap = np.ones(11) * 10
m = 0
k = 1.0
deltas = np.array([0.5])
changepoint_ts = np.array([5])
y = model.piecewise_logistic(t, cap, deltas, k, m, changepoint_ts)
y_true = np.array([5.000000, 7.310586, 8.807971, 9.525741, 9.820138,
9.933071, 9.984988, 9.996646, 9.999252, 9.999833,
9.999963])
self.assertAlmostEqual((y - y_true).sum(), 0.0, places=5)
t = t[8:]
y_true = y_true[8:]
cap = cap[8:]
y = model.piecewise_logistic(t, cap, deltas, k, m, changepoint_ts)
self.assertAlmostEqual((y - y_true).sum(), 0.0, places=5)