Learn R Programming

fairmodels (version 1.2.2)

confusion_matrix: Confusion matrix

Description

Calculates confusion matrix for given cutoff

Usage

confusion_matrix(probs, observed, cutoff)

Value

object of class confussion_matrix

It is a list with following fields:

tp

number of True Positives

fp

number of False Positives

tn

number of True Negatives

fn

number of False Negatives

Arguments

probs

numeric, vector with probabilities given by model

observed

numeric, vector with actual values from outcome, either 0 or 1

cutoff

numeric, single value denoting cutoff/threshold

Examples

Run this code

probs <- rnorm(20, 0.4, 0.1)
observed <- round(runif(20))

confusion_matrix(probs, observed, 0.5)

Run the code above in your browser using DataLab