user10579573
user10579573

Reputation:

Anomaly Detection & ADTK- Series does not follow any known frequency

I have a Time series of this kind:

timestamp

2019-05-31 16:30:00    94.400000

2019-05-31 16:35:00    92.533333

2019-05-31 16:40:00    93.900000

2019-05-31 16:45:00    93.400000

2019-05-31 16:50:00    93.166667

...

I would like to use Adtk to perform unsupervised anaomaly detection. I've been resampling the historical series every five minutes, but I keep getting the same mistake.

temperatura27 = temperatura27.resample('5T').mean().dropna()
from adtk.detector import SeasonalAD
seasonal_ad = SeasonalAD()
anomalies = seasonal_ad.fit_detect(temperatura27)
plot(temperatura27, anomaly=anomalies, anomaly_color="red", anomaly_tag="marker")
RuntimeError: Series does not follow any known frequency (e.g. second, minute, hour, day, week, month, year, etc.

Upvotes: 2

Views: 2042

Answers (2)

myuce
myuce

Reputation: 1391

Taking from where vovi left off;

If the data has missing rows, then resampling may help.

For the latest version of adtk;

s_train = s_train.resample("15m").sum()

If using an older version of adtk (in its latest version, adtk resampling is dropped in favor of panda's), adtk has a resampling method;

from adtk.data import resample
s_train = resample(s_train, dT="15 min")

Upvotes: 0

vovi4
vovi4

Reputation: 11

you should carefully look at your data, maybe there is some missing point. For example, if there is data with a discreteness of 1 minute and the point with a time of "15:23" falls out, you will get exactly this error: "Series does not follow any known frequency (e.g. second, minute, hour, day, week, month, year, etc."

2020-10-16 15:21:00,5.9357
2020-10-16 15:22:00,3.8873
2020-10-16 15:24:00,5.313
2020-10-16 15:25:00,5.5147

Upvotes: 1

Related Questions