Learn R Programming

harbinger (version 1.2.727)

hanr_ml: Anomaly detector based on machine learning regression.

Description

Anomaly detection using daltoolbox regression The regression model adjusts to the time series. Observations distant from the model are labeled as anomalies. A set of preconfigured regression methods are described in https://cefet-rj-dal.github.io/daltoolbox/. They include: ts_elm, ts_conv1d, ts_lstm, ts_mlp, ts_rf, ts_svm

Usage

hanr_ml(model, sw_size = 15)

Value

hanr_ml object

Arguments

model

DALToolbox regression model

sw_size

sliding window size

Examples

Run this code
library(daltoolbox)
library(tspredit)

#loading the example database
data(examples_anomalies)

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

# setting up time series regression model
model <- hanr_ml(tspredit::ts_elm(tspredit::ts_norm_gminmax(),
                  input_size=4, nhid=3, actfun="purelin"))

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

detection <- detect(model, dataset$serie)

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

Run the code above in your browser using DataLab