compute_predict_class: Compute the class predicted for a given threshold

Description Usage Arguments Value See Also Examples

View source: R/metrics.R

Description

Compute the class predicted for a given threshold.

Usage

1
2
compute_predict_class(data, threshold = 0.5, prob = "prob",
  pos_class = "Yes", neg_class = "No")

Arguments

data

A dataframe with the probabilities computed for the positive class.

threshold

A numeric value (default = 0.5) to decide if an observation will be affected to the positive class.

prob

A string (default = "prob"). The column's name of the predicted probabilities.

pos_class

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

neg_class

A string (default = "No"). How the negative class is coded.

Value

A dataframe with the class predicted.

See Also

compute_metrics, compute_optimal_threshold, objective_threshold

Examples

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

compute_predict_class(data)

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