Scorecard
ScoreCard
The function calculates the scorecard based on the log odds.
Parameters:
- y_proba:
np.ndarrayorpd.Series
A numpy ndarray with probabilities of default. Iflog == True, thenln(probabilities). - log:
bool
Whethery_probaisln(probabilities)or not. - target_score:
int, default = 600
A baseline score. - target_odds:
int, default = 30
The corresponding odds for thetarget_score. - pdo:
int, default = 20
Points to double odds.
Returns:
- pred:
pd.DataFrame
A pandas DataFrame with probability and the corresponding Score.
Exceptions:
-
TypeError:
Raised iflogparameter is not logical.
Raised ify_probaparameter is notnp.ndarrayorpd.Series. -
ValueError:
Raised ifprobabilitiesparameter does not have 1 column.
Raised iftarget_scoreis not a positive integer.
Raised iftarget_oddsis not a positive integer.
Raised ifpdois not a positive integer.
Example:
import numpy as np
import pandas as pd
from combat.scorecard import ScoreCard
# Sample input data
y_proba = np.array([0.1, 0.2, 0.3, 0.4, 0.5])
log = False
target_score = 600
target_odds = 30
pdo = 20
# Calculate scorecard
result = ScoreCard(y_proba, log, target_score, target_odds, pdo)
print(result)