uplift_by_percentile(y_true, uplift, treatment, strategy='overall', bins=10, std=False, total=False, string_percentiles=True)¶
Compute metrics: uplift, group size, group response rate, standard deviation at each percentile.
Metrics in columns and percentiles in rows of pandas DataFrame:
n_control- group sizes.
response_rate_control- group response rates.
uplift- treatment response rate substract control response rate.
std_control- (optional) response rates standard deviation.
std_uplift- (optional) uplift standard deviation.
y_true (1d array-like) – Correct (true) 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’.
std (bool) – If True, add columns with the uplift standard deviation and the response rate standard deviation. Default is False.
total (bool) – If True, add the last row with the total values. Default is False. The total uplift is a weighted average uplift. See
weighted_average_uplift(). The total response rate is a response rate on the full data amount.
bins (int) – Determines the number of bins (and the relative percentile) in the data. Default is 10.
string_percentiles (bool) – type of percentiles in the index: float or string. Default is True (string).
DataFrame where metrics are by columns and percentiles are by rows.
- Return type