Scikit learn python中ARIMA的拟合值

Scikit learn python中ARIMA的拟合值,scikit-learn,time-series,statsmodels,pyramid-arima,Scikit Learn,Time Series,Statsmodels,Pyramid Arima,我正在研究时间序列模型。我在金字塔arima模块中使用了自动arima模型。我已经在我的数据集上安装了auto_arima模型。现在我有两个问题 我想看看模型参数 我想从模型中得到拟合值 下面是我的示例代码 m1_hist = auto_arima(ts1_hist, start_p=1, start_q=1, max_p=3, max_q=3, m=12, start_P=0, seasonal=Tru

我正在研究时间序列模型。我在金字塔arima模块中使用了自动arima模型。我已经在我的数据集上安装了auto_arima模型。现在我有两个问题

  • 我想看看模型参数

  • 我想从模型中得到拟合值

  • 下面是我的示例代码

    m1_hist = auto_arima(ts1_hist, start_p=1, start_q=1,
                           max_p=3, max_q=3, m=12,
                           start_P=0, seasonal=True,
                           d=1, D=1, trace=True,
                           error_action='ignore',  
                           suppress_warnings=True, 
                           stepwise=True)
    
    m1_hist2 = m1_hist.fit(ts1_hist)
    
    我使用
    m1_hist.params
    获取模型参数。但它没有向我展示输出

    你能回答我的问题吗


    提前谢谢。

    实际上你应该使用

    m1_hist.arparams()
    # output: array([-0.06322811,  0.26664419]) in my case
    


    找到模型后,应根据实际(y)值对其进行拟合。基于arima中所选模型的y值预测将为拟合值

    比如说,

    start_index = 0 
    end_index = 15
    forecast_index = 15
    y = df.iloc[start_index:end_index] # end index in iloc is exclusive
    model = auto_arima(y, ....)
    
    # Predictions of y values based on "model", namely fitted values
    yhat = model_fit.predict_in_sample(start=start_ind, end=end_ind - 1)
    
    # One step forecast: forecast the element at index 15 
    forecast = model_fit.predict(n_periods=1)
    
    start_index = 0 
    end_index = 15
    forecast_index = 15
    y = df.iloc[start_index:end_index] # end index in iloc is exclusive
    model = auto_arima(y, ....)
    
    # Predictions of y values based on "model", namely fitted values
    yhat = model_fit.predict_in_sample(start=start_ind, end=end_ind - 1)
    
    # One step forecast: forecast the element at index 15 
    forecast = model_fit.predict(n_periods=1)