From 37434f5baf632e839dc14b3c7d8745287cb9368a Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Tue, 25 Jul 2023 11:17:36 -0400 Subject: Benchmarks: mtree and vptree benchmark updates Note: cosine similarity doesn't seem to work for VPTree--I don't think that it is actually a metric, upon further research. At the very least I can't find anyone claiming it is, and I've found several people claiming it isn't. On testing with the Word2Vec data, Euclidean distance works insofar as the M-Tree and VPTree return the same KNN results for test queries, whereas Cosine Similarity does not work. --- benchmarks/include/bench_utility.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'benchmarks/include/bench_utility.h') diff --git a/benchmarks/include/bench_utility.h b/benchmarks/include/bench_utility.h index 6610ab4..28040be 100644 --- a/benchmarks/include/bench_utility.h +++ b/benchmarks/include/bench_utility.h @@ -40,7 +40,7 @@ typedef de::WeightedRecord WRec; typedef de::Record Rec; const size_t W2V_SIZE = 300; -typedef de::CosinePoint Word2VecRec; +typedef de::EuclidPoint Word2VecRec; typedef de::DynamicExtension, de::WSSQuery> ExtendedWSS; typedef de::DynamicExtension, de::TrieSplineRangeQuery> ExtendedTSRQ; @@ -68,6 +68,17 @@ struct btree_key_extract { } }; +struct euclidean_distance { + double operator()(const Word2VecRec &first, const Word2VecRec &second) const { + double dist = 0; + for (size_t i=0; i TreeMap; -typedef mt::mtree MTree; +typedef mt::mtree MTree; static gsl_rng *g_rng; static std::set *g_to_delete; -- cgit v1.2.3