forecasting - get fitted values #888
Answered
by
mloning
eyalshafran
asked this question in
Q&A
-
When using statsmodel it is possible to access the fitted values after the model is fit.
I can't figure out how to access the fitted values using sktime. Is it possible to get them? |
Beta Was this translation helpful? Give feedback.
Answered by
mloning
May 20, 2021
Replies: 1 comment 6 replies
-
Hi @eyalshafran you have two options: Using the sktime interface for in-sample predictions (this should work for all forecasters): from sktime.datasets import load_airline
from sktime.forecasting.exp_smoothing import ExponentialSmoothing
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.forecasting.base import ForecastingHorizon
y = load_airline()
y_train, y_test = temporal_train_test_split(y, test_size=36)
model = ExponentialSmoothing(sp=12, trend='add', seasonal='add')
model.fit(y_train)
fh = ForecastingHorizon(y_train.index, is_relative=False) # in-sample forecasting horizon
model.predict(fh) Accessing the statsmodels used internally (this will only work for forecasters based on statsmodels): model._fitted_forecaster.fittedvalues |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
eyalshafran
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @eyalshafran you have two options:
Using the sktime interface for in-sample predictions (this should work for all forecasters):
Accessing the statsmodels used internally (this will only…