O(n²) Anomaly Detectors: Why Distance Calculations Slow Them Down
Traditional anomaly detection algorithms like k-Nearest Neighbors (kNN), Local Outlier Factor (LOF), and One-Class SVM often exhibit O(n²) or higher computational complexity because they rely on calculating distances or densities between all data points, a process that scales poorly with increasing dataset size.
The top 3
- The Quadratic Cost of Pairwise Distance Calculations: For a dataset with 'n' points, calculating the distance between every possible pair of points fundamentally requires approximately n*(n-1)/2 operations, which results in O(n²) time complexity, rapidly increasing computation time as the dataset grows.
- Key Algorithms Slowed by Pairwise Distances: Several prominent anomaly detection and clustering algorithms, including k-Nearest Neighbors (k-NN), Local Outlier Factor (LOF), and DBSCAN, inherently rely on these O(n²) pairwise distance computations to find neighbors or estimate density.
- Curse of Dimensionality: Distance Metrics Lose Meaning: In high-dimensional spaces, a phenomenon known as the 'Curse of Dimensionality' causes distances between data points to converge to similar values, making traditional distance-based anomaly detection less effective and computationally more demanding.
Sources
Open the full topic