kdsplot#

scikitplot.snsx.kdsplot(data=None, *, x=None, y=None, kind=None, n_deciles=10, round_digits=None, hue=None, weights=None, verbose=False, fill=False, line_kws=None, color=None, legend=True, ax=None, **kwargs)[source]#

Given labels y_true (0/1) and probabilities y_score arrays, compute a decile table.

The function sorts observations by descending score, assigns decile index (1..n_deciles) using pandas qcut on the rank/index to ensure near-equal bins, and computes standard decile-level stats:

[
    "decile",
    "prob_min",
    "prob_max",
    "prob_avg",
    "cnt_resp",
    "cnt_resp_total",
    "cnt_resp_non",
    "cnt_resp_wiz",
    "cnt_resp_rndm",
    "rate_resp",
    "cum_resp",
    "cum_resp_pct",
    "cum_resp_total",
    "cum_resp_total_pct",
    "cum_resp_non",
    "cum_resp_non_pct",
    "cum_resp_wiz",
    "cum_resp_wiz_pct",
    "KS",
    "lift",
]
Parameters:
xstr, array-like

Ground truth (correct/actual) target values.

ystr, array-like

Prediction probabilities for target class returned by a classifier/algorithm.

n_decilesint, optional, default=10

The number of partitions for creating the table. Defaults to 10 for deciles.

round_digitsint, optional, default=None

The decimal precision for the result. return df.round(round_digits)

verbosebool, optional, default=False

If True, prints a legend for the abbreviations of decile table column names.

Returns DataFrame indexed by decile (sorted ascending).
Returns:
pandas.DataFrame

The dataframe (decile-table) with the deciles and related information (decile-level metrics). If hue/facet semantics were used, the returned table will include extra columns for those keys (e.g., ‘hue’).

Parameters:
Return type:

DataFrame