0
$\begingroup$

I am trying to implement demand forecast of a produt for a month ahead and then convert it to week wise. I have received 7 years of week wise sales data,did all necesary data preprocessing,train(up to 6 years) &test split(last one year)and then attempted single,double & triple exponential smoothing methods for insample forecast.

When i try to perform out of sample/multi step forecasting(one month ahead),getting following error.

I looked around the web couldn't find sample implementaion in python.Can someone help me on this please.

fit1 = ExponentialSmoothing(np.asarray(tr['sales']) ,seasonal_periods=7 ,trend='mul', seasonal='mul',).fit()
df['Hlt_winter'] = fit1.forecast(len(test)+4)

ValueError: Length of values does not match length of index

$\endgroup$
2
  • $\begingroup$ Whats the shape of df? The problem is in the assignment to 'htl_winter' column and not the 'forcast' call. $\endgroup$
    – yoav_aaa
    Jan 2 '20 at 13:45
  • $\begingroup$ hmm,you are absolutely right,am try to insert new values in df,shape(52,1) without increasing the index.Which caused the issue.Let me adjust the index to fit another 4 values and try call forecast function for out-sample predictions. $\endgroup$
    – Optimizer
    Jan 2 '20 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.