diff --git a/cpp/src/metrics/pairwise_distance_dice.cu b/cpp/src/metrics/pairwise_distance_dice.cu index 7aaabf07f3..eb84dbece4 100644 --- a/cpp/src/metrics/pairwise_distance_dice.cu +++ b/cpp/src/metrics/pairwise_distance_dice.cu @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2021-2024, NVIDIA CORPORATION. + * Copyright (c) 2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cpp/src/metrics/pairwise_distance_dice.cuh b/cpp/src/metrics/pairwise_distance_dice.cuh index cd5b8a247f..6e6351c02d 100644 --- a/cpp/src/metrics/pairwise_distance_dice.cuh +++ b/cpp/src/metrics/pairwise_distance_dice.cuh @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2021-2024, NVIDIA CORPORATION. + * Copyright (c) 2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/python/cuml/manifold/umap_utils.pyx b/python/cuml/manifold/umap_utils.pyx index ff41a38ebf..237829ea00 100644 --- a/python/cuml/manifold/umap_utils.pyx +++ b/python/cuml/manifold/umap_utils.pyx @@ -135,23 +135,23 @@ def find_ab_params(spread, min_dist): metric_parsing = { - "l2": DistanceType.L2SqrtUnexpanded, - "euclidean": DistanceType.L2SqrtUnexpanded, - "sqeuclidean": DistanceType.L2Unexpanded, - "cityblock": DistanceType.L1, - "l1": DistanceType.L1, - "manhattan": DistanceType.L1, - "taxicab": DistanceType.L1, - "minkowski": DistanceType.LpUnexpanded, + "canberra": DistanceType.Canberra, "chebyshev": DistanceType.Linf, - "linf": DistanceType.Linf, + "cityblock": DistanceType.L1, "cosine": DistanceType.CosineExpanded, "correlation": DistanceType.CorrelationExpanded, - "hellinger": DistanceType.HellingerExpanded, + "dice": DistanceType.DiceExpanded, + "euclidean": DistanceType.L2SqrtUnexpanded, "hamming": DistanceType.HammingUnexpanded, + "hellinger": DistanceType.HellingerExpanded, "jaccard": DistanceType.JaccardExpanded, - "canberra": DistanceType.Canberra, - "dice": DistanceType.DiceExpanded, + "l1": DistanceType.L1, + "l2": DistanceType.L2SqrtUnexpanded, + "linf": DistanceType.Linf, + "manhattan": DistanceType.L1, + "minkowski": DistanceType.LpUnexpanded, + "sqeuclidean": DistanceType.L2Unexpanded, + "taxicab": DistanceType.L1, } @@ -159,6 +159,7 @@ DENSE_SUPPORTED_METRICS = [ DistanceType.Canberra, DistanceType.CorrelationExpanded, DistanceType.CosineExpanded, + DistanceType.DiceExpanded, DistanceType.HammingUnexpanded, DistanceType.HellingerExpanded, # DistanceType.JaccardExpanded, # not supported @@ -167,7 +168,6 @@ DENSE_SUPPORTED_METRICS = [ DistanceType.L2Unexpanded, DistanceType.Linf, DistanceType.LpUnexpanded, - DistanceType.DiceExpanded, ] @@ -175,6 +175,7 @@ SPARSE_SUPPORTED_METRICS = [ DistanceType.Canberra, DistanceType.CorrelationExpanded, DistanceType.CosineExpanded, + DistanceType.DiceExpanded, DistanceType.HammingUnexpanded, DistanceType.HellingerExpanded, DistanceType.JaccardExpanded, @@ -183,5 +184,4 @@ SPARSE_SUPPORTED_METRICS = [ DistanceType.L2Unexpanded, DistanceType.Linf, DistanceType.LpUnexpanded, - DistanceType.DiceExpanded, ] diff --git a/python/cuml/metrics/pairwise_distances.pyx b/python/cuml/metrics/pairwise_distances.pyx index d17cb415cc..269b1dbdc8 100644 --- a/python/cuml/metrics/pairwise_distances.pyx +++ b/python/cuml/metrics/pairwise_distances.pyx @@ -81,7 +81,7 @@ PAIRWISE_DISTANCE_METRICS = { "kldivergence": DistanceType.KLDivergence, "russellrao": DistanceType.RusselRaoExpanded, "nan_euclidean": DistanceType.L2Expanded, - "dice": DistanceType.DiceExpanded + "dice": DistanceType.DiceExpanded, } PAIRWISE_DISTANCE_SPARSE_METRICS = { @@ -98,7 +98,7 @@ PAIRWISE_DISTANCE_SPARSE_METRICS = { "jaccard": DistanceType.JaccardExpanded, "hellinger": DistanceType.HellingerExpanded, "chebyshev": DistanceType.Linf, - "dice": DistanceType.DiceExpanded + "dice": DistanceType.DiceExpanded, } @@ -345,7 +345,7 @@ def pairwise_distances(X, Y=None, metric="euclidean", handle=None, if metric in ['nan_euclidean']: return nan_euclidean_distances(X, Y, **kwds) - if metric in ['russellrao', 'dice'] and not np.all(X.data == 1.): + if metric in {'russellrao', 'dice'} and not np.all(X.data == 1.): warnings.warn("X was converted to boolean for metric {}" .format(metric)) X = np.where(X != 0., 1.0, 0.0) @@ -368,7 +368,7 @@ def pairwise_distances(X, Y=None, metric="euclidean", handle=None, if (n_samples_x == 1 or n_features_x == 1): input_order = "K" - if metric in ['russellrao', 'dice'] and not np.all(Y.data == 1.): + if metric in {'russellrao', 'dice'} and not np.all(Y.data == 1.): warnings.warn("Y was converted to boolean for metric {}" .format(metric)) Y = np.where(Y != 0., 1.0, 0.0)