Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to extract estimated (no predict ) values from pmdarima.auto_arima

I am trying to extract the estimated (not predicted) values from the auto_arima model of the pmdarima library, I have not been able to. I have tried with:modl.fit() and it does not generate the values that later I need them to graph together with the training values len(train) = len(mod1.fit())

import pmdarima as pm
import matplotlib.pyplot as plt
import numpy as np


data = pm.datasets.load_lynx()
train, test = model_selection.train_test_split(data, train_size=90)

# Fit a simple auto_arima model
modl = pm.auto_arima(train, start_p=1, start_q=1, start_P=1, start_Q=1,
                     max_p=5, max_q=5, max_P=5, max_Q=5, seasonal=True,
                     stepwise=True, suppress_warnings=True, D=10, max_D=10,
                     error_action='ignore')

# ---- plot (train and fitted (yhat) values
plt.plot(train)
plt.plot(modl.fit())
plt.show()
like image 532
royer Avatar asked Nov 20 '25 20:11

royer


1 Answers

I have doubts but here I present a supposed answer to my question and if it is not, please correct me:

Predicts the original training (in-sample) time series values. This can be useful when wanting to visualize the fit, and qualitatively inspect the efficacy of the model, or when wanting to compute the residuals of the model. reference

plt.plot(train)
plt.plot(modl.predict_in_sample() )
plt.show()

the function predict_in_sample() allows to extract the estimated values and in the case of R I suppose that it is modl$fit

like image 105
royer Avatar answered Nov 22 '25 09:11

royer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!