- sklift.metrics.metrics.uplift_at_k(y_true, uplift, treatment, strategy, k=0.3)
Compute uplift at first k observations by uplift of the total sample.
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.
k (float or int) – If float, should be between 0.0 and 1.0 and represent the proportion of the dataset to include in the computation of uplift. If int, represents the absolute number of samples.
strategy (string, ['overall', 'by_group']) –
Determines the calculating strategy.
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
Changed in version 0.1.0:
Add supporting absolute values for
Uplift score at first k observations of the total sample.
- Return type