diff --git a/src/torchmetrics/clustering/cluster_accuracy.py b/src/torchmetrics/clustering/cluster_accuracy.py index f413d934df9..0e0996056d8 100644 --- a/src/torchmetrics/clustering/cluster_accuracy.py +++ b/src/torchmetrics/clustering/cluster_accuracy.py @@ -50,6 +50,11 @@ class ClusterAccuracy(Metric): - ``acc_score`` (:class:`~torch.Tensor`): A tensor with the Cluster Accuracy score + .. note:: This metric requires you to have `torch_linear_assignment` package installed for solving the + linear sum assignment problem. You can install it directly from source with the following command: + ``pip install git+https://github.com/ivan-chai/torch-linear-assignment`` or install it with + ``pip install torchmetrics[clustering]``. + Args: num_classes: number of classes kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info. diff --git a/src/torchmetrics/functional/clustering/cluster_accuracy.py b/src/torchmetrics/functional/clustering/cluster_accuracy.py index 6e63ef3450d..da27990ec78 100644 --- a/src/torchmetrics/functional/clustering/cluster_accuracy.py +++ b/src/torchmetrics/functional/clustering/cluster_accuracy.py @@ -33,6 +33,11 @@ def _cluster_accuracy_compute(confmat: Tensor) -> Tensor: def cluster_accuracy(preds: Tensor, target: Tensor, num_classes: int) -> Tensor: """Computes the clustering accuracy between the predicted and target clusters. + .. note:: This metric requires you to have `torch_linear_assignment` package installed for solving the + linear sum assignment problem. You can install it directly from source with the following command: + ``pip install git+https://github.com/ivan-chai/torch-linear-assignment`` or install it with + ``pip install torchmetrics[clustering]``. + Args: preds: predicted cluster labels target: ground truth cluster labels