
Linear-autoencoder reconstruction-error anomaly score
Source:R/misc_native.R
morie_autoencoder_anomaly.RdFits a rank-k linear bottleneck by gradient descent with re-orthonormalisation, and scores each row by its squared reconstruction error.
Usage
morie_autoencoder_anomaly(
X,
k = 2,
n_iter = 300,
lr = 0.05,
seed = 0,
contamination = 0.05
)Details
In the linear case this IS PCA reconstruction error – the optimum spans the leading k principal directions – which is worth knowing before reaching for a deep autoencoder that may be doing the same thing more slowly.
The anomalies are in the TRAINING data, so more bottleneck capacity makes detection worse rather than better: at k = d the reconstruction is exact and every error is zero. Keep k well below the intrinsic dimension.