- sklift.viz.base.plot_uplift_by_percentile(y_true, uplift, treatment, strategy='overall', kind='line', bins=10, string_percentiles=True)[source]
Plot uplift score, treatment response rate and control response rate at each percentile.
Treatment response rate ia a target mean in the treatment group. Control response rate is a target mean in the control group. Uplift score is a difference between treatment response rate and control response rate.
y_true (1d array-like) – Correct (true) binary target values.
uplift (1d array-like) – Predicted uplift, as returned by a model.
treatment (1d array-like) – Treatment labels.
strategy (string, ['overall', 'by_group']) –
Determines the calculating strategy. Default is ‘overall’.
The first step is taking the first k observations of all test data ordered by uplift prediction (overall both groups - control and treatment) and conversions in treatment and control groups calculated only on them. Then the difference between these conversions is calculated.
Separately calculates conversions in top k observations in each group (control and treatment) sorted by uplift predictions. Then the difference between these conversions is calculated.
kind (string, ['line', 'bar']) –
The type of plot to draw. Default is ‘line’.
Generates a line plot.
Generates a traditional bar-style plot.
bins (int) – Determines а number of bins (and the relative percentile) in the test data. Default is 10.
string_percentiles (bool) – type of xticks: float or string to plot. Default is True (string).
Object that stores computed values.