← back to projects
~/projects/ml-intrusion-detector

ml-intrusion-detector

An end-to-end network intrusion detection pipeline, the kind a SOC uses to flag suspicious traffic. It combines an unsupervised detector for unknown attacks with a supervised one for known patterns, and shows why default settings silently lie about performance.

View on GitHub ↗

0.93F1 after tuning
0.97ROC-AUC
0.94F1 on UNSW-NB15
405knetwork flows

01. pipeline

raw flows ─► encode + scale ─┬─► Isolation Forest  (unsupervised · unknown attacks)
                             └─► XGBoost           (supervised · known patterns)
                                      │
                         PR-curve threshold tuning ─► stacking ─► multi-class triage
                                                                 (DoS · Probe · R2L · U2R)

02. the silent failure

A model with 0.97 ROC-AUC can still miss a third of attacks at the default 0.5 threshold. Flip the switch.

03. binary results on NSL-KDD

modelaccuracyF1ROC-AUC
Isolation Forest0.830.870.94
XGBoost (default)0.810.800.97
XGBoost (tuned)0.920.930.97
Stacking IF + XGB0.810.800.95

Re-applied to UNSW-NB15, the same method reaches F1 0.94 with an opposite optimal threshold (0.90 vs 0.0001): the approach generalizes by adapting to each dataset's bias.