Shravan OmanakuttanAI / ML engineer

A hand reaches out

000
Shravan OmanakuttanAI / ML engineer
← All builds

Fraud detector with a decision policy

Compare models fairly, hunt for leakage, then turn scores into approve, review or block. A learning version inspired by FraudShield.

Step 1 of 5

Make an imbalanced dataset

Fraud is rare. Accuracy will lie to you, which is the first lesson.

from sklearn.datasets import make_classification
X, y = make_classification(n_samples=3000, weights=[0.95], n_informative=6, random_state=7)
print("fraud share:", round(y.mean(), 3))
print("accuracy of always saying 'fine':", round(1 - y.mean(), 3))
Run this one on your own computer: it needs files, typing or libraries a browser tab lacks.

You are done whenYou can explain why high accuracy is worthless here.

↑ ↓ move↵ selectesc close