hanct_kmeans: Anomaly detector using kmeans

View source: R/hanct_kmeans.R

hanct_kmeansR Documentation

Anomaly detector using kmeans

Description

Anomaly detection using kmeans The kmeans is applied to the time series. When seq equals one, observations distant from the closest centroids are labeled as anomalies. When seq is grater than one, sequences distant from the closest centroids are labeled as discords. It wraps the kmeans presented in the stats library.

Usage

hanct_kmeans(seq = 1, centers = NA)

Arguments

seq

sequence size

centers

number of centroids

Value

hanct_kmeans object

Examples

library(daltoolbox)

#loading the example database
data(examples_anomalies)

#Using simple example
dataset <- examples_anomalies$simple
head(dataset)

# setting up time series regression model
model <- hanct_kmeans()

# fitting the model
model <- fit(model, dataset$serie)

detection <- detect(model, dataset$serie)

# filtering detected events
print(detection[(detection$event),])


harbinger documentation built on June 22, 2024, 7:38 p.m.