Univariate detector#

KNNCAD Detector#

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

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

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)

Spot Detector#

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)

RRCF Detector#

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

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

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)

Spectral Residual Detector#

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

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

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)

Z-score Detector#

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

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

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)