-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathifa_example_basic.py
More file actions
42 lines (37 loc) · 1.14 KB
/
ifa_example_basic.py
File metadata and controls
42 lines (37 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Minimal IFA example with mixed risk and protective factors.
"""
from ifa import Evidence, impact_forecast
prior = 0.20
evidence = {
"kev_exposed": Evidence(
lr=1.8,
note="Known exploited vulns on edge devices",
),
"flat_network": Evidence(
lr=1.5,
note="Lack of segmentation enables lateral movement",
),
"phishing_resistant_mfa": Evidence(
lr=0.65,
note="FIDO2/WebAuthn for admins",
),
"tested_backup_recovery": Evidence(
lr=0.75,
note="Quarterly tested backup/recovery",
),
}
results = impact_forecast(prior_p=prior, evidence=evidence)
print("=" * 60)
print("IFA BASIC EXAMPLE")
print("=" * 60)
print(f"Prior probability: {results['prior_probability']:.1%}")
print(f"Posterior probability: {results['posterior_probability']:.1%}")
print(f"Absolute change: {results['absolute_change']:+.1%}")
print(f"Risk level: {results['risk_level']}")
print("-" * 60)
print("Factor log:")
for f in results["factors"]:
direction = "risk" if f["lr"] > 1 else "protective"
print(f" {f['name']:25s} LR={f['lr']:.2f} ({direction})")
print("=" * 60)