0
$\begingroup$

Working on a Time Series model that was 730 days with of revenue data and I have two questions.

First, I'm a little confused on how many days I should set my train and test split to. Currently, it's set to 365, but if any of you have advice on that, I'm all ears. I know on linear regression models, I usually don't do 50/50 split, but a couple of tutorials I've seen online are all over the place. That said, I also tried 100 days, etc.

Now for the error. I've pasted the full code below, but all the code works except for the last block and there I'm getting a ValueError: Found input variables with inconsistent numbers of samples: [366, 24]. I believe it's saying that my test and train set aren't the same lengths, but I'm confused as to why. My best guess would span = 12 and alpha = 2/(span+1) are causing it; however, as I've adjusted that code, that block gives me an error. Here's a sample of what my data looks like and the code will be below it.

Day       Revenue
1            1.1
2            1.3
3            1.7
4            1.4
5            1.5
6            1.2
7            1.7


train_data = data.iloc[:365]
test_data = data.iloc[365:]


span = 12
alpha = 2/(span+1)
simpleExpSmooth_model = SimpleExpSmoothing(train_data['Revenue']).fit(smoothing_level=alpha,optimized=False)
doubleExpSmooth_model = ExponentialSmoothing(train_data['Revenue'],trend='add',seasonal_periods=12).fit()
tripleExpSmooth_model = ExponentialSmoothing(train_data['Revenue'],trend='add',seasonal='add',seasonal_periods=12).fit()


predictions_simpleExpSmooth_model = simpleExpSmooth_model.forecast(24)
predictions_doubleExpSmooth_model = doubleExpSmooth_model.forecast(24)
predictions_tripleExpSmooth_model = tripleExpSmooth_model.forecast(24)


print('Simple Exponential Smoothing RMSE: {:.4f}'.format(np.sqrt(mean_squared_error(test_data,predictions_simpleExpSmooth_model))))
print('Double Exponential Smoothing RMSE: {:.4f}'.format(np.sqrt(mean_squared_error(test_data,predictions_doubleExpSmooth_model))))
print('Triple Exponential Smoothing RMSE: {:.4f}'.format(np.sqrt(mean_squared_error(test_data,predictions_tripleExpSmooth_model))))
````
$\endgroup$

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.