Model evaluation

class: scorecardbundle.model_evaluation.ModelEvaluation.BinaryTargets

Model evaluation for binary classification problem.

Parameters

y_true: numpy.array, shape (number of examples,)
        The target column (or dependent variable).  

y_pred_proba: numpy.array, shape (number of examples,)
        The score or probability output by the model. The probability
        of y_true being 1 should increase as this value
        increases.   
        
        If Scorecard model's parameter "PDO" is negative, then the higher the 
        model scores, the higher the probability of y_pred being 1. This Function
        works fine. 

        However!!! if the parameter "PDO" is positive, then the higher 
        the model scores, the lower the probability of y_pred being 1. In this case,
        just put a negative sign before the scores array and pass `-scores` as parameter
        y_pred_proba of this function. 

output_path: string, optional(default=None)
        the location to save the plot, e.g. r'D:\\Work\\jupyter\\'.

Methods

ks_stat(): Return the k-s stat
plot_ks(): Draw k-s curve
plot_roc(): Draw ROC curve
plot_precision_recall(): Draw precision recall curve
plot_all(): Draw k-s, ROC curve, and precision recall curve

function: scorecardbundle.model_evaluation.ModelEvaluation.pref_table()

Evaluate the classification performance on differet levels of model scores (y_pred_proba). Useful for setting classification threshold based on requirements of precision and recall.

Parameters

y_true: numpy.array, shape (number of examples,)
        The target column (or dependent variable).  

y_pred_proba: numpy.array, shape (number of examples,)
        The score or probability output by the model. The probability
        of y_true being 1 should increase as this value
        increases.

        If Scorecard model's parameter "PDO" is negative, then the higher the 
        model scores, the higher the probability of y_pred being 1. This Function
        works fine. 

        However!!! if the parameter "PDO" is positive, then the higher 
        the model scores, the lower the probability of y_pred being 1. In this case,
        just put a negative sign before the scores array and pass `-scores` as parameter
        y_pred_proba of this function.   

thresholds: iterable. Can be list, numpy.array, etc.
        The thresholds used to turn model scores into groups so that each group's
        performance can be evaluated.

rename_dict: python dictionary.
        A dictionary that maps the column names of the returned table to user-defined names.
        Use this parameter to change the name of the returned table.
        For example, inputing {'cum_f1':'cumulated_f1_score'} would rename the column 'cum_f1'
        of the returned table as 'cumulated_f1_score'

Return

stat: pandas.DataFrame.
    The classification performance table