draw_lift: Plot the lift curves

Description Usage Arguments Value See Also Examples

View source: R/metrics.R

Description

Plot the lift curves.

Usage

1
2
3
4
5
draw_lift(data, type = c("gain_chart", "lift_curve",
  "cumulative_lift_curve"), quantile = "quantile", nb_quantiles = 20,
  lift = "lift", cumulative_lift = "cumulative_lift",
  cumulative_lift_per = "cumulative_lift_per",
  cumulative_lift_per_ideal = "cumulative_lift_per_ideal")

Arguments

data

A dataframe or a list of dataframes with the lift and the cumulative lift per quantile.

type

A string (default = "gain_chart"). The type of plot. One of: "gain_chart", "lift_curve" or "cumulative_lift_curve".

quantile

A string (default = "quantile"). The column's name of the quantiles.

nb_quantiles

An integer (default = 20). The number of quantiles computed.

lift

A string (default = "lift"). The column's name of the lift

cumulative_lift

A string (default = "cumulative_lift"). The column's name of the cumulative lift.

cumulative_lift_per

A string (default = "cumulative_lift_per"). The column's name of the cumulative lift in percentage.

cumulative_lift_per_ideal

A string (default = "cumulative_lift_per_ideal"). The column's name of the cumulative lift in percentage for the perfect model.

Value

A ggplot2 object.

See Also

compute_lift, draw_lift

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data <- data.frame(
  obs = c(rep("Yes", 20), rep("No", 20)),
  prob = c(runif(n = 20, min = 0.3, max = 0.8),
           runif(n = 20, min = 0.1, max = 0.6))
)

quantiles <- qcut(data, prob = "prob")
lift <- compute_lift(quantiles)

draw_lift(lift)

thoera/metrics documentation built on Nov. 20, 2019, 2:01 p.m.