dataeval.core.ber_knn¶
- dataeval.core.ber_knn(data, labels, k)¶
An estimator for Multi-class Bayes error rate using KNN test statistic basis.
- Parameters:¶
- data : NDArray[np.float64]¶
Array of image embeddings
- labels : NDArray[np.intp]¶
Array of labels for each image
- k : int¶
Number of nearest neighbors for KNN estimator
- Returns:¶
The upper and lower bounds, respectively, of the Bayes Error Rate
- Return type:¶
tuple[float, float]
References
[1] Learning to Bound the Multi-class Bayes Error (Th. 3 and Th. 4)
Examples
>>> import sklearn.datasets as dsets >>> from dataeval.core._ber import ber_knn>>> images, labels = dsets.make_blobs(n_samples=50, centers=2, n_features=2, random_state=0) >>> ber_knn(images, labels, 1) (0.04, 0.020416847668728033)