code: def self_recall(
      index: Index, sample: float = 1, **kwargs
  ) -> SearchStats:
      """Simplest benchmark for a quality of search, which queries every
      existing member of the index, to make sure approximate search finds
      the point itself.
  
      :param index: Non-empty pre-constructed index
      :type index: Index
      :param sample: Share of vectors to search, defaults to 1
      :type sample: float
      :return: Evaluation report with key metrics
      :rtype: SearchStats
      """
      if len(index) == 0:
          return 0
      if "count" not in kwargs:
          kwargs["count"] = 1
  
      if "keys" in kwargs:
          keys = kwargs["keys"]
      else:
          keys = np.array(index.keys)
  
      if sample != 1:
          keys = np.random.choice(keys, int(ceil(len(keys) * sample)))
  
      queries = index.get(keys, index.dtype)
      matches: BatchMatches = index.search(queries, **kwargs)
      count_matches: float = matches.count_matches(keys)
      return SearchStats(
          index_size=len(index),
          count_queries=len(keys),
          count_matches=count_matches,
          visited_members=matches.visited_members,
          computed_distances=matches.computed_distances,
      )
  
imports: from __future__ import annotations
  from time import time_ns
  from typing import Tuple, Any, Callable, Union, Optional, List
  from dataclasses import dataclass, asdict
  from collections import defaultdict
  from math import ceil
  import numpy
  from usearch.io import load_matrix
  from usearch.index import Index, Matches, BatchMatches, MetricKind, MetricKindBitwise, Key
label_desc: Use image node_id 2 for calling a global function with example usage: self_recall(index, sample) and returns: SearchStats, int