Diagnosing Traffic Anomalies Using a Two-Phase Model