intive-DataScience / tbats

BATS and TBATS forecasting methods
MIT License
178 stars 19 forks source link

{ValueError}Input contains NaN, infinity or a value too large for dtype('float64'). #22

Closed mzietlow closed 3 years ago

mzietlow commented 3 years ago

I am currently playing around with the Numenta Anomaly Benchmark dataset and just ran into a dataframe that leads to inf values for a tbats2 model (using atspy lingo).

I have tracked the issue down to the transformation.BoxCox.inv_boxcox function, in which a already high value gets exponentialized and thus flips inf.

Beyond that however, I was unable to pinpoint the issue.

To replicate a.) create a new csv file (example.csv) with contents from my pastebin b.) run respective python interpreter c.)

from tbats import TBATS
data = pd.read_csv("./example.csv")
TBATS(seasonal_periods=[2, 5], use_arma_errors=False, use_box_cox=True).fit(data["Target"])
cotterpl commented 3 years ago

BoxCox transformation doesn't always work well. If you have values very close to zero or negative it may fail in such a way. Please rurn boxcox off using use_box_cox=False. Your exemplary series don't seem to have increasing trend or variance that would require Box Cox transformation.

mzietlow commented 3 years ago

Okay, thank you!