Juan Flores
Juan Flores

Reputation: 51

Exponential Smoothing in python produces all NaNs

I am trying to use ExponentialSmoothing (using pandas) to forecast electrical power demand.

The code I wrote and its output follows are attached at the end of this message.

Any clues on why is this producing all NaNs? Training is hourly spaced and I am assuming daily (24 measurement) seasonality.

Thanks in advance,

Juan Flores


print('modeling')

t1=time.time()

model = ExponentialSmoothing(KWHTr, trend='add', seasonal='add', 

seasonal_periods=24).fit()

t2=time.time()

print('modeling time: ', t2-t1, 'sec')

print('predicting')

start_date = KWHVa.index[0] 

end_date = KWHVa.index[-1]

print('period: (', start_date, '-', end_date,')')

pred=KWHVa.copy()

pred = model.predict(start=start_date, end=end_date)

print(pred)

print('*')

Output:


modeling

modeling time:  109.9684362411499 sec

predicting

period: (2017-10-29 10:00:00 - 2017-11-02 13:00:00 )

2017-10-29 10:00:00   NaN

2017-10-29 11:00:00   NaN

2017-10-29 12:00:00   NaN

2017-10-29 13:00:00   NaN

2017-10-29 14:00:00   NaN

                       ..

2017-11-02 09:00:00   NaN

2017-11-02 10:00:00   NaN

2017-11-02 11:00:00   NaN

2017-11-02 12:00:00   NaN

2017-11-02 13:00:00   NaN

Freq: H, Length: 100, dtype: float64

*

Upvotes: 2

Views: 1406

Answers (1)

Juan Flores
Juan Flores

Reputation: 51

I am sorry, the training data contained some NaNs, so it was unable to model nor forecast.

My bad!

Juan

Upvotes: 3

Related Questions