kanch91 / project-energy

Time-series analysis of the electricity load consumption in the Mumbai Metropolitan Region.
8 stars 0 forks source link

Issue using es_models and SARIMAX_model #14

Open baborok opened 2 years ago

baborok commented 2 years ago

Hello can u please help me figure this out. using es_models Traceback (most recent call last): File "C:\Users\petuu\Desktop\project-energy-master\es_models.py", line 216, in mse_tes, rmse_tes, r2_tes, y_tes = triple_exponential_smoothing(season, y_test) File "C:\Users\petuu\Desktop\project-energy-master\es_models.py", line 121, in triple_exponential_smoothing tes_model = ExponentialSmoothing(y_test, seasonal_periods=season, trend='add', seasonal='add').fit(use_boxcox=True) File "G:\anaconda\envs\depp-ts\lib\site-packages\pandas\util_decorators.py", line 207, in wrapper return func(*args, kwargs) File "G:\anaconda\envs\depp-ts\lib\site-packages\pandas\util_decorators.py", line 207, in wrapper return func(*args, *kwargs) File "G:\anaconda\envs\depp-ts\lib\site-packages\pandas\util_decorators.py", line 207, in wrapper return func(args, kwargs) File "G:\anaconda\envs\depp-ts\lib\site-packages\statsmodels\tsa\holtwinters\model.py", line 1094, in fit raise ValueError( ValueError: use_boxcox was set at model initialization and cannot be changed

using SARIMAX_model Traceback (most recent call last): File "statsmodels\tsa\statespace_kalman_smoother.pyx", line 1000, in statsmodels.tsa.statespace._kalman_smoother.dKalmanSmoother.allocate_arrays numpy.core._exceptions._ArrayMemoryError: Unable to allocate 697. MiB for an array with shape (51, 51, 35135) and data type float64 Exception ignored in: 'statsmodels.tsa.statespace._kalman_smoother.dKalmanSmoother.reset_filter_method' Traceback (most recent call last): File "statsmodels\tsa\statespace_kalman_smoother.pyx", line 1000, in statsmodels.tsa.statespace._kalman_smoother.dKalmanSmoother.allocate_arrays numpy.core._exceptions._ArrayMemoryError: Unable to allocate 697. MiB for an array with shape (51, 51, 35135) and data type float64 Traceback (most recent call last): File "C:\Users\petuu\Desktop\project-energy-master\sarimax_model.py", line 85, in results = model.fit() File "G:\anaconda\envs\depp-ts\lib\site-packages\statsmodels\tsa\statespace\mlemodel.py", line 728, in fit res = func(mlefit.params, transformed=False, includes_fixed=False, File "G:\anaconda\envs\depp-ts\lib\site-packages\statsmodels\tsa\statespace\mlemodel.py", line 886, in smooth result = self.ssm.smooth(complex_step=complex_step, kwargs) File "G:\anaconda\envs\depp-ts\lib\site-packages\statsmodels\tsa\statespace\kalman_smoother.py", line 410, in smooth smoother = self._smooth(smoother_output, results=results, kwargs) File "G:\anaconda\envs\depp-ts\lib\site-packages\statsmodels\tsa\statespace\kalman_smoother.py", line 360, in _smooth smoother() File "statsmodels\tsa\statespace_kalman_smoother.pyx", line 1214, in statsmodels.tsa.statespace._kalman_smoother.dKalmanSmoother.call File "statsmodels\tsa\statespace_kalman_smoother.pyx", line 1239, in statsmodels.tsa.statespace._kalman_smoother.dKalmanSmoother.next File "statsmodels\tsa\statespace_kalman_smoother.pyx", line 1435, in statsmodels.tsa.statespace._kalman_smoother.dKalmanSmoother.initialize_smoother_object_pointers AttributeError: Memoryview is not initialized

kanch91 commented 2 years ago

For es_models, the use_boxcox has been deprecated since 0.12.0 release of statsmodels package. Either use a version of statsmodels compatible (pre-0.12 version) or drop the parameters in fit(). Refer this and this.

For SARIMAX_model, refer to this thread and this. Also, check the backward compatibility of the newer statsmodels with the repo.