Skip to content

Conversation

mihaic
Copy link
Member

@mihaic mihaic commented Jun 5, 2025

No description provided.

@mihaic mihaic requested a review from Copilot June 5, 2025 00:31
@mihaic mihaic enabled auto-merge (squash) June 5, 2025 00:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an option to repeat query vectors when generating ground truth, updating both the CLI and associated test suites to support this new functionality.

  • Added new tests in test_generate_ground_truth.py for scenarios with shuffling and repeated queries.
  • Updated conftest.py with new constants and modified query file generation.
  • Enhanced generate_ground_truth in src/svsbench/generate_ground_truth.py to handle repeated queries via the new num_query_vectors parameter.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/test_generate_ground_truth.py New tests covering no-shuffle, shuffle, and repeated query scenarios.
tests/conftest.py Added constants and updated query path generation.
src/svsbench/generate_ground_truth.py Added new parameters and logic to optionally repeat queries.

Comment on lines +117 to +126
cursor = 0
while cursor < num_query_vectors:
permutation = rng.permutation(len(queries))
batch_size = min(num_query_vectors - cursor, len(queries))
queries_all[cursor : cursor + batch_size] = queries[
permutation[:batch_size]
]
ground_truth_all[cursor : cursor + batch_size] = idxs[
permutation[:batch_size]
]
Copy link
Preview

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

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

Consider adding inline comments within the while-loop block that repeats queries to clarify its logic and purpose, which can help future readers understand the batch-based repetition process.

Suggested change
cursor = 0
while cursor < num_query_vectors:
permutation = rng.permutation(len(queries))
batch_size = min(num_query_vectors - cursor, len(queries))
queries_all[cursor : cursor + batch_size] = queries[
permutation[:batch_size]
]
ground_truth_all[cursor : cursor + batch_size] = idxs[
permutation[:batch_size]
]
cursor = 0
# Repeat the process until we have generated the required number of query vectors.
while cursor < num_query_vectors:
# Generate a random permutation of the query indices to shuffle the queries.
permutation = rng.permutation(len(queries))
# Determine the size of the current batch, ensuring we don't exceed the total required.
batch_size = min(num_query_vectors - cursor, len(queries))
# Select a batch of queries based on the permutation and add them to the output array.
queries_all[cursor : cursor + batch_size] = queries[
permutation[:batch_size]
]
# Select the corresponding ground truth indices for the batch and add them to the output array.
ground_truth_all[cursor : cursor + batch_size] = idxs[
permutation[:batch_size]
]
# Update the cursor to reflect the number of queries processed so far.

Copilot uses AI. Check for mistakes.

@mihaic mihaic requested a review from aguerreb June 5, 2025 00:33
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