Closed Antorminator closed 1 year ago
I'm not able to reproduce this on my end (snippet below executes without error). I would make sure that you are using the latest version of Kats (0.2.0) and that your data is of the specified frequency. If it's still an issue, feel free to share the data here.
import kats
from kats.utils.simulator import Simulator
from kats.detectors.hourly_ratio_detection import HourlyRatioDetector
sim = Simulator(n=4500, start='2020-01-01', freq='5T')
ts = sim.level_shift_sim(noise=0.05, seasonal_period=1)
d = HourlyRatioDetector(data=ts, freq='5T', aggregate='max')
d.detector()
However I'll leave this issue open to address the documentation mistake you pointed out. The aggregate
param should be required, not optional. Thanks for flagging that.
The HourlyRatioDetector
works with hourly data, i.e., if the input data is hourly, there is no need to aggregate it and that's why our default parameter is None.
When I did a pip install of Kats, this file was downloaded:
kats-0.2.0-py3-none-any.whl
I think it's the latest version of Kats (or at least, at that time).
My problem came up months ago, and since I needed a solution, I used method overloading to modify the tsatools function _freq_to_period_, which I discovered was the source of the error.
I described everything in my project repository, which can be found here (the descriptions are in Spanish, but the code is not. Search for elif freq == '5T'):
https://github.com/Antorminator/time-series-prediction
Regars!
Hello,
I am trying to detect anomalies in a dataset that contains, over a period of several days, measurements every 5 minutes.
I've seen that I can't use OutlierDetector because it doesn't support frequencies less than 1 day, so I'm trying to use HourlyRatioDetector.
I am trying to use it as follows:
But I am getting the following error:
I have also noticed that the freq and aggregate parameters, which according to the documentation are optional (https://facebookresearch.github.io/Kats/api/kats.detectors.hourly_ratio_detection.html) must be specified, so I don't know if I'm using an old version or something; I simply install Kats as follows:
!pip install kats
My dataset comes from a csv and I convert it to TimeSeriesData like this:
If it's a bug, I hope this helps to fix it.
Thanks. Greetings.