architectraghu commited on
Commit
d68293c
·
verified ·
1 Parent(s): c3b2caa

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -0
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - cbc-reference-model
5
+ - mlops-100-day
6
+ - fraud-detection
7
+ - tabular-classification
8
+ ---
9
+
10
+ # CBC Reference Model: Credit-Card Fraud Detection
11
+
12
+ > Pre-trained reference model for the **CBC [MLOps 100-Day Track](https://github.com/careerbytecode/cbc-learning-hub/tree/main/100-days/mlops)** (Capstone 2). Published twin of ML Development Capstone 2.
13
+
14
+ ## Model details
15
+ - **Type:** XGBoost classifier (Optuna-tuned, `scale_pos_weight=498`), trained on a **time-aware** split (earlier 80% of transactions by Time; tested on the latest 20%).
16
+ - **Framework:** xgboost 3.2.0 · **Serialization:** joblib · **Seed:** 42
17
+ - A **pre-filter** that ranks transactions by fraud risk for review — NOT an automated block. `scale_pos_weight` de-calibrates probabilities upward, so the operating threshold is high (not 0.5) and is a serving config, recorded in `metrics.json`.
18
+
19
+ ## Intended use
20
+ Flag transactions for human/downstream review. Teaching/reference artifact — not a production authorization system.
21
+
22
+ ## Training data
23
+ ULB mlg-ulb credit-card fraud (284,807 transactions over two days, 492 frauds, 0.17%). 28 PCA features V1..V28 + Amount; Time is the split variable. ODbL/DbCL.
24
+
25
+ ## Metrics (latest-20%-by-Time test split, evaluated once)
26
+ | Metric | Value |
27
+ |---|---|
28
+ | PR-AUC | 0.8050 (no-skill floor 0.0013) |
29
+ | ROC-AUC | 0.9656 |
30
+ | Recall @ threshold 0.7017 | 0.7467 |
31
+ | Precision @ threshold | 0.8750 |
32
+ | F1 @ threshold | 0.8058 |
33
+
34
+ Threshold 0.7017 was tuned on a validation slice for precision >= 90%. Top SHAP drivers: V4 (2.61), V14 (2.29), V12 (1.76), V10 (1.34), V11 (1.19).
35
+
36
+ ## How to load and predict
37
+ ```python
38
+ import joblib, json, pandas as pd
39
+ from huggingface_hub import hf_hub_download
40
+
41
+ model = joblib.load(hf_hub_download("careerbytecode/mlops-ref-finance-fraud", "model/pipeline.joblib"))
42
+ sample = json.load(open(hf_hub_download("careerbytecode/mlops-ref-finance-fraud", "sample_input.json")))
43
+ proba = float(model.predict_proba(pd.DataFrame([sample]))[0, 1])
44
+ is_fraud = proba >= 0.7017 # threshold from metrics.json
45
+ print(proba, is_fraud)
46
+ ```
47
+
48
+ Input schema: 29 numeric columns — V1..V28 (PCA) + Amount.
49
+
50
+ ## Limitations
51
+ - Severely imbalanced (0.17%): accuracy is meaningless; judge by PR-AUC vs floor and recall/precision at threshold.
52
+ - Features are PCA components — not human-readable; SHAP names components, not transaction attributes.
53
+ - Temporal drift expected; retrain on a rolling window. Reference/teaching artifact only.
54
+
55
+ ---
56
+ © 2015-2026 CareerByteCode. All rights reserved. | CC BY-NC-SA 4.0 (docs), MIT (code) | Authored by Raghavendra R, Platform Owner CareerByteCode, Solution Architect