toad.scorecard module

class toad.scorecard.ScoreCard(pdo=60, rate=2, base_odds=35, base_score=750, **kwargs)[source]

Bases: sklearn.base.BaseEstimator

bin_to_score(bins, return_sub=False)[source]

predict score from bins

combine(X)[source]
export(to_frame=False, to_json=None, to_csv=None, decimal=2)[source]

generate a scorecard object

Parameters:
  • to_frame (bool) – return DataFrame of card
  • to_json (str|IOBase) – io to write json file
  • to_csv (filepath|IOBase) – file to write csv
Returns:

dict

fit(X, y, combiner=None, transer=None, model=None)[source]
Parameters:
  • X (2D array-like) –
  • Y (array-like) –
generate_card(card=None, combiner={}, transer=None, model=None)[source]
Parameters:
  • card (dict|str|IOBase) – dict of card or io to read json
  • combiner (toad.Combiner) –
  • transer (toad.WOETransformer) –
  • model (LogisticRegression) –
generate_map(transer, model)[source]

calculate score map by woe

predict(X, **kwargs)[source]

predict score :param X: X to predict :type X: 2D array-like :param return_sub: if need to return sub score, default False :type return_sub: bool

Returns:predicted score DataFrame: sub score for each feature
Return type:array-like
proba_to_score(prob)[source]

covert probability to score

set_card(card)[source]

set card dict

set_combiner(combiner)[source]

set combiner

set_model(model)[source]

set logistic regression model

set_score(map)[source]

set score map by dict

testing_frame(**kwargs)[source]

get testing frame with score

Returns:testing frame with score
Return type:DataFrame
woe_to_score(woe, weight=None)[source]

calculate score by woe