|
Download README.md from MhamedRayan/devsecops-decision-tree: direct link, hf CLI and curl.
- Browser
- Download file 3.04 kB
-
https://huggingface.co/MhamedRayan/devsecops-decision-tree/resolve/main/README.md
- Command line
-
hf download hf://MhamedRayan/devsecops-decision-tree/README.md
-
curl -L -o README.md https://huggingface.co/MhamedRayan/devsecops-decision-tree/resolve/main/README.md
3.04 kB
| license: other | |
| library_name: scikit-learn | |
| pipeline_tag: tabular-classification | |
| tags: | |
| - cybersecurity | |
| - gatekeeper | |
| - decision-tree | |
| - scikit-learn | |
| - joblib | |
| # Agent 3 — Verdict Gatekeeper (Decision Tree) | |
| Decision tree that turns two agent scores into a final verdict using a | |
| consensus + fail-safe policy. Part of a three-agent DevSecOps auditor | |
| (metrics → transformer → gatekeeper). | |
| ## Model details | |
| | Field | Value | | |
| |---|---| | |
| | Version | 1.0.0 (initial release) | | |
| | Artifact | `model.joblib` (bundle: `model`, `feature_cols`, `classes`, `policy`, `source_thresholds`) | | |
| | Task | 3-class tabular classification | | |
| | Classes | `FAIL`, `PASS`, `REVIEW` | | |
| | Own threshold | None — uses the upstream agent thresholds | | |
| | Upstream thresholds | Agent 1 **0.3183**, Agent 2 **0.45** | | |
| | Training data | Synthetic policy grid, seed 42 | | |
| | Dataset version | Generator v1 — 45 ratios × 45 ratios × 4 quadrants = 8,100 rows | | |
| `metadata.json` mirrors the policy, features, grid, and thresholds. | |
| ## Input features | |
| Four numeric features, **in this exact order**: | |
| ``` | |
| 1. a1_high_risk # 1.0 if agent1_score >= 0.3183 | |
| 2. a2_vulnerable # 1.0 if agent2_score >= 0.45 | |
| 3. a1_risk_ratio # agent1_score / 0.3183 | |
| 4. a2_risk_ratio # agent2_score / 0.45 | |
| ``` | |
| ## Preprocessing | |
| - Compute the two flags with the upstream thresholds above. | |
| - Compute the two ratios as `score / threshold` (1.0 = exactly at the boundary). | |
| - Keep the column order shown above; it must match `b["feature_cols"]`. | |
| - On any error, missing value, or invalid score, output `REVIEW` directly. | |
| ## Output | |
| Raw: `predict_proba(x)` returns probabilities for `["FAIL", "PASS", "REVIEW"]` | |
| (the bundle's `classes` order). Take `argmax` for the verdict and `max` for | |
| confidence. | |
| Reference wrapper output: | |
| ```json | |
| {"verdict": "FAIL", "confidence": 1.0, "status": "ok", "reason": "both agents flagged risk"} | |
| ``` | |
| `confidence` is the tree's class probability, **not** calibrated. | |
| ## Policy | |
| | Agent 1 | Agent 2 | Verdict | | |
| |---|---|---| | |
| | low risk | not vulnerable | `PASS` | | |
| | high risk | vulnerable | `FAIL` | | |
| | high risk | not vulnerable | `REVIEW` | | |
| | low risk | vulnerable | `REVIEW` | | |
| | any error / missing / invalid input | | `REVIEW` | | |
| The tree is trained on a synthetic grid labelled by this policy, so it encodes | |
| the policy rather than learning from ground truth. The reference wrapper adds a | |
| post-check that forces `REVIEW` on any tree/policy mismatch — keep it if you | |
| deploy this model. | |
| Note: the saved `source_thresholds` fallback still lists Agent 2 as `0.51` from | |
| an earlier run. Pass the current thresholds explicitly (`0.3183` / `0.45`). | |
| ## Usage | |
| ```python | |
| import joblib | |
| b = joblib.load("model.joblib") | |
| a1_high = a1_score >= 0.3183 | |
| a2_high = a2_score >= 0.45 | |
| x = [[float(a1_high), float(a2_high), | |
| a1_score / 0.3183, a2_score / 0.45]] | |
| proba = b["model"].predict_proba(x)[0] | |
| verdict = b["classes"][int(proba.argmax())] | |
| confidence = float(proba.max()) | |
| ``` | |
| ## License | |
| Not specified. Update the `license` field before publishing. | |