A points-to-double-odds (PDO) scale maps model-predicted default probabilities to credit scores. With PDO=20, each 20-point increase doubles the odds of being a good borrower. Using default odds p/(1−p), the score is offset − (PDO/ln 2) × ln(default odds); the implementation rounds scores and clips them to [250, 1000]. section 5.3.7
Listing 5.17 BFSI score conversion and distribution
import math
import numpy as np
import matplotlib.pyplot as plt
base_score = 650
PDO = 20 #1
factor = PDO / np.log(2) #2
offset = base_score - (factor * np.log(20)) #3
def calculate_score(prob_default, factor, offset): #4
prob_default = np.clip(prob_default, 1e-6, 1 - 1e-6)
odds = prob_default / (1 - prob_default)
raw_score = offset - factor * np.log(odds)
return np.clip(raw_score, 250, 1000) #5
scores = calculate_score(predictions, factor, offset)
scores = np.round(scores) #6
plt.figure(figsize=(8, 5))
plt.hist(scores, bins=20, edgecolor='black') #7
plt.title('Credit Score Distribution')
plt.xlabel('Score')
plt.ylabel('Frequency')
plt.show()
The Python example anchors a score of 650 to 1:20 odds, computes the scale factor and offset, clips probability and score values, and plots the resulting score distribution. section 5.3.7
