Vizualization (sklift.viz)

sklift.viz.base.plot_treatment_balance_curve(uplift, treatment, random=True, winsize=0.1)[source]

Plot Treatment Balance curve.

Parameters:
  • uplift (1d array-like) – Predicted uplift, as returned by a model.
  • treatment (1d array-like) – Treatment labels.
  • random (bool, default True) – Draw a random curve.
  • winsize (float, default 0.1) – Size of the sliding window to apply. Should be between 0 and 1, extremes excluded.
Returns:

Object that stores computed values.

sklift.viz.base.plot_uplift_preds(trmnt_preds, ctrl_preds, log=False, bins=100)[source]

Plot histograms of treatment, control and uplift predictions.

Parameters:
  • trmnt_preds (1d array-like) – Predictions for all observations if they are treatment.
  • ctrl_preds (1d array-like) – Predictions for all observations if they are control.
  • log (bool, default False) – Logarithm of source samples.
  • bins (integer or sequence, default 100) – Number of histogram bins to be used. If an integer is given, bins + 1 bin edges are calculated and returned. If bins is a sequence, gives bin edges, including left edge of first bin and right edge of last bin. In this case, bins is returned unmodified.
Returns:

Object that stores computed values.

sklift.viz.base.plot_uplift_qini_curves(y_true, uplift, treatment, random=True, perfect=False)[source]

Plot Uplift and Qini curves.

Parameters:
  • y_true (1d array-like) – Ground truth (correct) labels.
  • uplift (1d array-like) – Predicted uplift, as returned by a model.
  • treatment (1d array-like) – Treatment labels.
  • random (bool, default True) – Draw a random curve.
  • perfect (bool, default False) – Draw a perfect curve.
Returns:

Object that stores computed values.