Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def __init__(
self._update_ef_search_before_search(client)
self._load_graphs_to_memory(client)

def need_normalize_cosine(self) -> bool:
if self.case_config.metric_type.upper() == "COSINE":
log.info("cosine dataset need normalize.")
return True
return False
Copy link
Collaborator

Choose a reason for hiding this comment

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

The need_normalize_cosine function is designed for databases that do NOT natively support cosine similarity metrics. When testing cosine-based datasets, this function normalizes all training and query vectors before tests, to make the metric equivalent to L2 (Euclidean) or IP (Inner Product), ensuring accurate recall calculations. This is a workaround solution when cosine similarity is not directly supported.

For databases that already support cosine similarity, we do not recommend enabling this feature. The goal is to maintain consistent benchmarking across different databases and ensure fair testing conditions.


def _create_index(self, client: OpenSearch) -> None:
ef_search_value = self.case_config.ef_search
log.info(f"Creating index with ef_search: {ef_search_value}")
Expand Down