fscore: Calculate the F Score for predicted probabilities against a...

View source: R/fscore.R

fscoreR Documentation

Calculate the F Score for predicted probabilities against a binary outcome.

Description

Calculate the F Score for predicted probabilities against a binary outcome.

Usage

fscore(preds, obs, beta = 1, thresh = 0.5)

Arguments

preds

A vector of predicted probabilities.

obs

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

beta

The default weighting of the precision and recall. Default beta = 1 which yields the "F_1" Score.

thresh

The probability threshold at or above which a prediction is considered to be positive.

Value

The F Score is the harmonic mean of the precision (positive predictive value) and recall (sensitivity).

Examples

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

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