From c5e66fd49eb61fd7d53b9e6d34d15df57bbd0f64 Mon Sep 17 00:00:00 2001 From: Mickael Ide Date: Thu, 18 Mar 2021 09:54:20 -0700 Subject: [PATCH 1/3] Add Dice distance to distancetype enum --- cpp/include/raft/linalg/distance_type.h | 6 ++++-- cpp/include/raft/sparse/distance/distance.cuh | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cpp/include/raft/linalg/distance_type.h b/cpp/include/raft/linalg/distance_type.h index 0e36709a55..231b631057 100644 --- a/cpp/include/raft/linalg/distance_type.h +++ b/cpp/include/raft/linalg/distance_type.h @@ -52,8 +52,10 @@ enum DistanceType : unsigned short { Haversine = 13, /** Bray-Curtis distance **/ BrayCurtis = 14, - /** Jensen-Shannon distance**/ - JensenShannon = 15 + /** Jensen-Shannon distance **/ + JensenShannon = 15, + /** Dice-Sorensen distance **/ + DiceExpanded = 16 }; }; // namespace distance diff --git a/cpp/include/raft/sparse/distance/distance.cuh b/cpp/include/raft/sparse/distance/distance.cuh index 92492dc37a..c528dda539 100644 --- a/cpp/include/raft/sparse/distance/distance.cuh +++ b/cpp/include/raft/sparse/distance/distance.cuh @@ -55,7 +55,8 @@ static const std::unordered_set supportedDistance{ raft::distance::DistanceType::LpUnexpanded, raft::distance::DistanceType::JaccardExpanded, raft::distance::DistanceType::CosineExpanded, - raft::distance::DistanceType::HellingerExpanded}; + raft::distance::DistanceType::HellingerExpanded, + raft::distance::DistanceType::DiceExpanded}; /** * Compute pairwise distances between A and B, using the provided @@ -116,6 +117,9 @@ void pairwiseDistance(value_t *out, hellinger_expanded_distances_t(input_config) .compute(out); break; + case raft::distance::DistanceType::DiceExpanded: + dice_expanded_distances_t(input_config) + .compute(out); default: THROW("Unsupported distance: %d", metric); From 59ab843913bd4652415fa5d7ae458f9e402c5632 Mon Sep 17 00:00:00 2001 From: Mickael Ide Date: Thu, 18 Mar 2021 10:00:18 -0700 Subject: [PATCH 2/3] fix style --- cpp/include/raft/sparse/distance/distance.cuh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/include/raft/sparse/distance/distance.cuh b/cpp/include/raft/sparse/distance/distance.cuh index c528dda539..c6ec40cb03 100644 --- a/cpp/include/raft/sparse/distance/distance.cuh +++ b/cpp/include/raft/sparse/distance/distance.cuh @@ -118,8 +118,7 @@ void pairwiseDistance(value_t *out, .compute(out); break; case raft::distance::DistanceType::DiceExpanded: - dice_expanded_distances_t(input_config) - .compute(out); + dice_expanded_distances_t(input_config).compute(out); default: THROW("Unsupported distance: %d", metric); From 9cdab24ff6d29c7c578253285c127155e5353534 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 24 Mar 2021 16:31:26 -0400 Subject: [PATCH 3/3] Adding comma --- cpp/include/raft/linalg/distance_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/include/raft/linalg/distance_type.h b/cpp/include/raft/linalg/distance_type.h index 7ad43fa38c..f3a22a07ed 100644 --- a/cpp/include/raft/linalg/distance_type.h +++ b/cpp/include/raft/linalg/distance_type.h @@ -55,7 +55,7 @@ enum DistanceType : unsigned short { /** Jensen-Shannon distance **/ JensenShannon = 15, /** Dice-Sorensen distance **/ - DiceExpanded = 16 + DiceExpanded = 16, /** Precomputed (special value) **/ Precomputed = 100 };