Calibrated phishing and fraud risk scoring with TreeSHAP reasons and a versioned model registry.
Project description
RiskEngine
Calibrated phishing and fraud risk scoring with TreeSHAP reasons and a versioned model registry — the scoring library behind ScamVet.
pip install scamvet-riskengine
Install string note: the PyPI distribution is
scamvet-riskengine(import scamvet_riskengine). PyPI normalizes the bare nameriskengineonto the pre-existingrisk-engineproject (PEP 503), which hard-blocks it — so the library is brand-scoped. The repo and product name stay "RiskEngine." See ADR-003.
Quick start
from scamvet_riskengine import load
scorer = load("url-scorer-lexical")
result = scorer.score("http://sbi-kyc-verify.xyz/login/update")
print(result.band, result.probability) # amber 0.9021
for reason in result.reasons:
print(reason.template_key, reason.direction, reason.magnitude)
Install profiles
| Command | Adds | Gives you |
|---|---|---|
pip install scamvet-riskengine |
onnxruntime | Scoring, bands, calibrated probabilities |
pip install "scamvet-riskengine[explain]" |
xgboost | TreeSHAP reasons on every verdict |
pip install "scamvet-riskengine[train]" |
lightgbm, scikit-learn, imbalanced-learn, ONNX exporters | Reproducing the benchmarks |
Inference runs on ONNX rather than the training library, so the default install
stays small and the Python path scores through the same artifact the browser and
the Android app do. Without [explain] a verdict carries no reasons and sets the
explanations_unavailable flag — an empty reasons list is never silently
ambiguous.
What ships
url-scorer-lexical 0.1.0 — XGBoost (200 trees, depth 8), exported to a 1,408 KB
ONNX artifact with verified parity, Platt-calibrated, with per-use-case verdict
bands and exact TreeSHAP attributions mapped to versioned reason templates.
| Figure | Value |
|---|---|
| Phishing recall @ 5% FPR | 0.706 ± 0.011 (3 seeds) |
| Phishing PR-AUC | 0.814 ± 0.000 |
| Intrinsic-feature floor | 0.230 ± 0.016 |
| False positives on known-legitimate domains | 3 of 55, all amber |
| Training set | 651,191 rows, CC0 |
| Feature spec | url_lexical_v5, 34 columns, scheme-invariant |
Every model carries a manifest recording its corpus, licence row, feature spec, calibration state, thresholds and the library versions its features were extracted with — because a model file without one cannot be reproduced, audited or safely consumed.
The intrinsic-feature floor
Three features in earlier spec versions encoded which source file a row came
from rather than anything about the address. The worst was invisible to feature
review: url_length counted the https:// prefix, and since most corpus rows
carry no scheme while every real user pastes one, the same bank domain scored
0.018 or 0.985 depending on how it was written. No metric on 86,115 held-out
rows could catch it — train and test shared the convention. It was found by
scoring 55 domains already known to be legitimate.
Every headline number here is therefore published beside an intrinsic-feature floor measured on the semantic-only subset, and a false-positive check against known-legitimate domains runs at publish time.
Corpus and licensing
Two tracks, per ADR-007. The product track — everything distributed in this package — trains on the CC0 malicious-URL corpus alone. The research track (Bank Account Fraud, IEEE-CIS, PaySim; ~13.6M rows, largely synthetic) is used for benchmarking and fairness work published as notebooks, and is never shipped in a model artifact. Every dataset is credited with source, author, licence and link in LEGAL.md.
Status
0.1.0. The product scorer, registry, calibration, TreeSHAP reasons and provenance audit are shipped. Imbalance study, the BAF fairness report across six bias-controlled variants, and published Kaggle notebooks are in progress.
Contributing
See CONTRIBUTING.md. CLA required (one click, first PR).
License
Built by
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scamvet_riskengine-0.1.0.tar.gz.
File metadata
- Download URL: scamvet_riskengine-0.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6857cf962326bbe336d115b09c2427c8e145b7bd34f68630b6bd9f2fd6c67961
|
|
| MD5 |
c930e5916f534d8b86b90aa0f7e74e35
|
|
| BLAKE2b-256 |
5b341154c2ea284ec43bf25c9742b8efb8860e4f60995909197e9b5be194d68d
|
File details
Details for the file scamvet_riskengine-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scamvet_riskengine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
154f44c1a90d8cdc7772445d8d6d28a3e754ef74682c00d1cf92de8d9c9427ef
|
|
| MD5 |
0d41c203541b2d9a1ca94ba15be81dbb
|
|
| BLAKE2b-256 |
c41c5fca77a15dc313151f41097964a54b41c59416df182b1c74c7542e6d0a16
|