dx_fowlkes_mallows: Calculate Fowlkes-Mallows Index

View source: R/dx_metrics.R

dx_fowlkes_mallowsR Documentation

Calculate Fowlkes-Mallows Index

Description

Calculates the Fowlkes-Mallows Index (FM Index) for the provided confusion matrix. FM Index is the geometric mean of precision and recall, providing a balance measure between these two metrics.

Usage

dx_fowlkes_mallows(cm, detail = "full", boot = FALSE, bootreps = 1000)

Arguments

cm

A dx_cm object created by dx_cm().

detail

Character specifying the level of detail in the output: "simple" for raw estimate, "full" for detailed estimate including 95% confidence intervals.

boot

Logical specifying if confidence intervals should be generated via bootstrapping. Note, this can be slow.

bootreps

The number of bootstrap replications for calculating confidence intervals.

Details

Fowlkes-Mallows Index is defined as the geometric mean of the precision (Positive Predictive Value) and recall (True Positive Rate or Sensitivity). It's a useful measure when you want a balance between precision and recall without the harshness of the harmonic mean used in F1 score. A higher Fowlkes-Mallows Index indicates better precision and recall balance.

The formula for Fowlkes-Mallows Index is:

FM = \sqrt{Precision \times Recall}

Value

Depending on the detail parameter, returns a numeric value representing the calculated metric or a data frame/tibble with detailed diagnostics including confidence intervals and possibly other metrics relevant to understanding the metric.

See Also

dx_cm() to understand how to create and interact with a 'dx_cm' object.

dx_ppv(), dx_sensitivity() for components of FM Index.

Examples

cm <- dx_cm(dx_heart_failure$predicted, dx_heart_failure$truth, threshold = 0.5, poslabel = 1)
simple_fm_index <- dx_fowlkes_mallows(cm, detail = "simple")
detailed_fm_index <- dx_fowlkes_mallows(cm)
print(simple_fm_index)
print(detailed_fm_index)

overdodactyl/diagnosticSummary documentation built on Jan. 28, 2024, 10:07 a.m.