Member-only story
Let’s Build a Simple PD Model in Python (Step by Step)
Logistic regression on company bankruptcy data, in under 50 lines
Every loan decision starts with one question: how likely is this borrower to default?
That number is called the Probability of Default (PD). PD is the first and the only number that my eyes go to because almost every other decision, from approvals to provisions, is built on it.
In close to 7 years of credit risk modelling, PD is the number I’ve seen discussed most, and understood least. So here is a simple way to see how it is actually built.
In this article, let us build a simple PD model in Python in about 10 minutes and under 50-lines.
PD is the chance a borrower fails to repay. If 100 similar companies borrow and 3 default, the PD is 3%. Banks use it to approve loans, price them, and set aside provisions.
The data :
I have used the public Company Bankruptcy Prediction dataset from Kaggle. There were 6,819 listed Taiwanese companies, 95 financial ratios, and one label showing whether the company went bankrupt.
A quick honesty note here. Data was looking crazy as they appeared imbalanced. Secondly, bankruptcy is not exactly default, and this is learning data, not real bank data.
But the method is the same one used in practice.








