FBProphet模型中的假日效应全部为零



我有一个预测公司出货量的Prophet模型。当我添加特殊事件(促销和假期(时,它们似乎对模型的预测没有影响。我做错什么了吗?在我检查的所有例子中,节日总是对先知模型产生影响。

from fbprophet.make_holidays import make_holidays_df
import datetime
country_name= 'ES'
festivos=make_holidays_df([2017,2018,2019,2020],'ES')
festivos['dia']=0
for index, row in festivos.iterrows():
    festivos.loc[index,"dia"]='Festivo ' + str(datetime.datetime.weekday(festivos.iloc[index]["ds"]))
festivo2=pd.DataFrame({'holiday':festivos['dia'],'ds':festivos['ds'],'lower_window':-9,'upper_window':1,})
festivo1=pd.DataFrame({'holiday':festivos['holiday'],'ds':festivos['ds'],'lower_window':-9,'upper_window':1,})
festivo=pd.concat((festivo2,festivo1))
festivo=pd.DataFrame(festivo)
festivo
ph_home = Prophet(holidays=festivo)
ph_home.add_country_holidays(country_name='ES')
ph_home.fit(home_train)
fut_home= ph_home.make_future_dataframe(periods=6,freq='M')
pred_home=ph_home.predict(fut_home)
fig1 =ph_home.plot(pred_home)
a = add_changepoints_to_plot(fig1.gca(), ph_home, pred_home)
fig1=ph_home.plot_components(pred_home)
pd.concat([home_train.set_index('ds')['y'],pred_home.set_index('ds')['yhat']],axis=1).plot(figsize=(15,10))

节日效应在我的先知模型

我用来训练预言家模型的DataFrame

看起来这是由于您每月的聚合。请参阅此处的最后一条注释。

With data that has been aggregated to weekly or monthly frequency, holidays that don’t fall on the particular date used in the data will be ignored

最新更新