Intrusion and anomaly detection, malware analysis, threat intelligence, phishing, security logs and incident response: defensive experiments that really compute in your browser on synthetic data, with algorithms, datasets, projects and quizzes.
- Home
- AI Intrusion Detection
- Cyber Anomaly Detection
- Malware Analysis
- Cyber Threat Intelligence
- AI Network Security
- AI Phishing Detection
- AI Security Log Analytics
- AI Incident Response
- Algorithm Library
- Datasets Repository
- Learning Roadmap
- Projects
- Quizzes and Challenges
- Experiment Workbench
- Research and Metrics
- My experiments
- Scientific references
- Glossary and FAQ
K-means (distance to centroid)
Algorithm Library · Algorithm Unsupervised Learning Runs in the browser
The idea
Clusters data into k groups; points far from the nearest centroid are treated as anomalous.
The problem it addresses
Anomaly detection when normal behaviour has a few modes.
Data it needs
Scaled data.
Equations
\operatorname{score}(x)=\min_j\lVert x-\mu_j\rVert_2Steps
- Start from random centroids
- Assign each point to its nearest centroid
- Recompute the centroids
- Record the distance as the score
Pseudocode
repeat: assign = argmin_j ||x-mu_j||; mu_j = mean(X[assign==j])
score = min_j ||x-mu_j||Strengths
- Simple and fast
Limitations
- Assumes spherical clusters
- Sensitive to initialisation
Uses in cybersecurity
- Anomaly baseline
Common pitfalls
- The choice of k changes results sharply; try several.
Suggested datasets
Related experiments
References
- Chandola, Banerjee, Kumar (2009). Anomaly detection: A survey. ACM Computing Surveys 41(3), pp. 1-58. doi:10.1145/1541880.1541882
