class_docstr: Exact nearest neighbors using a lazy search estrategy.
  
  Parameters
  ----------
  window_size
      Size of the sliding window use to search neighbors with.
  min_distance_keep
      The minimum distance (similarity) to consider adding a point to the window.
      E.g., a value of 0.0 will add even exact duplicates.
  dist_func
      A distance function which accepts two input items to compare. If not set,
      use the Minkowski distance with `p=2`.
  
  Notes
  -----
  Updates are by default stored by the FIFO (first in first out) method,
  which means that when the size limit is reached, old samples are dumped to
  give room for new samples. This is circular, meaning that older points
  are dumped first. This also gives the implementation a temporal aspect,
  because older samples are replaced with newer ones.
  
  The parameter `min_dinstance_keep` controls the addition of new items to the
  window - items that are far enough away (> min_distance_keep) are added to
  the window. Thus a value of 0 indicates that we add all points, and
  increasing from 0 makes it less likely we will keep a new item.
class_docstr_tok: ["Exact","nearest","neighbors","using","a","lazy","search","estrategy",".","Parameters","--","--","--","--","--","window_size","Size","of","the","sliding","window","use","to","search","neighbors","with",".","min_distance_keep","The","minimum","distance","(","similarity",")","to","consider","adding","a","point","to","the","window",".","E.g.",",","a","value","of","0.0","will","add","even","exact","duplicates",".","dist_func","A","distance","function","which","accepts","two","input","items","to","compare",".","If","not","set",",","use","the","Minkowski","distance","with","`","p=2","`",".","Notes","--","--","-","Updates","are","by","default","stored","by","the","FIFO","(","first","in","first","out",")","method",",","which","means","that","when","the","size","limit","is","reached",",","old","samples","are","dumped","to","give","room","for","new","samples",".","This","is","circular",",","meaning","that","older","points","are","dumped","first",".","This","also","gives","the","implementation","a","temporal","aspect",",","because","older","samples","are","replaced","with","newer","ones",".","The","parameter","`","min_dinstance_keep","`","controls","the","addition","of","new","items","to","the","window","-","items","that","are","far","enough","away","(",">","min_distance_keep",")","are","added","to","the","window",".","Thus","a","value","of","0","indicates","that","we","add","all","points",",","and","increasing","from","0","makes","it","less","likely","we","will","keep","a","new","item","."]
docstr: Find the `n_neighbors` closest points to `item`, along with their distances.
docstr_tok: ["Find","the","`","n_neighbors","`","closest","points","to","`","item","`",",","along","with","their","distances","."]
code: def search(self, item: typing.Any, n_neighbors: int, **kwargs):
      """Find the `n_neighbors` closest points to `item`, along with their distances."""
      # Compute the distances to each point in the window
      # The window is (item, <extra>, distance)
      points = ((*p, self.dist_func(item, p[0])) for p in self.window)
  
      # Return the k closest points
      return tuple(
          map(
              list,
              zip(
                  *sorted(points, key=operator.itemgetter(-1))[
                      :n_neighbors
                  ]
              ),
          )
      )
  
file_path: river/river/neighbors/lazy.py
imports: from __future__ import annotations
  import collections
  import functools
  import operator
  import typing
  from river import utils
  from .base import BaseNN, DistanceFunc, FunctionWrapper
label_desc: Use image node_id 4 for calling the LazySearch obj's underlying member method code with example usage: obj.search(item, n_neighbors) and returns: tuple