kats.detectors.detector module¶
Defines the base class for detectors.
- class kats.detectors.detector.Detector(data: kats.consts.TimeSeriesData)[source]¶
Bases:
abc.ABC
Base detector class to be inherited by specific detectors
- data¶
The input time series data from TimeSeriesData
- remover(interpolate: bool = False) → kats.consts.TimeSeriesData[source]¶
Remove the outlier in time series
- Parameters
interpolate – Optional; bool; interpolate the outlier
- Returns
A TimeSeriesData with outlier removed.
- class kats.detectors.detector.DetectorModel(serialized_model: Optional[bytes])[source]¶
Bases:
abc.ABC
Base Detector model class to be inherited by specific detectors. A DetectorModel keeps the state of the Detector, and implements the incremental model training.
The usage of the DetectorModel is (replace DetectorModel with the proper child class)
model = DetectorModel(serialized_model) model.fit(new_data, …)
# the model may be saved through model.serialize() call # the model may be loaded again through model = DetectorModel(serialized_model)
result = model.predict(data, …)