@@ -451,35 +451,15 @@ class ArgKminClassMode(BaseDistancesReductionDispatcher):
451451 """
452452
453453 @classmethod
454- def is_usable_for (cls , X , Y , metric ) -> bool :
455- """Return True if the dispatcher can be used for the given parameters.
456-
457- Parameters
458- ----------
459- X : ndarray of shape (n_samples_X, n_features)
460- The input array to be labelled.
461-
462- Y : ndarray of shape (n_samples_Y, n_features)
463- The input array whose labels are provided through the `Y_labels`
464- parameter.
465-
466- metric : str, default='euclidean'
467- The distance metric to use. For a list of available metrics, see
468- the documentation of :class:`~sklearn.metrics.DistanceMetric`.
469- Currently does not support `'precomputed'`.
470-
471- Returns
472- -------
473- True if the PairwiseDistancesReduction can be used, else False.
474- """
475- return (
476- ArgKmin .is_usable_for (X , Y , metric )
477- # TODO: Support CSR matrices.
478- and not issparse (X )
479- and not issparse (Y )
480- # TODO: implement Euclidean specialization with GEMM.
481- and metric not in ("euclidean" , "sqeuclidean" )
482- )
454+ def valid_metrics (cls ) -> List [str ]:
455+ excluded = {
456+ # Euclidean is technically usable for ArgKminClassMode
457+ # but its current implementation would not be competitive.
458+ # TODO: implement Euclidean specialization using GEMM.
459+ "euclidean" ,
460+ "sqeuclidean" ,
461+ }
462+ return list (set (BaseDistancesReductionDispatcher .valid_metrics ()) - excluded )
483463
484464 @classmethod
485465 def compute (
0 commit comments