Credit Risk Scorecard in Python: WOE, IV and a PD Model, Scored on Applicants You Can't See
<p>Tungabhadra Finserv, an NBFC in north Karnataka, approves personal loans on a single bureau-score cut-off. Its Chief Risk Officer wants the points-based application scorecard that banks use: explainable to a branch manager, defensible to an inspector, and proven on applicants it has never seen. You build it.</p><p>You get your own copy of the company's loan book: a year of loans with their 12-month repayment record, and three months of newer loans without it. You build the scorecard yourself, lesson by lesson. Then you give the same job to your AI assistant (ChatGPT, Claude, Gemini or Copilot) and check what it gives back. Bartman runs your script in a sealed sandbox and scores your probabilities of default against what the newer borrowers actually did. Neither you, your AI nor the sandbox ever sees those outcomes.</p><ul><li>Define bad exactly (90+ days past due) and clean a real loan export: repeated rows, a hand-typed category, incomes in Indian grouping, a blank that means zero, and FOIR.</li><li>Coarse-class each characteristic, compute <strong>weight of evidence</strong> and <strong>information value</strong> by hand, and use the IV rule to catch a column recorded after the loan was made.</li><li>Fit an unpenalised logistic regression on the WOE values and submit calibrated PDs, not labels or re-weighted scores.</li><li>Validate it the way banks do, with <strong>Gini</strong> and <strong>KS</strong>.</li><li>Scale it to points with a base score, odds and PDO, build the points table, and back-test the CRO's cut-off on the newer loans.</li></ul><p>Every learner gets different data and a different policy, so answers can't be copied. Each check explains what went wrong without giving the answer away, and the classic mistakes (90 not counted as bad, the wrong bin edge, WOE the wrong way round, class weights, AUC reported as Gini, log10 in the scaling) are recognised and named.</p>
Tools: Python, pandas, scikit-learn, statsmodels, Credit Scorecards, Weight of Evidence, Information Value, Logistic Regression, Gini and KS, Credit Risk, matplotlib, AI Assistants for Python