Capstone project · Software Engineering · MedTech, Tunis

Six anomaly detectors, two datasets, one uncomfortable result: the rankings don't transfer.

A controlled, leakage-free benchmark of six one-class classifiers for network intrusion detection — trained on benign traffic only, thresholded on a held-out validation split, and evaluated once on frozen test sets from UNSW-NB15 and CIC-IDS-2018.

models 6 + ensemble datasets UNSW-NB15 · CIC-IDS-2018 threshold Youden's J, frozen training data benign only
0.9277
Best AUC-ROC — Autoencoder on CIC-IDS-2018, with F1 0.9263 at the frozen threshold
7 → 2
Biggest rank swap — PCA-RE goes from last on UNSW-NB15 to second on CIC-IDS-2018
−17.4 pts
AUC lost by naïve score-averaging ensemble vs. the best single model on CIC-IDS-2018
1 / 6
Only the Autoencoder stays in the top two on both datasets and both metrics
01 / RQ2

Rank instability across datasets

Each line is one detector. Left: its AUC-ROC rank on UNSW-NB15. Right: its rank on CIC-IDS-2018. If benchmark results generalized, the lines would be horizontal. They are not.

Why this matters

A large share of NIDS papers report results on a single dataset and imply the conclusions travel. This benchmark measures how far they actually travel: under identical preprocessing, splits and thresholding, only one detector keeps its position.

// hover or tap a line for details

PCA Reconstruction Error is the extreme case: rank 7 on UNSW-NB15 (AUC 0.6445) but rank 2 on CIC-IDS-2018 (AUC 0.7791) — the near-linear structure of CICFlowMeter features suits a linear method.
02 / RQ1 · RQ3

Test-set performance

AUC-ROC gives the threshold-independent view; F1 is measured at the Youden's J threshold frozen on validation. The two views need not agree — on UNSW-NB15 the Autoencoder wins AUC while Isolation Forest takes the best F1.

AUC-ROC by detector

UNSW-NB15AUCF1Rank
CIC-IDS-2018AUCF1Rank

MCD on CIC-IDS-2018 is the cautionary row: F1 0.8413 next to AUC 0.6288 — a lucky operating point on a weak score. Reporting F1 alone would have hidden it.

03 / per-category

Global metrics hide complementary blind spots

Detection rate per attack category on UNSW-NB15, at each detector's frozen operating point. The global winner misses what weaker detectors catch — 82% of Reconnaissance and 94% of Shellcode slip past the Autoencoder.

MCD's higher category recall comes at the price of a much higher global false-positive rate — there is no free lunch at a single operating point.

04 / protocol

A leakage-free evaluation protocol

Every detector runs through the same pipeline. Nothing downstream of the split ever sees test data, and nothing in preprocessing ever sees an attack.

Split first

Benign traffic split into train / validation before any statistic is computed. Test sets frozen and untouched until the final run.

Fit on benign only

log1p transform, frequency encoding and quantile clipping fitted exclusively on benign training data — no attack ever leaks into preprocessing.

Train one-class models

Six detectors — Autoencoder, Deep SVDD, Isolation Forest, OC-SVM, PCA-RE, MCD — learn only what "normal" looks like.

Freeze the threshold

Youden's J selected on a held-out validation split, then frozen. Test-time metrics are measured at that operating point, never tuned on test.

⊘

Why the ceremony? Several published NIDS results tune thresholds on the test set, which inflates operating-point metrics. Freezing the threshold on validation makes the reported F1, FPR and FNR honest estimates of deployment behaviour — the numbers here are lower than some published figures by design.

05 / takeaways

What the benchmark actually says

Weak assumptions travel best

The Autoencoder is the only detector in the top two on both datasets. Its inductive bias — learn whatever non-linear structure normal traffic has — is the least committal, and it generalizes best.

AE: 0.8494 / 0.9277 AUC

Deep ≠ better, silently

Deep SVDD partially collapses on CIC-IDS-2018: correlated features let the encoder map everything near the centre. The failure is invisible without inspecting training curves — the AUC still looks respectable.

FPR 8.2% but FNR 46.6%

Naïve ensembles hurt

Averaging normalized scores across all six detectors loses to the best single model on both datasets. Weak members drag the score down; diversity alone is not a strategy.

−4.5 pts UNSW · −17.4 pts CIC

Base rates are brutal

Even the best detector's 6% FPR means roughly 60,000 false alerts per million benign flows per day. Anomaly-based NIDS is a triage layer, not a verdict.

~60k FP / 1M flows / day

Cost varies by 100×+

OC-SVM needs ~400 s to train on CIC-IDS-2018 where PCA-RE needs 2.3 s — for a worse AUC. Compute cost and detection quality are uncorrelated in this benchmark.

400 s vs 2.3 s

Report both metric families

AUC and F1 crown different winners on UNSW-NB15, and F1 alone flatters MCD on CIC-IDS-2018. Threshold-independent and operating-point metrics must be reported together.

AUC + F1/FPR/FNR, always