Online Algorithms

We provide online some functions, which are tuned to allocate minimal amounts of memory. Implemented so far:

  • Euclidean distance
  • Sigma estimation for KDE / REC
  • KDE
  • REC
  • KNN-Gamma

Functions

MultivariateAnomalies.Euclidean_distance!Function
Euclidean_distance!{tp}(d::Array{tp, 1}, x::AbstractArray{tp, 2}, i::Int, j::Int, dim::Int = 1)

compute the Euclidean distance between x[i,:] and x[j,:] and write the result to d. Memory efficient. dim is the dimension of i and j.

source
MultivariateAnomalies.SigmaOnline!Function
SigmaOnline!{tp}(sigma::Array{tp, 1}, x::AbstractArray{tp, 2}, [Q::AbstractArray{tp, 2}], samplesize::Int = 250, dim::Int = 1)

compute sigma parameter as mean of the distances of samplesize randomly sampled points along dim. If Q is given the Mahalanobis distance is used instead of Euclidean.

source
MultivariateAnomalies.KDEonline!Function
KDEonline!{tp}(kdescores::AbstractArray{tp, 1}, x::AbstractArray{tp, 2} [, Q::AbstractArray{tp, 2}], σ::tp, dim::Int = 1)

compute (1.0 - Kernel Density Estimates) from x and write it to kdescores with dim being the dimension of the observations. If teh covariance matrix Q is given, the Mahalanobis distance is used instead of the Euclidean distance.

source
MultivariateAnomalies.REConline!Function
REConline!{tp}(recscores::AbstractArray{tp, 1}, x::AbstractArray{tp, 2} [, Q::AbstractArray{tp, 2}], ɛ::tp, dim::Int = 1)

compute recurrence scores from x and write it to recscores with dim being the dimension of the observations. If the covariance matrix Q is given, the mahalanobis distance is used instead of the euclidean distance.

source
MultivariateAnomalies.KNNonline!Function
KNNonline!{tp}(knnscores::AbstractArray{tp, 1}, x::AbstractArray{tp, 2}, [Q::AbstractArray{tp, 2},] k::Int, dim::Int = 1)

compute k-nearest neighbor (gamma) scores from x and write it to knnscores with dim being the dimension of the observations. If the covariance matrix Q is given, the mahalanobis distance is used instead of the euclidean distance.

source

Index