AI in Finance & Fraud · Lesson 2 of 8

Fraud Detection Fundamentals

⏱ 10 min read✅ Check-yourself quiz🏦 Banking & fintech

Fraud detection is a real-time decision under uncertainty: in roughly 100 milliseconds, decide whether to approve, challenge or decline a transaction. This lesson covers the fraud types, the system around the model, and how to choose the decision thresholds.

Common fraud types

The fraud system, not just the model

Transaction → Feature service (real-time aggregates) → Rules engine + ML score → Decision policy
          → approve | step-up (OTP / 3-D Secure) | decline | queue for review
          → Case management (analysts) → Labels (confirmed fraud, chargebacks) → Retraining

Thresholds are a business decision

For each threshold you get a precision (how many alerts are real fraud) and a recall (how much fraud you catch). Pick the threshold by expected cost:

A common pattern is tiered actions:

Score band Action
Very high Decline and block the card
High Step-up authentication (OTP, biometric)
Medium Approve, but queue for analyst review
Low Approve

Metrics that matter

A minimal model in Python

import pandas as pd
from sklearn.metrics import average_precision_score, precision_recall_curve
from lightgbm import LGBMClassifier

df = pd.read_parquet("transactions.parquet").sort_values("ts")
cut = df.ts.quantile(0.8)                          # out-of-time split
tr, te = df[df.ts < cut], df[df.ts >= cut]
feats = ["amount_log", "txn_count_1h", "amt_vs_user_avg", "new_device", "merchant_risk", "hour", "geo_km_from_home"]
m = LGBMClassifier(n_estimators=600, learning_rate=0.03, num_leaves=63, scale_pos_weight=50)
m.fit(tr[feats], tr.is_fraud)
p = m.predict_proba(te[feats])[:, 1]
print("PR-AUC", average_precision_score(te.is_fraud, p))
prec, rec, thr = precision_recall_curve(te.is_fraud, p)

Check yourself

Why use an out-of-time split instead of a random split? In production the model always scores future transactions. A random split leaks future patterns into training and overstates performance. A time-based split mimics deployment.
What is "step-up authentication" and why is it useful? Asking for extra verification (an OTP or biometric) for medium-risk transactions. It stops many frauds without fully declining genuine customers, which reduces friction compared with a hard decline.
Why measure fraud caught by value, not just by count? Catching ten ₹500 frauds while missing one ₹5 lakh fraud looks good by count and bad for the business. Value-weighted recall reflects the real loss.
Created by Ajeetkumar