Skip to main content

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 name riskengine onto the pre-existing risk-engine project (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

AGPL-3.0-or-later.

Built by

Ayush Gupta.

Metadata

Release files for scamvet-riskengine 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scamvet-riskengine 0.1.0
File Size Uploaded
scamvet_riskengine-0.1.0.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for scamvet-riskengine 0.1.0
File Interpreter ABI Platform
scamvet_riskengine-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / scamvet_riskengine-0.1.0.tar.gz

Download URL scamvet_riskengine-0.1.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
6857cf962326bbe336d115b09c2427c8e145b7bd34f68630b6bd9f2fd6c67961
BLAKE2b-256 checksum
How to use checksums
5b341154c2ea284ec43bf25c9742b8efb8860e4f60995909197e9b5be194d68d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / scamvet_riskengine-0.1.0-py3-none-any.whl

Download URL scamvet_riskengine-0.1.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
154f44c1a90d8cdc7772445d8d6d28a3e754ef74682c00d1cf92de8d9c9427ef
BLAKE2b-256 checksum
How to use checksums
c41c5fca77a15dc313151f41097964a54b41c59416df182b1c74c7542e6d0a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page