objective_threshold: Find the threshold(s) for a given objective and a given...

Description Usage Arguments Value See Also Examples

View source: R/metrics.R

Description

Find the threshold(s) for a given objective and a given metric.

Usage

1
objective_threshold(data, metric, objective)

Arguments

data

A dataframe with the metrics computed for different thresholds.

metric

A string. The metric to consider. One of: "Accuracy", "Precision", "Recall", "Specificity", "NPV" or "F1".

objective

A numeric value. The objective to reach.

Value

A dataframe with the optimal threshold(s).

See Also

compute_predict_class, compute_metrics, compute_optimal_threshold

Examples

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

metrics <- compute_metrics(data, threshold = c(0.3, 0.7, 0.2))

objective_threshold(metrics, metric = "Precision", objective = 0.75)

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