-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time Series plot_model support for difference plots #1654
Comments
Consider using |
@codecypher Are you going to work on this one? Let me know so that it can be assigned appropriately. |
So we should always plot the original and then the differences. If only first difference is asked for, it can be a 1x2 plot. If first 2 are asked for, then it can be a 1x3 plot. Anything more than that.wouod need to wrap into multiple rows. |
No, it would kinda help to have an example of what we want to do such as How to Difference a Time Series Dataset with Python |
@codecypher I updated the original post itself to avoid confusion. Let me know if this makes more sense. |
@codecypher As you build this, think about adding modular functions to get the data required for the plot (i.e. the differences). I would like to reuse those functions for the |
@codecypher I got some time to work on this. Since you are working on the frequency components, I will go ahead and add some code for this. We can sync up once that is done. This is sample code for base functions that need to be incorporated: https://gist.github.com/ngupta23/c93116dede5436c05faffd992181b89d |
To test import pandas as pd
from pycaret.datasets import get_data
y = get_data("airline")
#### Setup the experiment ----
from pycaret.internal.pycaret_experiment import TimeSeriesExperiment
exp = TimeSeriesExperiment()
exp.setup(data=y, fh=12, session_id=42)
# Works on original dataset
exp.plot_model(plot="diff") # Default Diff Order = 1
exp.plot_model(plot="diff", data_kwargs={"order_list":[1, 2]})
exp.plot_model(plot="diff", data_kwargs={"lags_list":[1, 12, [1, 12]]})
exp.plot_model(plot="diff", data_kwargs={"order_list":[1, 2], "lags_list":[1, 12, [1, 12]]})
# Works on model residuals
model = exp.create_model("theta")
exp.plot_model(model, plot="diff") # Default Diff Order = 1
# Difference with Diagnostics
# Plot differences along with diagnostics such as ACF and PACF
# Row 1: Original with ACF
# Row 2: d = 1 with ACF
# Row 3: d = 2 with ACF
exp.plot_model(plot="diff", data_kwargs={"order_list": [1, 2], "acf": True})
# Row 1: Original with PACF
# Row 2: d = 1 with PACF
# Row 3: d = 2 with PACF
exp.plot_model(plot="diff", data_kwargs={"order_list": [1, 2], "pacf": True})
# Row 1: Original
# Row 2: d = 1 with ACF & PACF
# Row 3: d = 1 + (D = 1, s = 12) with ACF & PACF
exp.plot_model(plot="diff", data_kwargs={"lags_list": [[1], [1, 12]], "acf": True, "pacf": True}) |
Enhance Time Series Difference Plots - Closes #1654
Add option to plot difference plots. Use
sktime
Differencer
for this. More details hereOption 1: User can specify
order
of differenceOption 2: User can specify
lags
directlyOption 3: Use Option 1 or 2 and plot additional plots such as ACF, PACF
Trellis with ACF and PACF below the time series in individual rows. This would return a plot of 3x3
The text was updated successfully, but these errors were encountered: