Learn R Programming

harbinger (version 1.2.767)

han_autoencoder: Anomaly detector using autoencoders

Description

Trains an encoder-decoder (autoencoder) to reconstruct sliding windows of the series; large reconstruction errors indicate anomalies.

Usage

han_autoencoder(input_size, encode_size, encoderclass = autoenc_base_ed, ...)

Value

han_autoencoder object

Arguments

input_size

Integer. Input (and output) window size for the autoencoder.

encode_size

Integer. Size of the encoded (bottleneck) representation.

encoderclass

DALToolbox encoder-decoder constructor to instantiate.

...

Additional arguments forwarded to encoderclass.

References

  • Sakurada M, Yairi T (2014). Anomaly Detection Using Autoencoders with Nonlinear Dimensionality Reduction. MLSDA 2014.

Examples

Run this code
library(daltoolbox)
library(tspredit)

# Load anomaly example data
data(examples_anomalies)

# Use a simple example
dataset <- examples_anomalies$simple
head(dataset)

# Configure an autoencoder-based anomaly detector
model <- han_autoencoder(input_size = 5, encode_size = 3)

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

# Run detection
detection <- detect(model, dataset$serie)

# Inspect detected anomalies
print(detection[detection$event, ])

Run the code above in your browser using DataLab