winedarksea / AutoTS

Automated Time Series Forecasting
MIT License
1.05k stars 96 forks source link

if forecast_length == 'self': #223

Closed varsha003 closed 6 months ago

varsha003 commented 6 months ago

I am trying to do prediction with the model train pickle file like inference script . i am getting error as Lib\site-packages\autots\evaluator\auto_ts.py", line 2281, in predict if forecast_length == 'self': ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\varsha.k\Documents\SRInt\myenv\Lib\site-packages\pandas\core\generic.py", line 1527, in nonzero raise ValueError( ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

then if i tried adding in predict statement like predictions = loaded_model.predict(df, forecast_length=7*24) i am getting error as

TypeError: AutoTS.predict() got multiple values for argument 'forecast_length'.

winedarksea commented 6 months ago

I think the problem here is you are passing in df as an arg to predict (which it sees as a positional arg for forecast length). It is understandable you are trying to use the sklearn style but because there are more options here for data import there is a separate function to do that, model.fit_data(df). In fact, there is no need to pickle AutoTS, you can simple model.export_template("your_file.csv", n=1)

then on a new AutoTS class:

model = AutoTS(...args)
model.import_best_model("your_file.csv")
model.fit_data(df)
model.predict()