Learn R Programming

spectralAnomaly (version 0.1.1)

anomaly_score: Create anomaly score from input data

Description

Convert an input of numeric data, typically a time series, into a score for anomaly detection. The data is first extended to improve the detection latency, followed by saliency map creation. The score is calculated using the sliding window average for each point in the saliency map.

Usage

anomaly_score(x, score_window, spec_window = 3, m = 5)

Value

A numeric vector of anomaly scores.

Arguments

x

Numeric vector.

score_window

Integer value for the window width for scoring.

spec_window

Positive integer value for the window to calculate the averaged log spectrum.

m

Integer value representing the number of preceding points for the estimation.

Examples

Run this code
tmp <- ts(rnorm(12*6,10,2), start=c(2009, 1), end=c(2014, 12), frequency=12)
anomaly_score(tmp, score_window = 25)

Run the code above in your browser using DataLab