compute_lift: Compute the lift

Description Usage Arguments Value See Also Examples

View source: R/metrics.R

Description

Compute the lift and cumulative lift.

Usage

1
2
compute_lift(data, obs = "obs", pos_class = "Yes",
  quantile = "quantile", nb_quantiles = 20)

Arguments

data

A dataframe with the observed class, the probabilities for the positive class and the quantiles.

obs

A string (default = "obs"). The column's name of the observed class.

pos_class

A string (default = "Yes"). How the positive class is coded.

quantile

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

nb_quantiles

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

Value

A dataframe with the lift and the cumulative lift computed for each quantile.

See Also

compute_lift, draw_lift

Examples

1
2
3
4
5
6
7
8
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)

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