Skip to content

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
MChatzakis:mainfrom
arihant1006:feature/wetw-messi
Open

Conversation

@arihant1006
Copy link
Copy Markdown

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);

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);
@arihant1006 arihant1006 force-pushed the feature/wetw-messi branch from 1ceb156 to 0eba5c4 Compare May 30, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant