
Autoencoder anomaly detection (Geron Ch 8, morie.fn hmanae)
Source:R/geron_ml_native.R
morie_geron_anomaly_autoencoder.RdFlags rows whose squared reconstruction error exceeds threshold;
with no threshold the empirical quantile of the errors is used,
which calibrates the detector on the data being scored.
Examples
zero <- function(A) matrix(0, nrow(as.matrix(A)), ncol(as.matrix(A)))
morie_geron_anomaly_autoencoder(zero, matrix(c(0, 3, 1, 5), ncol = 1),
quantile = 0.6)
#> $errors
#> [1] 0 9 1 25
#>
#> $is_anomaly
#> [1] FALSE TRUE FALSE TRUE
#>
#> $threshold
#> [1] 7.4
#>
#> $threshold_calibrated
#> [1] TRUE
#>
#> $n_anomalies
#> [1] 2
#>
#> $reconstruction
#> [,1]
#> [1,] 0
#> [2,] 0
#> [3,] 0
#> [4,] 0
#>
#> $estimate
#> [1] 8.75
#>
#> $n
#> [1] 4
#>
#> $method
#> [1] "Autoencoder anomaly detection by squared reconstruction error"
#>