Scores from Index at extra positions are not filtered out
{'login': 'vishalsrao', 'id': 36671559, 'node_id': 'MDQ6VXNlcjM2NjcxNTU5', 'avatar_url': 'https://avatars.githubusercontent.com/u/36671559?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/vishalsrao', 'html_url': 'https://github.com/vishalsrao', 'followers_url': 'https://api.github.com/users/vishalsrao/followers', 'following_url': 'https://api.github.com/users/vishalsrao/following{/other_user}', 'gists_url': 'https://api.github.com/users/vishalsrao/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/vishalsrao/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/vishalsrao/subscriptions', 'organizations_url': 'https://api.github.com/users/vishalsrao/orgs', 'repos_url': 'https://api.github.com/users/vishalsrao/repos', 'events_url': 'https://api.github.com/users/vishalsrao/events{/privacy}', 'received_events_url': 'https://api.github.com/users/vishalsrao/received_events', 'type': 'User', 'site_admin': False}
[{'id': 1935892857, 'node_id': 'MDU6TGFiZWwxOTM1ODkyODU3', 'url': 'https://api.github.com/repos/huggingface/datasets/labels/bug', 'name': 'bug', 'color': 'd73a4a', 'default': True, 'description': "Something isn't working"}]
[]
Hi! Yes, that makes sense! Would you like to submit a PR to fix this? Created PR https://github.com/huggingface/datasets/pull/3971
If a FAISS index has fewer records than the requested number of top results (k), then it returns -1 in indices for the additional positions. The get_nearest_examples method only filters out the extra results from the dataset samples. It would be better to filter out extra scores too.

Reference: https://github.com/huggingface/datasets/blob/2.0.0/src/datasets/search.py#L693

{'url': 'https://api.github.com/repos/huggingface/datasets/issues/3961/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}