0
$\begingroup$

Here're the pictures of using Holt’s Linear Trend method:

From tutorial (what it should be like): enter image description here After running the code for my data enter image description here

Isn't it strange?

Here's a code (method #5):

y_hat_avg = df_test.copy()

fit1 = Holt(np.asarray(df_train['pickups'])).fit(smoothing_level = 0.3,smoothing_slope = 0.1)
y_hat_avg['Holt_linear'] = fit1.forecast(len(df_test))

plt.figure(figsize=(16,8))
plt.plot(df_train['pickups'], label='Train')
plt.plot(df_test['pickups'], label='Test')
plt.plot(y_hat_avg['Holt_linear'], label='Holt_linear')
plt.legend(loc='best')
plt.show()
rmse = sqrt(mean_squared_error(test.pickups, y_hat_avg.Holt_linear))
print(rmse)

After I run y_hat_avg.Holt_linear.tail() I didn't get any NaNs:

2014-08-31 19:00:00    603.553557
2014-08-31 20:00:00    604.220995
2014-08-31 21:00:00    604.888432
2014-08-31 22:00:00    605.555870
2014-08-31 23:00:00    606.223308
Name: Holt_linear, dtype: float64

UPD: when using fit1 = ExponentialSmoothing(np.asarray(df_train['pickups']) ,seasonal_periods=7 ,trend='add', seasonal='add',).fit() I receive a similar result.

$\endgroup$
  • $\begingroup$ From the page you linked too, you should be using method #6, not #5. $\endgroup$ – Skander H. May 29 '18 at 17:15
  • $\begingroup$ @Alex, I receive similar strange picture for both #5 and #6 methods. $\endgroup$ – Alex Kornakov May 29 '18 at 20:09

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.