Anomaly detection code basic