zol: Calculate the zero-one loss (i.e. 1 - accuracy) for predicted...

View source: R/zol.R

zolR Documentation

Calculate the zero-one loss (i.e. 1 - accuracy) for predicted probabilities against a binary outcome.

Description

Calculate the zero-one loss (i.e. 1 - accuracy) for predicted probabilities against a binary outcome.

Usage

zol(preds, obs, thresh = 0.5)

Arguments

preds

A vector of predicted probabilities.

obs

A vector containing the observed binary outcomes (0 or 1).

thresh

The threshold at or above which a prediction is considered positive. Default = 0.5.

Value

The 1 - accuracy, or zero-one loss, of the predictions at a given threshold.

Examples

# Generate some predictions
predictions <- runif(1000)
# Generate some binary outcomes
observations <- sample(0:1, size = 1000, replace = TRUE)
# Calculate the Brier Score
zol(predictions, observations)

gweissman/gmish documentation built on Feb. 21, 2025, 1:20 a.m.