Catching bad credit-card transactions as they happen
- ROLE
- Team of 3
- TIMEFRAME
- 2025
- STACK
- Python, Spark MLlib, Kafka, QIEA
- LINKS
- github ↗
−90%
INPUTS NEEDED
The problem
Fraud models fight two constraints at once: severe class imbalance, and an inference-latency budget, since a score that arrives after the transaction clears is worthless. Every feature you keep costs you at serving time.
Approach
Built with Aayush Tiwari and Atharva Indulkar, Department of AI & Data Science at K. J. Somaiya. A Spark MLlib pipeline over the ULB credit-card dataset, with feature selection handled by a quantum-inspired evolutionary algorithm (QIEA): candidate feature subsets are encoded as qubit-style probability amplitudes that collapse, get evaluated, and update toward the best observed subsets. Logistic regression, random forest, and gradient-boosted trees are trained on the selected subset, and a Kafka-simulated stream demonstrates real-time inference end to end.
Results
On the full 42,722-transaction held-out test set (74 fraudulent), QIEA's 3-feature subset (V14, V4, V10) keeps Random Forest at 0.956 AUC-ROC against 0.964 for the same model on all 30 features, preserving 99.2% of the ranking performance after a 90% cut in inputs. That also pays off in latency: 7.168ms per transaction for QIEA+RF, a 6.5% drop versus the all-features version, and 4.950ms for QIEA+GBT, a 30.4% drop. In a simulated Kafka stream (100-transaction micro-batches, 1-second trigger), the QIEA+RF pipeline sustained 3,285 transactions/second at a 26.53ms median batch latency and 49.10ms p95.
What broke
Precision, not recall, is where the feature cut costs you. Precision fell from 69.7% (all 30 features, Random Forest) to 11.2% (QIEA's 3 features, Random Forest) on the same test set, while recall barely moved (83.8% → 79.7%). Removing 27 features destroyed the model's ability to separate borderline legitimate transactions from genuine fraud, so far more legitimate transactions get flagged. In production that tradeoff needs a decision threshold calibrated to the institution's actual cost of a false alarm versus a missed fraud: QIEA buys latency and dimensionality reduction, not a free lunch on precision.