【问题标题】:pmdarima save auto.arima aic valuespmdarima 保存 auto.arima aic 值
【发布时间】:2021-03-09 18:57:08
【问题描述】:

有没有办法保存这个 AIC 值?

我想对这些值进行排序以查看哪个模型的 AIC 最低,以便对 AIC 较低的模型进行交叉验证enter image description here

【问题讨论】:

标签: python arima pmdarima


【解决方案1】:

我在pmd arima (alkaline-ml/pmdarima) 的 GitHub 页面中看到了这个问题。

答案来自积极维护 pmdarima 的Taylor G. Smith

有两种方法。

1)

第一个是将参数 return_valid_fits 设置为 True。见 pmdarima 1.8.0 documentation:

return_valid_fits:bool,可选(默认=False)

如果为 True,将返回所有有效的 ARIMA 适合列表。如果为假(由 默认),只会返回最合适的。

示例:

import pmdarima as pm

sxmodel = pm.auto_arima(endog[:n_train],exog[:n_train], start_p=0, start_q=0, max_p=2, max_q=2,
                           start_P=0,start_Q=0, max_P=2,max_D=1,max_Q=2, m=7, seasonal=True,
                           d=0, trace=True, error_action='trace',suppress_warnings=True, stepwise=True)

sxmodel

在第一种情况下,sxmodel 将是一个包含拟合模型信息的元组


2)

另一个正在使用 sys 模块:

import sys
orig_stdout = sys.stdout
f = open('out.txt', 'w')
sys.stdout = f

# fit your model
model = pm.auto_arima(...)

sys.stdout = orig_stdout
f.close()

【讨论】:

    猜你喜欢
    • 2020-09-18
    • 1970-01-01
    • 2019-10-08
    • 1970-01-01
    • 2012-12-22
    • 2019-10-09
    • 1970-01-01
    • 2019-08-03
    • 2015-04-05
    相关资源
    最近更新 更多