Clustering, Ranking & Pairwise
Computes the Adjusted Mutual Information (AMI) between two clusterings.
Computes the Adjusted Rand Index (ARI).
Computes the Calinski-Harabasz index (Variance Ratio Criterion).
Computes the completeness score of a clustering.
Computes the Davies-Bouldin index.
Computes the Fowlkes-Mallows Index (FMI).
Computes the homogeneity score of a clustering.
Computes the Normalized Mutual Information (NMI) between two clusterings.
Computes the Silhouette Coefficient for each sample.
Computes the mean Silhouette Coefficient over all samples.
Computes the V-measure score of a clustering.
Brier score loss for probability predictions.
Coverage error for multi-label ranking.
D² score for Tweedie deviance regression.
Detection Error Tradeoff (DET) curve.
Average hinge loss (for SVM evaluation).
Label ranking loss for multi-label classification.
Mean Gamma deviance regression loss.
Mean pinball loss (quantile loss).
Mean Poisson deviance regression loss.
Mean Squared Logarithmic Error (MSLE).
Compute a confusion matrix for each class (multilabel).
Symmetric Mean Absolute Percentage Error (SMAPE).
Top-K accuracy score.
Zero-one classification loss (fraction of misclassifications).
Compute Normalized Discounted Cumulative Gain (NDCG) at rank k.
Compute pairwise cosine distances between rows of X.
pairwiseEuclidean is exported by deepbox/metrics.
Compute pairwise Manhattan (L1) distances between rows of X.
Compute Mean Reciprocal Rank (MRR).
import { ndcgScore, pairwiseCosine, silhouetteScore, topKAccuracyScore,} from "deepbox/metrics";import { tensor } from "deepbox/ndarray";const X = tensor([[1, 0], [0.9, 0.1], [0, 1], [0.1, 0.9]]);const labels = tensor([0, 0, 1, 1]);console.log(silhouetteScore(X, labels));console.log(pairwiseCosine(X).toString());console.log(ndcgScore(tensor([[1, 0, 1]]), tensor([[0.9, 0.2, 0.7]])));console.log(topKAccuracyScore(tensor([2]), tensor([[0.1, 0.2, 0.9]]), 1));