MhamedRayan commited on
Commit
74f7d41
·
verified ·
1 Parent(s): ad80727

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +43 -19
README.md CHANGED
@@ -16,31 +16,52 @@ Decision tree that turns two agent scores into a final verdict using a
16
  consensus + fail-safe policy. Part of a three-agent DevSecOps auditor
17
  (metrics → transformer → gatekeeper).
18
 
19
- > For a Hugging Face repo, upload this file as `README.md` alongside
20
- > `agent3_dt.joblib` and `agent3_dt.meta.json`.
21
 
22
- ## Files
23
-
24
- | File | Contents |
25
  |---|---|
26
- | `agent3_dt.joblib` | `model`, `feature_cols`, `classes`, `policy`, `source_thresholds` |
27
- | `agent3_dt.meta.json` | Policy, features, grid size, agreement, thresholds |
 
 
 
 
 
 
 
 
28
 
29
- ## Input
30
 
31
- Four features per sample:
32
 
33
  ```
34
- a1_high_risk # 1.0 if agent1_score >= agent1_threshold
35
- a2_vulnerable # 1.0 if agent2_score >= agent2_threshold
36
- a1_risk_ratio # agent1_score / agent1_threshold
37
- a2_risk_ratio # agent2_score / agent2_threshold
38
  ```
39
 
 
 
 
 
 
 
 
40
  ## Output
41
 
42
- One of `PASS`, `REVIEW`, `FAIL`, with the tree's class probability as
43
- `confidence`. That confidence is **not** calibrated.
 
 
 
 
 
 
 
 
 
44
 
45
  ## Policy
46
 
@@ -57,17 +78,20 @@ the policy rather than learning from ground truth. The reference wrapper adds a
57
  post-check that forces `REVIEW` on any tree/policy mismatch — keep it if you
58
  deploy this model.
59
 
 
 
 
60
  ## Usage
61
 
62
  ```python
63
  import joblib
64
 
65
- b = joblib.load("agent3_dt.joblib")
66
 
67
- a1_high = a1_score >= a1_threshold
68
- a2_high = a2_score >= a2_threshold
69
  x = [[float(a1_high), float(a2_high),
70
- a1_score / a1_threshold, a2_score / a2_threshold]]
71
 
72
  proba = b["model"].predict_proba(x)[0]
73
  verdict = b["classes"][int(proba.argmax())]
 
16
  consensus + fail-safe policy. Part of a three-agent DevSecOps auditor
17
  (metrics → transformer → gatekeeper).
18
 
19
+ ## Model details
 
20
 
21
+ | Field | Value |
 
 
22
  |---|---|
23
+ | Version | 1.0.0 (initial release) |
24
+ | Artifact | `model.joblib` (bundle: `model`, `feature_cols`, `classes`, `policy`, `source_thresholds`) |
25
+ | Task | 3-class tabular classification |
26
+ | Classes | `FAIL`, `PASS`, `REVIEW` |
27
+ | Own threshold | None — uses the upstream agent thresholds |
28
+ | Upstream thresholds | Agent 1 **0.3183**, Agent 2 **0.45** |
29
+ | Training data | Synthetic policy grid, seed 42 |
30
+ | Dataset version | Generator v1 — 45 ratios × 45 ratios × 4 quadrants = 8,100 rows |
31
+
32
+ `metadata.json` mirrors the policy, features, grid, and thresholds.
33
 
34
+ ## Input features
35
 
36
+ Four numeric features, **in this exact order**:
37
 
38
  ```
39
+ 1. a1_high_risk # 1.0 if agent1_score >= 0.3183
40
+ 2. a2_vulnerable # 1.0 if agent2_score >= 0.45
41
+ 3. a1_risk_ratio # agent1_score / 0.3183
42
+ 4. a2_risk_ratio # agent2_score / 0.45
43
  ```
44
 
45
+ ## Preprocessing
46
+
47
+ - Compute the two flags with the upstream thresholds above.
48
+ - Compute the two ratios as `score / threshold` (1.0 = exactly at the boundary).
49
+ - Keep the column order shown above; it must match `b["feature_cols"]`.
50
+ - On any error, missing value, or invalid score, output `REVIEW` directly.
51
+
52
  ## Output
53
 
54
+ Raw: `predict_proba(x)` returns probabilities for `["FAIL", "PASS", "REVIEW"]`
55
+ (the bundle's `classes` order). Take `argmax` for the verdict and `max` for
56
+ confidence.
57
+
58
+ Reference wrapper output:
59
+
60
+ ```json
61
+ {"verdict": "FAIL", "confidence": 1.0, "status": "ok", "reason": "both agents flagged risk"}
62
+ ```
63
+
64
+ `confidence` is the tree's class probability, **not** calibrated.
65
 
66
  ## Policy
67
 
 
78
  post-check that forces `REVIEW` on any tree/policy mismatch — keep it if you
79
  deploy this model.
80
 
81
+ Note: the saved `source_thresholds` fallback still lists Agent 2 as `0.51` from
82
+ an earlier run. Pass the current thresholds explicitly (`0.3183` / `0.45`).
83
+
84
  ## Usage
85
 
86
  ```python
87
  import joblib
88
 
89
+ b = joblib.load("model.joblib")
90
 
91
+ a1_high = a1_score >= 0.3183
92
+ a2_high = a2_score >= 0.45
93
  x = [[float(a1_high), float(a2_high),
94
+ a1_score / 0.3183, a2_score / 0.45]]
95
 
96
  proba = b["model"].predict_proba(x)[0]
97
  verdict = b["classes"][int(proba.argmax())]