EZ LearnEZ Learn
Courses
EZ Board
Dashboard
All articles
ml-for-cyber-securitymlcsrevisionself-study

Unit 6 Quick Reference, Self-Study and Lab

Every evaluation and adversarial idea from this unit in one table, followed by seven questions and a lab exercise: finding the exact threshold that gives at least 90 percent recall, and reporting what precision that recall actually costs.

Ashish Revar25 October 20266 min read

Unit Summary and Quick Reference

TopicCore idea
Why accuracy liesOn imbalanced data, a classifier that predicts the majority class scores high accuracy while catching nothing
Precision, recall, F1Built directly from the confusion matrix; precision and recall trade against each other by threshold
Adversarial attack taxonomyEvasion, poisoning, extraction, and inference, each targeting a different stage of the ML lifecycle
Three real incidentsGoodfellow's 2014 FGSM panda/gibbon result, the 2019 Cylance bypass, and the 2016 Microsoft Tay poisoning
NSL-KDD and CICIDS2017The field's two standard benchmarks; NSL-KDD is older and cleaner, CICIDS2017 is newer and more realistic
Threat intel automationThe same TF-IDF pipeline from Unit 5, applied to triaging incoming intelligence reports at scale

Self-Study Questions

Q1. Explain why a 99.8% accurate fraud classifier can still be a useless model, using precision and recall to make the argument precise.

A classifier that predicts "legitimate" for every single transaction in a dataset that is 99.8 percent legitimate scores 99.8 percent accuracy while having TP = 0: it never correctly flags a single fraudulent transaction. Its recall, TP / (TP + FN), is therefore 0, meaning it catches none of the actual fraud, which is the entire point of building the model. Accuracy alone hides this completely, while recall exposes it immediately.

Q2. Name and briefly describe the four categories of adversarial attack introduced in this unit.

Evasion modifies a malicious input at prediction time, just enough to cross the model's decision boundary, without changing what the input actually does. Poisoning corrupts the training data itself, so the model learns a flawed boundary before deployment. Model extraction repeatedly queries a deployed model to reconstruct a close copy of it without ever accessing its parameters. Model inversion or membership inference infers sensitive details about the training data itself from the model's outputs.

Q3. Using the three real incidents in this unit, match each one to the correct adversarial attack category from the taxonomy.

Goodfellow's 2014 panda-to-gibbon result and the 2019 Cylance bypass are both evasion attacks, since each one modified an input at prediction time to cross a trained model's decision boundary without changing the input's underlying function. The 2016 Microsoft Tay incident is a poisoning attack, since the chatbot's own training process was corrupted by coordinated malicious input it was learning from live.

Q4. Why does a strong result on NSL-KDD deserve more scrutiny today than the same result would have deserved in the early 2000s?

NSL-KDD's underlying traffic was captured during a 1998 DARPA evaluation and is now over two decades old; it does not reflect modern attack techniques or modern network protocols. A strong result on it today demonstrates that a model can learn that specific, dated dataset's patterns, not that it would perform well against current attack traffic, which is exactly why newer benchmarks like CICIDS2017 and UNSW-NB15 are now preferred for current research.

Q5. In this unit's real WAF evasion demo, the payload's score dropped from 0.9594 to 0.2836 by appending a single repeated character. Explain why this works, and which category in the adversarial taxonomy it belongs to.

The model had learned, from its training data, that a specific character n-gram was strongly associated with benign queries. Appending 150 copies of that character pulled the TF-IDF-weighted feature vector strongly toward the benign direction the model had learned, without altering the malicious XSS payload itself in any way that would stop it from executing. This is an evasion attack: the input was modified at prediction time, specifically to cross the decision boundary, while its underlying malicious function was left completely untouched.

Q6. Explain why the poisoning attack in this unit specifically depends on the model being retrained online with partial_fit, and name one other real system with this same exposure.

The attack works by repeatedly calling partial_fit with a small cluster of mislabelled chaff points, which only has an effect because the model keeps learning after its initial deployment rather than staying fixed. A model trained once and never retrained could not be bent this way by the same mechanism. Any system that retrains automatically on live, unvetted data carries the same exposure, for example a spam filter that learns from users' own "spam" or "not spam" clicks.

Q7. Describe, in your own words, how a precision-recall curve lets a team choose an operating threshold based on a business constraint (for example, "recall must be at least 90%") rather than an arbitrary default.

A precision-recall curve plots precision against recall at every possible decision threshold, so a team can start from a recall figure the business has decided it needs, such as catching at least 90 percent of real fraud, find the point or points on the curve that achieve at least that recall, and then read off the precision, and therefore the false-alarm rate, that recall actually costs at that threshold. This turns the threshold choice into an informed trade-off against a stated business requirement, rather than leaving the classifier at whatever default threshold, typically 0.5, happens to come out of the library.

Lab: Find Your Own Operating Point

  1. Train and score. Using any classifier from this course on a dataset with a rare positive class, such as the fraud or intrusion data from earlier units, compute precision_recall_curve exactly as shown in this unit.
  2. Set the business constraint. Decide on a minimum acceptable recall, such as 90%, matching the constraint this unit's own hands-on exercise used.
  3. Find the threshold. Search the thresholds array returned by precision_recall_curve for the threshold that first achieves your minimum recall, and report the exact precision at that threshold.
  4. Translate to a business statement. Convert the precision you found into a concrete operational statement, such as "at this threshold, roughly 1 in N flagged transactions is a false alarm," and state whether that false-alarm rate is realistic for a human team to review.
  5. Compare against average precision. Report the average_precision_score for your model and compare it to this unit's own real result (Random Forest AP = 0.54 against a random classifier's AP = 0.05) to judge how your model's overall ranking quality compares.

Related to this topic

Continue learning

Reference material

eBook

ML for Cyber Security eBook

v1.0

Open resource

Cheatsheet

ML for Cyber Security Cheatsheet

v1.0

Open resource

MCQ Bank

ML for Cyber Security MCQ Bank

v1.0

Open resource

Question Bank

ML for Cyber Security Question Bank

v1.0

Open resource

Discussion

Loading comments…
More articlesTest your knowledge
EZ MentorAI · Free

Unit 6 Quick Reference, Self-Study and Lab

Hi! I'm EZ Mentor

Your AI tutor for
Unit 6 Quick Reference, Self-Study and Lab

Sign in to ask, it's free.

EZ Mentor is AI-powered · Answers may not be perfect · 10 free questions / day

EZ Learn

Structured learning across Reverse Engineering, Cloud Security and Research Methodology, plus games and practice tools. Free, and open to anyone.

Learn

  • Courses
  • EZ Articles
  • EZ Watch
  • EZ Bytes
  • EZ Talks
  • Community

Library & Exams

  • All Resources
  • eBooks & PDFs
  • Question Banks
  • Cheatsheets
  • All Exams
  • EZ Board

EZ Arena

  • EZ Games
  • Byte Rush
  • Firewall Defence
  • 3D Case Files
  • Live Quiz
  • ML Challenges

EZ Cyber Hygiene

  • Hygiene Journey
  • Cyber Safety Check
  • दिशा - Hygiene
  • सजग - Awareness
  • अभ्यास - Practice
  • Scammed? Call 1930

Platform

  • About
  • Contact
  • Events
  • Verify Certificate
  • Terms of Use
  • Disclaimer

© 2026 EZ Learn by EpochZero. Educational content for learning purposes.

Platform Lead: Ashish Revar