Follow a seven-step evaluation that predicts real-world behaviour.

This is the most reusable procedure in the whole course. It is drawn from the recurring mistakes catalogued across security machine learning research (Arp et al., 2022). Each step prevents a specific, expensive failure.

  1. State the alert budget. Agree how many alerts a day the team can investigate. Prevents: buying a model nobody can operate.
  2. Estimate the base rate. Measure how rare the target really is in your own traffic. Prevents: the 99.7% accuracy trap.
  3. Split by time, not at random. Train on earlier data and test on strictly later data. Prevents: results that look far better than reality. DNS data is heavily time-correlated, so a random split leaves near-duplicates on both sides. It is like studying with tomorrow’s exam paper.
  4. Keep the real class balance. Test on production proportions, not a balanced sample. Prevents: a flattering test set. Evaluating a rare-event detector on a fifty-fifty sample tells you almost nothing about behaviour when the target is one in ten thousand.
  5. Report precision at your budget. Fix the alert volume, then ask how many of those alerts are true. Prevents: headline accuracy hiding an unusable operating point. This single number decides whether the system survives contact with an on-call team.
  6. Beat the cheap baseline. Compare with a blocklist plus a threshold on the same data. Prevents: complexity that adds cost and no detection.
  7. Re-test on later traffic. Evaluate again on a window the model has never seen. Prevents: silent decay as attacker behaviour and traffic mix drift.

Take any DNS detection claim you have been shown, whether from a vendor, a blog post or an internal prototype, and check it against steps 1, 2, 4 and 5. Write down which of the four it fails. Most claims fail at least two, and the exercise takes ten minutes rather than a whole procurement cycle.