geom_lift: Geom for lift curve

Description Usage Arguments Value Examples

Description

Plots the lift curve for evaluating a trained classification model.

Usage

1
2
3
geom_lift(mapping = NULL, data = NULL, stat = "lift",
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, ...)

Arguments

mapping

Set of aestetic mappings. Required aesthetics are 'score' and 'class'.

data

The data to be displayer in this layer.

positive_class

character indicating the "positive" class of interest.

Value

ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(dplyr)
library(mlbench)
data("BreastCancer")
my_data <- BreastCancer %>%
  mutate(Cell.size = as.numeric(Cell.size)) %>%
    select(Cell.size, Class)

fit <- glm(Class ~ ., data = my_data, family = "binomial")
my_data$pred <- predict(fit, newdata = my_data)
my_data %>%
  ggplot(aes(score = pred, class = Class)) +
  geom_lift(positive_class = "malignant")

NOllAl/diaggnosticplots documentation built on May 7, 2019, 6:02 p.m.