auto_ts: How to change forecasted date range in auto_ts

127 Views Asked by At

I am trying to forecast values using auto_ts library, the input i am passing is a date format which has first date of every month like 2021-11-01 whereas the forecasted values have a date range as last date of every month like 2021-11-30.

Is there a way to change the date range of predicted values to first date of every month?

1

There are 1 best solutions below

0
On

The issue you are seeing is because autots uses the pandas dataframe to infer the frequency.

model = AutoTS(
    forecast_length=21,
    frequency='infer',
    prediction_interval=0.9,
    ensemble=None,
    model_list="fast",  # "superfast", "default", "fast_parallel"
    transformer_list="fast",  # "superfast",
    drop_most_recent=1,
    max_generations=4,
    num_validations=2,
    validation_method="backwards"
)

pandas by default does end-of-month for its monthly spacing. To get start of month, you can use frequency ='MS' to get start-of-month:

model = AutoTS(
    forecast_length=21,
    frequency='MS', # this is the change needed
    ...)