A logit is the logarithm of an event’s probability divided by the probability of its complement: log(p / (1 − p)). In credit scoring, log-odds support weight-of-evidence feature encoding and conversion of default probabilities into scores. section 5.3.4 section 5.3.7
In credit-score conversion:
- Compute default odds as p / (1 − p), then transform their logarithm into a score using a scale factor and offset. section 5.3.7
- A points-to-double-odds scale can make each 20-point increase correspond to roughly doubled odds of being a good borrower. 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()
Python example calculating and plotting credit scores from model probabilities, with probability and score clipping. section 5.3.7
















