I am using autogluon, and I have created my train_data from my dataframe.
train_data = TimeSeriesDataFrame.from_data_frame(
df,
id_column="index",
timestamp_column="timestamp"
)
train_data.head()
value
item_id timestamp
0 2021-10-13 1409083.0
1 2021-10-14 1416055.0
2 2021-10-15 1223615.0
3 2021-10-16 1333072.0
4 2021-10-17 1284866.0
When I run
predictor = TimeSeriesPredictor(
prediction_length=48,
path="autogluon-m4-hourly",
target="target",
eval_metric="MASE",
ignore_time_index=True
)
I get
ValueError: Detected time series with length <= 2 in data.
Please remove them from the dataset.
Any idea how to fix this?
Edit
My original DF looked like
df.head()
date total
0 2021-10-13 1409083.0
1 2021-10-14 1416055.0
2 2021-10-15 1223615.0
3 2021-10-16 1333072.0
4 2021-10-17 1284866.0
which was read from a csv file into the dataframe.
I have one value (total) for each day. The totals are what I want to forecast into the future. I have 730 rows in my data (2 years worth).
Is it possible to use autogluon to forecast this data?
I created the item_id
column and added it to the df so that I could pass this to the TimeSeriesPredictor
I found my issue. And it was in the way that I created the item_id. I assumed (wrongly!) that each row should have an increasing counter for the item_id. Since I had 730 rows, this told autogluon that I was trying to forecast 730 different items. In reality, I have one item with 730 values. When I changed the item_id to all 1's for each row, then the code worked.