Skip to content

plot_model(model, plot = 'forecast') showing unexpected behavior sometimes #1741

@moezali1

Description

@moezali1

plot_model(model, plot = 'forecast') showing unexpected behavior sometimes.

Sometimes forecast plot also shows the in-sample forecast on the plot. This is what we eventually want but I am opening this ticket to understand more why it is happening now? To reproduce:

from pycaret.datasets import get_data
data = get_data('pycaret_downloads')
data['Date'] = pd.to_datetime(data['Date'])
data.set_index('Date', inplace=True, drop=True)
data = data.asfreq('D')
data.head()

from pycaret.time_series import *
setup(data, fh = 7, fold = 5, session_id = 123)
check_stats()
plot_model(plot = 'ts')
plot_model(plot = 'train_test_split')
plot_model(plot = 'cv')
plot_model(plot = 'acf')
plot_model(plot = 'pacf')
plot_model(plot = 'diagnostics')
plot_model(plot = 'decomp_classical')
plot_model(plot = 'decomp_stl')
plot_model(best, plot = 'residuals')
best = compare_models(turbo=True)
plot_model(best, plot = 'forecast')

image

A lot of plotting code in the above example is irrelevant but please run the code in an exact sequence to reproduce the error. Just running compare_models and plot_model(model, plot = 'forecast') won't be able to reproduce the error. This means that one of the other plots (most likely residuals) is changing the fh global parameter. Not 100% sure though.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingplot_modeltime_seriesTopics related to the time series

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions