sklift.metrics.weighted_average_uplift

sklift.metrics.metrics.weighted_average_uplift(y_true, uplift, treatment, strategy='overall', bins=10)[source]

Weighted average uplift.

It is an average of uplift by percentile. Weights are sizes of the treatment group by percentile.

Parameters
  • 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’.

    • '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.

    • 'by_group':

      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 the relative percentile) in the data. Default is 10.

Returns

Weighted average uplift.

Return type

float