auto_ts:如何更改auto_ts中的预测日期范围

发布于 2025-01-29 17:34:39 字数 188 浏览 5 评论 0原文

我正在尝试使用 auto_ts 库来预测值,我传递的输入是一个日期格式,每个月的第一个日期如 2021-11-01 ,而预测值每个月的最后日期都有一个日期范围,例如 2021-11-30

有没有办法将预测值的日期范围更改为每个月的第一个日期?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

硬不硬你别怂 2025-02-05 17:34:39

您看到的问题是因为自动使用pandas dataframe来推断频率。

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默认情况下确实每月间距的每月结束。要开始一个月,您可以使用频率='MS'获得月点:

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

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
    ...)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文