Upload folder using huggingface_hub
Browse files- README.md +79 -0
- metadata.json +29 -0
- model.joblib +3 -0
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
library_name: scikit-learn
|
| 4 |
+
pipeline_tag: tabular-classification
|
| 5 |
+
tags:
|
| 6 |
+
- cybersecurity
|
| 7 |
+
- gatekeeper
|
| 8 |
+
- decision-tree
|
| 9 |
+
- scikit-learn
|
| 10 |
+
- joblib
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Agent 3 — Verdict Gatekeeper (Decision Tree)
|
| 14 |
+
|
| 15 |
+
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 |
+
|
| 47 |
+
| Agent 1 | Agent 2 | Verdict |
|
| 48 |
+
|---|---|---|
|
| 49 |
+
| low risk | not vulnerable | `PASS` |
|
| 50 |
+
| high risk | vulnerable | `FAIL` |
|
| 51 |
+
| high risk | not vulnerable | `REVIEW` |
|
| 52 |
+
| low risk | vulnerable | `REVIEW` |
|
| 53 |
+
| any error / missing / invalid input | | `REVIEW` |
|
| 54 |
+
|
| 55 |
+
The tree is trained on a synthetic grid labelled by this policy, so it encodes
|
| 56 |
+
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())]
|
| 74 |
+
confidence = float(proba.max())
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## License
|
| 78 |
+
|
| 79 |
+
Not specified. Update the `license` field before publishing.
|
metadata.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"policy": "consensus_fail_safe",
|
| 3 |
+
"features": [
|
| 4 |
+
"a1_high_risk",
|
| 5 |
+
"a2_vulnerable",
|
| 6 |
+
"a1_risk_ratio",
|
| 7 |
+
"a2_risk_ratio"
|
| 8 |
+
],
|
| 9 |
+
"classes": [
|
| 10 |
+
"FAIL",
|
| 11 |
+
"PASS",
|
| 12 |
+
"REVIEW"
|
| 13 |
+
],
|
| 14 |
+
"max_depth": 3,
|
| 15 |
+
"seed": 42,
|
| 16 |
+
"grid": {
|
| 17 |
+
"ratio_min": 0.0,
|
| 18 |
+
"ratio_max": 2.0,
|
| 19 |
+
"ratios": 45,
|
| 20 |
+
"rows": 8100
|
| 21 |
+
},
|
| 22 |
+
"policy_agreement": 1.0,
|
| 23 |
+
"train_accuracy": 1.0,
|
| 24 |
+
"source_thresholds": {
|
| 25 |
+
"agent1": 0.3182926377275692,
|
| 26 |
+
"agent2": 0.5099999999999998
|
| 27 |
+
},
|
| 28 |
+
"note": "Synthetic policy grid; the tree encodes the consensus policy, not ground-truth verdicts."
|
| 29 |
+
}
|
model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5508cbc56b41660f0fbc2e6eea7f9caf9612ae511084b956fd2c17eb179b083
|
| 3 |
+
size 2244
|