stat_gain: Geom for gain curve

Description Usage Arguments Value Examples

Description

Plots the gain curve for evaluating a trained classification model.

Usage

1
2
3
stat_gain(mapping = NULL, data = NULL, geom = "Gain",
  position = "identity", na.rm = FALSE, show.legend = NA, positive_class,
  inherit.aes = TRUE, ...)

Arguments

mapping

Set of aestetic mappings. Required aesthetics are 'score' and 'class'. Further aestetics that can be set are the 'fill_color' and the 'fill_alpha'.

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_gain(positive_class = "malignant")

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