facebook-prophet的先知时间序列建模可产生恒定或线性拟合值,并预测少于25个观测值的时间序列。我想知道是什么原因导致这种现象,以及是否有一种方法可以覆盖它。
from fbprophet import Prophet
import pandas
import numpy
training_length = 24
forecast_length = 5
training_endog = numpy.random.randint(50,150,training_length)
training_dates = pandas.date_range('2017-05-31', periods=training_length, freq='M')
df = pandas.DataFrame({'ds':training_dates, 'y':training_endog})
prophet_model = Prophet(
holidays=None,
daily_seasonality=False,
weekly_seasonality=False,
).fit(df)
future = prophet_model.make_future_dataframe(periods=5, freq='M', include_history=True)
prophet_model_predictions = prophet_model.predict(future)['yhat'].clip(lower=0).round()
y_long = numpy.concatenate([training_endog, numpy.zeros(5)])
future['y'] = y_long
future['yhat'] = prophet_model_predictions
future.plot(x='ds', y=['y','yhat'])
答案 0 :(得分:0)
对于上述示例,添加yearly_seasonality=True
解决了该问题。