dataeval.metrics.estimators.ber

dataeval.metrics.estimators.ber(embeddings, labels, k=1, method='KNN')

An estimator for Multi-class Bayes error rate using FR or KNN test statistic basis.

Parameters:
embeddings : ArrayLike (N, ... )

Array of image embeddings

labels : ArrayLike (N, 1)

Array of labels for each image

k : int, default 1

Number of nearest neighbors for KNN estimator – ignored by MST estimator

method : Literal["KNN", "MST"], default "KNN"

Method to use when estimating the Bayes error rate

Returns:

The upper and lower bounds of the Bayes Error Rate

Return type:

BEROutput

References

[1] Learning to Bound the Multi-class Bayes Error (Th. 3 and Th. 4)

Examples

>>> import sklearn.datasets as dsets
>>> from dataeval.metrics.estimators import ber
>>> images, labels = dsets.make_blobs(n_samples=50, centers=2, n_features=2, random_state=0)
>>> ber(images, labels)
BEROutput(ber=0.04, ber_lower=0.020416847668728033)