LearnFinance
← Machine Learning & AI in Finance Lesson 2 of 6 · 9 min · +50 XP
Machine Learning & AI in Finance · Lesson 02

Credit scoring and fraud detection: imbalanced data and fairness

Defaults and frauds are rare, which makes accuracy a misleading measure. How to judge a classifier with the confusion matrix, precision and recall, how to choose a decision threshold from the business costs of errors, what alternative data adds to credit scoring in India, and how bias can creep into models and how lenders guard against it.

Facts reviewed Oct 2026

Credit scoring and fraud detection are machine learning’s biggest successes in finance. Both are classification problems: will this borrower default, is this transaction fraudulent? Both also share a trap: the events are rare. This lesson shows how to measure such models properly, set thresholds sensibly and keep them fair.

The accuracy paradox

If 2% of borrowers default, a “model” that approves everyone is 98% accurate, and useless. Accuracy hides what matters when one class is rare. Instead, use the confusion matrix:

Predicted defaultPredicted good
Actually defaultsTrue positive (TP)False negative (FN): a bad loan approved
Actually goodFalse positive (FP): a good customer rejectedTrue negative (TN)
  • Recall (true-positive rate) = TP ÷ (TP + FN): the share of defaulters caught.
  • Precision = TP ÷ (TP + FP): the share of flagged applicants who really default.
  • False-positive rate = FP ÷ (FP + TN): good customers wrongly flagged.

Statistics & Probability for Finance’s Bayes lesson showed why precision is low when the event is rare.

Choosing the threshold: think in money

A model outputs a probability of default; the lender chooses a threshold above which to reject. Lowering it catches more defaulters but rejects more good customers. The right threshold depends on the costs:

  • a missed defaulter costs the loss on the loan,
  • a rejected good customer costs the profit the loan would have made.

Of 10,000 applicants with a 2% default rate, a model that flags 70% of defaulters and 10% of good customers catches 140 defaulters and wrongly rejects 980 good customers. Its accuracy, 89.6%, is lower than approving everyone. But if each default costs ₹2 lakh and each good loan earns ₹20,000, the model saves ₹2.8 crore of losses and gives up ₹1.96 crore of profit: a net gain of about ₹84 lakh.

A credit model's confusion matrix and its value
Defaulters caught (TP)
140
Good customers rejected (FP)
980
Accuracy
89.6%
Precision
12.5%
Net value of using the model
₹84 L

Illustrative; real models trade recall against false positives along a curve as the threshold moves. Defaults: 140 defaulters caught, 980 good customers rejected, 89.6% accuracy, 12.5% precision, and a net value of about ₹84 lakh, despite accuracy below the 98% of approving everyone.

Quick check

A fraud model reports 99.5% accuracy where 0.5% of transactions are fraud. What should you ask first?

Handling imbalanced data

Techniques include re-weighting rare cases during training, resampling (over-sampling defaults or under-sampling good loans), and evaluating with measures such as the area under the ROC curve or precision-recall curves rather than accuracy. Fraud models also need speed and must adapt as fraudsters change tactics.

Alternative data in India

Many Indians have thin or no credit histories. Lenders increasingly use alternative data, with consent:

  • Bank-statement cash flows shared through Account Aggregators,
  • GST returns for small businesses,
  • utility and telecom payment histories, and digital payment patterns.

These widen access to credit, as Small-Business & MSME Finance describes, but raise privacy questions. India’s Digital Personal Data Protection Act, 2023, with rules notified in November 2025 and phased in over 18 months, requires clear consent and limits on data use (as of Oct 2026).

Fairness and bias

ML models learn from history, including historical bias:

  • Proxy discrimination: even without gender or religion as inputs, variables such as postcode, device type or shopping patterns can act as proxies.
  • Feedback loops: if a group was historically denied credit, there’s little data on how its members would repay.
  • Explainability: borrowers deserve to know why they were rejected, and lenders must be able to justify decisions to regulators.

Lenders test models for disparate outcomes across groups, remove or constrain problematic inputs, and keep humans in the loop for borderline or adverse decisions. The RBI’s FREE-AI framework of 2025 sets out principles of fairness, accountability and explainability for AI in Indian finance, as this module’s model-risk lesson explains.

Try it: the lender tightens the model so it flags 85% of defaulters but 25% of good customers. Is it worth it?

TP = 170, saving ₹3.4 crore; FP = 2,450, costing ₹4.9 crore: a net loss of about ₹1.5 crore compared with lending to everyone. Enter 85 and 25. Catching more defaulters isn’t worth rejecting so many good customers.

Key takeaways

  • With rare events, accuracy misleads; use the confusion matrix, recall, precision and the false-positive rate.
  • Set thresholds by the money cost of each error: loss per missed default versus profit per rejected good customer.
  • Handle imbalance with re-weighting, resampling and suitable metrics; alternative data via Account Aggregators widens access under the DPDP rules.
  • Guard against proxy discrimination, feedback loops and unexplainable decisions; the RBI’s FREE-AI framework sets the principles.

Go deeper

Complete this lesson
Pass the quiz below (60% or more) to earn +50 XP and unlock the next lesson.
Quiz not passed yet
🧠

Quiz: Credit scoring and fraud detection: imbalanced data and fairness

5 questions · pass 60% to complete