{"id":50684083,"url":"https://github.com/praveenpolisetty/fraudcost","last_synced_at":"2026-06-08T21:02:00.825Z","repository":{"id":362485744,"uuid":"1259312201","full_name":"praveenpolisetty/fraudcost","owner":"praveenpolisetty","description":"...","archived":false,"fork":false,"pushed_at":"2026-06-04T11:59:31.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-04T13:16:19.344Z","etag":null,"topics":["anti-money-laundering","calibration","cost-sensitive-learning","financial-ml","fraud-detection","imbalanced-classification","machine-learning","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/praveenpolisetty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-04T11:38:10.000Z","updated_at":"2026-06-04T11:59:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/praveenpolisetty/fraudcost","commit_stats":null,"previous_names":["praveenpolisetty/fraudcost"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/praveenpolisetty/fraudcost","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenpolisetty%2Ffraudcost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenpolisetty%2Ffraudcost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenpolisetty%2Ffraudcost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenpolisetty%2Ffraudcost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praveenpolisetty","download_url":"https://codeload.github.com/praveenpolisetty/fraudcost/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praveenpolisetty%2Ffraudcost/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34080026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anti-money-laundering","calibration","cost-sensitive-learning","financial-ml","fraud-detection","imbalanced-classification","machine-learning","python"],"created_at":"2026-06-08T21:01:58.688Z","updated_at":"2026-06-08T21:02:00.817Z","avatar_url":"https://github.com/praveenpolisetty.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fraudcost — cost-aware thresholding \u0026 calibration for fraud models\n\n[![CI](https://github.com/praveenpolisetty/fraudcost/actions/workflows/ci.yml/badge.svg)](https://github.com/praveenpolisetty/fraudcost/actions/workflows/ci.yml)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.20541781.svg)](https://doi.org/10.5281/zenodo.20541781)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](#install)\n\n**Your fraud model is probably pointed at the wrong number.** Most detectors are tuned for AUC, but a\ndeployed system decides at a threshold where the two kinds of error cost very different amounts.\n`fraudcost` is a tiny, dependency-light library that takes any classifier's scores and gives you:\n\n- **Example-dependent cost** scoring (false negative = transaction amount, false positive = admin cost),\n- **Probability calibration** (Platt / isotonic) so scores behave like probabilities,\n- **Cost-optimal threshold** selection, and\n- The **cost-vs-recall operating curve** that makes the trade-off legible.\n\nNo new model. It wraps the scores you already have.\n\n\u003e Companion research: *Paying for Precision: A Cost-Aware Evaluation of Card-Fraud Models on the\n\u003e IEEE-CIS Benchmark* (paper in preparation). Reproduces the paper's numbers via `examples/ieee_cis.py`.\n\n## Install\n```bash\npip install fraudcost          # once published\n# or, from source:\npip install -e .\n```\n\n## Quickstart\n```python\nimport numpy as np\nfrom fraudcost import CostModel, best_threshold, calibrate, cost_recall_curve\n\n# y: 0/1 labels, scores: model probabilities, amounts: transaction amounts\ncm = CostModel(admin_cost=5.0)                      # $5 per review (false positive / flagged)\ncal = calibrate(scores_calib, y_calib, method=\"isotonic\")\nscores_cal = cal(scores_test)\n\nt = best_threshold(y_calib, cal(scores_calib), amounts_calib, cm)   # pick on calib slice\nreport = cm.evaluate(y_test, scores_cal, amounts_test, t)           # apply to test\nprint(report)        # {'cost': ..., 'false_positives': ..., 'recall': ..., 'threshold': t}\n\ncurve = cost_recall_curve(y_test, scores_cal, amounts_test, cm)     # for plotting\n```\n\n## Why it exists\nCalibration and cost-sensitive thresholding are two decades old (Elkan 2001; Zadrozny \u0026 Elkan 2002;\nBahnsen et al. 2015), yet they rarely make it into how fraud models are *evaluated and reported*, where\nAUC still rules. `fraudcost` makes the cost-aware lens a one-import step so teams can recalibrate and\nrethreshold often — cheap, fast, and far less risky than retraining.\n\n## API\n| Function | Purpose |\n|----------|---------|\n| `CostModel(admin_cost, fn_cost=\"amount\")` | defines the example-dependent cost matrix |\n| `calibrate(scores, y, method)` | returns a calibration map (`\"platt\"` or `\"isotonic\"`) |\n| `best_threshold(y, scores, amounts, cost_model)` | cost-minimizing threshold |\n| `CostModel.evaluate(y, scores, amounts, t)` | cost / FP / recall at a threshold |\n| `cost_recall_curve(y, scores, amounts, cost_model)` | DataFrame for the operating curve |\n| `expected_calibration_error(p, y)` | ECE for reliability checks |\n\n## Reproduce the paper\n```bash\npython examples/ieee_cis.py --data_dir /path/to/ieee-cis --ca 5\n```\n\n## Roadmap\n- [ ] AML / graph support (Elliptic dataset example)\n- [ ] sklearn-compatible `CostAwareClassifier` wrapper\n- [ ] cost-curve plotting helpers\n- [ ] PyPI release\n\n## Citing\nIf you use `fraudcost`, please cite the companion paper (see `CITATION.cff`).\n\n## Contributing\nIssues and PRs welcome — see `CONTRIBUTING.md`. Licensed under MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraveenpolisetty%2Ffraudcost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraveenpolisetty%2Ffraudcost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraveenpolisetty%2Ffraudcost/lists"}