facebookresearch / Kats

Kats, a kit to analyze time series data, a lightweight, easy-to-use, generalizable, and extendable framework to perform time series analysis, from understanding the key statistics and characteristics, detecting change points and anomalies, to forecasting future trends.
MIT License
4.89k stars 536 forks source link

Incompatibility with statsmodels 0.13.x #208

Closed ghost closed 2 years ago

ghost commented 2 years ago

The error below is caused by using statsmodels 0.13.x. Kats requires statsmodels==0.12.2 in requirements.txt, but this is quite a stringent requirement considering that statsmodels tend to change their API with new minor versions. Would it be possible to make the due changes to make Kats compatible with statsmodels 0.13.x?

A useful reference is https://github.com/alan-turing-institute/sktime/issues/1478

Reproducible code from kats.consts import TimeSeriesData from kats.tsfeatures.tsfeatures import TsFeatures air_passengers_df = pd.read_csv( "https://raw.githubusercontent.com/facebookresearch/Kats/main/kats/data/air_passengers.csv", header=0, names=["time", "passengers"], ) air_passengers_ts = TimeSeriesData(air_passengers_df) features = TsFeatures().transform(air_passengers_ts)

Error TypeError Traceback (most recent call last) Input In [9], in 13 air_passengers_ts = TimeSeriesData(air_passengers_df) 15 # calculate the TsFeatures ---> 16 features = TsFeatures().transform(air_passengers_ts)

File ~/Desktop/repos/crisisalpha/.venv/lib/python3.8/site-packages/kats/tsfeatures/tsfeatures.py:335, in TsFeatures.transform(self, x) 332 if len(x.value.shape) == 1: 333 # a single Series: return a map of {feature: value} 334 ts_values = x.value.values --> 335 ts_features = self._transform_1d(ts_values, x) 336 else: 337 # multiple time series: return a list of map {feature: value} 338 ts_features = []

File ~/Desktop/repos/crisisalpha/.venv/lib/python3.8/site-packages/kats/tsfeatures/tsfeatures.py:391, in TsFeatures._transform_1d(self, x, ts) 389 dict_acfpacf_features = {} 390 if self.acfpacf_features: --> 391 dict_acfpacf_features = self.get_acfpacf_features( 392 x, 393 acfpacf_lag=self.acfpacf_lag, 394 period=self.stl_period, 395 extra_args=self.kwargs, 396 default_status=self.default, 397 ) 399 # calculate special AC 400 dict_specialac_features = {}

TypeError: acf() got an unexpected keyword argument 'unbiased'

rohanfb commented 2 years ago

statsmodels introduced breaking changes in 0.13. While in the future we hope to add to the kats.compat layer to enable Kats to be fully compatible with 0.13, currently only version 0.12.2 is officially supported. We welcome external contributions to kats.compat as well :)