~/ learn/ comp-400/ cards/ The base-rate fallacy and NIDS alarm probability
1 of 6

Enumerate all 64 outcomes of the three-node NIDS and compute P(High given at least one node reports S2) as an exact fraction.

Enumerate all 64 outcomes of the three-node NIDS and compute P(High given at least one node reports S2) as an exact fraction.

Answer

from fractions import Fraction from itertools import product SIGNATURES = ("S1", "S2", "S3", "S4") def classify(outcome): n = {s: outcome.count(s) for s in SIGNATURES} if n["S1"] == 2 and n["S3"] == 1: return "Low" if n["S2"] == 2 and n["S3"] == 1: return "Medium" if n["S4"] == 2 and n["S2"] == 1: return "High" if n["S4"] == 3: return "Very High" return "unclassified" space = list(product(SIGNATURES, repeat=3)) high = [o for o in space if classify(o) == "High"] seen_p3 = [o for o in space if "S2" in o] both = [o for o in high if "S2" in o] print("sample space :", len(space)) print("High outcomes :", len(high)) print("outcomes with >=1 S2 :", len(seen_p3)) print("High and >=1 S2 :", len(both)) posterior = Fraction(len(both), len(seen_p3)) print("P(High | >=1 S2) =", posterior, "=", "%.4f" % float(posterior))

Stallings & Brown, Computer Security 5e, ch8 §8.2

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/f4a59ff1-cd80-4728-bb4a-568095100e36/flashcard utf-8 LF