Bayes Error Rate

How-To Guides

Check out this how to to begin using the BER class

Bayes Error Rate Tutorial

DataEval API

class dataeval.metrics.BER(method: Literal['MST', 'KNN'] = 'KNN', k: int = 1)

An estimator for Multi-class Bayes Error Rate using FR or KNN test statistic basis

Parameters:
  • method (Literal["MST", "KNN"], default "KNN") – Method to use when estimating the Bayes error rate

  • k (int, default 1) – number of nearest neighbors for KNN estimator – ignored by MST estimator

evaluate(images: ArrayLike, labels: ArrayLike) Dict[str, float]

Calculates the Bayes Error Rate estimate using the provided method

Parameters:
  • images (ArrayLike (N, : )) – Array of images or image embeddings

  • labels (ArrayLike (N, 1)) – Array of labels for each image or image embedding

Returns:

berfloat

The estimated lower bounds of the Bayes Error Rate

ber_lowerfloat

The estimated upper bounds of the Bayes Error Rate

Return type:

Dict[str, float]

Raises:

ValueError – If unique classes M < 2