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.85k stars 530 forks source link

Tutorial 202 detection BOCPDetector parameter error #321

Open yannmean opened 1 year ago

yannmean commented 1 year ago

Hi, there!

We are trying to run through tutorial 202, however, encountered the following error. Could you please kindly help? thanks!

Exception Traceback (most recent call last) Cell In[37], line 1 ----> 1 changepoints = bocpd_detector.detector( 2 model=BOCPDModelType.NORMAL_KNOWN_MODEL, # this is the default choice 3 choose_priors=True, 4 changepoint_prior=0.01 5 )

BOCPDetector.detector(self, model, model_parameters, lag, choose_priors, changepoint_prior, threshold, debug, agg_cp) 364 assert isinstance( 365 model_parameters, self.parameter_type[model] 366 ), f"Expected parameter type {self.parameter_type[model]}, but got {model_parameters}" 368 if choose_priors: --> 369 changepoint_prior, model_parameters = self._choose_priors( 370 model, model_parameters 371 ) 373 if getattr(model_parameters, "data", 0) is None: 374 model_parameters.data = self.data ... 394 if len(data) > 0 395 else cls.data_constructor() 396 )

Exception: []

yannmean commented 1 year ago

tried several other ways... I just don't understand it anymore...

I did the following:

`from kats.detectors.bocpd import BOCPDetector, BOCPDModelType, NormalKnownParameters'

'bocpd_detector = BOCPDetector(ts_bocpd)'

'changepoints = bocpd_detector.detector( model=BOCPDModelType.NORMAL_KNOWN_MODEL, # this is the default choice model_parameters=NormalKnownParameters )`

But the error says: AssertionError: Expected parameter type <class 'kats.detectors.bocpd.NormalKnownParameters'>, but got <class 'kats.detectors.bocpd.NormalKnownParameters'>

I just don't see the difference between <class 'kats.detectors.bocpd.NormalKnownParameters'> and the latter <class 'kats.detectors.bocpd.NormalKnownParameters'>

Please, anyone?