Adds WETW distance support to MESSI. Changes are additive - DTW and L2 untouched. Four files changed. See commit message for full breakdown.#57
Open
arihant1006 wants to merge 1 commit into
Conversation
Integrates Weighted Euclidean with Time Warping (WETW) as a third
distance type alongside the existing L2_SQUARED and DTW modes.
Changes:
- DistanceComputer.hpp: add WETW = 2 to DistanceType enum
- iSAXIndex.hpp: add min_weight_vec field to isax_node for per-subtree
per-dimension minimum weight vectors (filled bottom-up post index build)
- Messi.hpp: WETW fields in MESSI_workerdata, new private methods and
data members, public setWeightData/setQueryWeights/computeMinWeights API
- Messi.cpp: four new functions mirroring the DTW pipeline:
insert_tree_node_m_hybridpqueue_WETW (node-level LB traversal)
calculate_node_WETW_inmemory (leaf-level 2-cascade filter)
MESSI_topk_search_worker_WETW (parallel worker thread)
MESSI_search_topk_WETW + searchIndexWETW (query entry points)
Plus compute_node_min_weights + computeMinWeights for the bottom-up
per-node min weight vector computation.
Lower bounds used:
Node level: min_j(w_q[j] + node->min_weight_vec[j]) * MINDIST_iSAX
Series level: ||(w_q + w_min_db) ⊙ (q - c)|| (per-dimension)
True dist: ||(w_q + w_c) ⊙ (q - c)|| (exact WETW)
Usage after this patch:
Messi messi(DistanceType::WETW);
messi.buildIndex(data_source); // index built on embeddings
messi.setWeightData(db_w); // per-series weight vectors [N*dim]
messi.computeMinWeights(); // fills node vectors bottom-up
messi.setQueryWeights(query_w); // query weight vector [dim]
messi.searchIndex(q, n, k, I, D);
1ceb156 to
0eba5c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrates Weighted Euclidean with Time Warping (WETW) as a third distance type alongside the existing L2_SQUARED and DTW modes.
Changes:
calculate_node_WETW_inmemory (leaf-level 2-cascade filter)
MESSI_topk_search_worker_WETW (parallel worker thread)
MESSI_search_topk_WETW + searchIndexWETW (query entry points)
Plus compute_node_min_weights + computeMinWeights for the bottom-up
per-node min weight vector computation.
Lower bounds used:
Node level: min_j(w_q[j] + node->min_weight_vec[j]) * MINDIST_iSAX
Series level: ||(w_q + w_min_db) ⊙ (q - c)|| (per-dimension)
True dist: ||(w_q + w_c) ⊙ (q - c)|| (exact WETW)
Usage after this patch:
Messi messi(DistanceType::WETW);
messi.buildIndex(data_source); // index built on embeddings
messi.setWeightData(db_w); // per-series weight vectors [N*dim]
messi.computeMinWeights(); // fills node vectors bottom-up
messi.setQueryWeights(query_w); // query weight vector [dim]
messi.searchIndex(q, n, k, I, D);