toad.scorecard module¶
-
class
toad.scorecard.
ScoreCard
(pdo=60, rate=2, base_odds=35, base_score=750, card=None, combiner={}, transer=None, **kwargs)[source]¶ Bases:
sklearn.base.BaseEstimator
,toad.utils.mixin.RulesMixin
,toad.utils.mixin.BinsMixin
-
__init__
(pdo=60, rate=2, base_odds=35, base_score=750, card=None, combiner={}, transer=None, **kwargs)[source]¶ Parameters: - combiner (toad.Combiner) –
- transer (toad.WOETransformer) –
-
coef_
¶ coef of LR model
-
predict
(X, **kwargs)[source]¶ predict score :param X: X to predict :type X: 2D-DataFrame|dict :param return_sub: if need to return sub score of each feature :type return_sub: Bool :param default: default sub score for unknown feature, min`(default), `max :type default: str|number
Returns: predicted score DataFrame|dict: sub score for each feature Return type: array-like
-
get_reason
(X, base_effect=None, threshold_score=None, keep=3)[source]¶ calculate top-effect-of-features as reasons
Parameters: - X (2D DataFrame) – X to find reason
- base_effect (Series) – base effect score of each feature
- threshold_score (float) – threshold to find top k most important features, show the highest top k features when prediction score > threshold and show the lowest top k when prediction score <= threshold default is the sum of base_effect score
- keep (int) – top k most important reasons to keep, default 3
Returns: top k most important reasons for each feature
Return type: DataFrame
-
predict_proba
(X)[source]¶ predict probability
Parameters: X (2D array-like) – X to predict Returns: probability of all classes Return type: 2d array
-
proba_to_score
(prob)[source]¶ covert probability to score
odds = (1 - prob) / prob score = factor * log(odds) * offset
-
score_to_proba
(score)[source]¶ covert score to probability
Returns: the probability of 1 Return type: array-like|float
-