Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_cuvs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ endfunction()
# To use a different CUVS locally, set the CMake variable
# CPM_cuvs_SOURCE=/path/to/local/cuvs
find_and_configure_cuvs(VERSION ${CUML_MIN_VERSION_cuvs}
FORK rapidsai
PINNED_TAG branch-${CUML_BRANCH_VERSION_cuvs}
FORK aamijar
PINNED_TAG umap-dice-coefficient
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove later

EXCLUDE_FROM_ALL ${CUML_EXCLUDE_CUVS_FROM_ALL}
# When PINNED_TAG above doesn't match cuml,
# force local cuvs clone in build directory
Expand Down
5 changes: 4 additions & 1 deletion python/cuml/cuml/manifold/umap_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ _METRICS = {
"hellinger": DistanceType.HellingerExpanded,
"hamming": DistanceType.HammingUnexpanded,
"jaccard": DistanceType.JaccardExpanded,
"canberra": DistanceType.Canberra
"canberra": DistanceType.Canberra,
"dice": DistanceType.DiceExpanded,
}

_SUPPORTED_METRICS = {
Expand All @@ -168,6 +169,7 @@ _SUPPORTED_METRICS = {
DistanceType.L2Expanded,
DistanceType.Linf,
DistanceType.LpUnexpanded,
DistanceType.DiceExpanded,
)),
"dense": frozenset((
DistanceType.Canberra,
Expand All @@ -181,6 +183,7 @@ _SUPPORTED_METRICS = {
DistanceType.L2Expanded,
DistanceType.Linf,
DistanceType.LpUnexpanded,
DistanceType.DiceExpanded,
))
}
}
Expand Down
7 changes: 4 additions & 3 deletions python/cuml/cuml/metrics/pairwise_distances.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ PAIRWISE_DISTANCE_METRICS = {
"hamming": DistanceType.HammingUnexpanded,
"kldivergence": DistanceType.KLDivergence,
"russellrao": DistanceType.RusselRaoExpanded,
"nan_euclidean": DistanceType.L2Expanded
"nan_euclidean": DistanceType.L2Expanded,
"dice": DistanceType.DiceExpanded
}

PAIRWISE_DISTANCE_SPARSE_METRICS = {
Expand Down Expand Up @@ -350,7 +351,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'] 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)
Expand All @@ -377,7 +378,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'] 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)
Expand Down
2 changes: 2 additions & 0 deletions python/cuml/cuml/tests/test_umap.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ def test_fuzzy_simplicial_set(n_rows, n_features, n_neighbors):
@pytest.mark.parametrize(
"metric,build_algo,supported",
[
("dice", "brute_force_knn", True),
("l2", "brute_force_knn", True),
("euclidean", "brute_force_knn", True),
("sqeuclidean", "brute_force_knn", True),
Expand Down Expand Up @@ -767,6 +768,7 @@ def test_umap_distance_metrics_fit_transform_trust(
@pytest.mark.parametrize(
"metric,supported,umap_learn_supported",
[
("dice", True, False),
("l2", True, False),
("euclidean", True, True),
("sqeuclidean", True, False),
Expand Down
Loading