Dataset Usage#
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)
scores.append(score)
data, label, date, features = ds.data, ds.label, ds.date, ds.features
plot(data=data,scores=scores,date=date,features=features,label=label)