Skip to content

[BUG] Time Series Setup Issue for short time series #1764

@ngupta23

Description

@ngupta23
from pycaret.internal.pycaret_experiment.time_series_experiment import TimeSeriesExperiment
exp = TimeSeriesExperiment()
y = get_data("115", folder="time_series/seasonal")
exp.setup(data=y, fh=12, fold=1, seasonal_period=12, session_id=42)

The following gives an error

c:\Users\Nikhil\OneDrive\my_libraries\my_python_libraries\pycaret\pycaret_dev\pycaret\internal\tests\time_series.py in test_(data, test, alpha, *kwargs)
     29         results = summary_statistics(data=data)
     30     elif test == "white_noise":
---> 31         results = is_white_noise(data=data, alpha=alpha, verbose=True)[1]
     32     elif test == "stationarity":
     33         results = is_stationary(data=data, alpha=alpha)

c:\Users\Nikhil\OneDrive\my_libraries\my_python_libraries\pycaret\pycaret_dev\pycaret\internal\tests\stats.py in is_white_noise(data, lags, alpha, verbose)
     70         The lags used to test the autocorelation for white noise, by default [24, 48]
     71     """
---> 72     results = sm.stats.acorr_ljungbox(data, lags=lags, return_df=True)
     73     results["White Noise"] = results["lb_pvalue"] > alpha
     74     is_white_noise = False if results["White Noise"].all() == False else True

~\.conda\envs\pycaret_ts_beta\lib\site-packages\statsmodels\stats\diagnostic.py in acorr_ljungbox(x, lags, boxpierce, model_df, period, return_df, auto_lag)
    544     # SS: unbiased=False is default now
    545     sacf = acf(x, nlags=maxlag, fft=False)
--> 546     sacf2 = sacf[1:maxlag + 1] ** 2 / (nobs - np.arange(1, maxlag + 1))
    547     qljungbox = nobs * (nobs + 2) * np.cumsum(sacf2)[lags - 1]
    548     adj_lags = lags - model_df

ValueError: operands could not be broadcast together with shapes (38,) (48,) 

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtime_seriesTopics related to the time series

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions