- sklift.metrics.metrics.response_rate_by_percentile(y_true, uplift, treatment, group, strategy='overall', bins=10)
Compute response rate (target mean in the control or treatment group) at each percentile.
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.
group (string, ['treatment', 'control']) –
Group type for computing response rate: treatment or control.
Values equal 1 in the treatment column.
Values equal 0 in the treatment column.
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.
bins (int) – Determines the number of bins (and relative percentile) in the data. Default is 10.
response rate at each percentile for control or treatment group, variance of the response rate at each percentile, group size at each percentile.
- Return type
array (shape = [>2]), array (shape = [>2]), array (shape = [>2])