Start once detection within few lines of code.

Univariate time series#

Detection, evaluation and visualization. Note that the gray line is the ground truth of anomalies.

from streamad.util import StreamGenerator, UnivariateDS, plot
from streamad.model import SpotDetector

ds = UnivariateDS()
stream = StreamGenerator(ds.data)
model = SpotDetector()

scores = []

for x in stream.iter_item():
    score = model.fit_score(x)
    # print("\r Anomaly score: {}".format(score), end="", flush="True")

data, label, date, features = ds.data, ds.label, ds.date, ds.features