Skip to contents

Generates a Lift chart from a dx object. Lift charts are used to evaluate the performance of binary classification models by comparing the results of using the model versus a random selection. The Lift chart plots the ratio of the results obtained with the model to those obtained by a random model, across different percentiles of the population.

Usage

dx_plot_lift(dx_obj)

Arguments

dx_obj

A dx object, created with dx().

Value

A ggplot object representing the Lift chart, which can be further customized as needed.

Details

The Lift chart visualizes how much more likely we are to capture positive instances when using the model's predictions compared to a random guess. The x-axis represents the percentile of the population when ordered by the predicted probabilities, and the y-axis represents the lift, which is calculated as the ratio of the cumulative gain at each percentile to the gain expected by chance. A value greater than 1 indicates that the model is performing better than random, with higher values representing better performance. A horizontal dashed line at y=1 represents the baseline lift of a random model. The lift curve should ideally stay above this line to indicate that the model has predictive power.

With tied predictions, the curve only has points that a threshold can reach (the end of each group of ties), joined by straight lines.

Examples

dx_obj <- dx(
  data = dx_heart_failure,
  true_varname = "truth",
  pred_varname = "predicted",
  setthreshold = .3
)
dx_plot_lift(dx_obj)