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: Update the window with a new point, only added if > min distance.
  
  If min distance is 0, we do not need to do the calculation. The item
  (and extra metadata) will not be added to the window if it is too close
  to an existing point.
  
  Parameters
  ----------
  item
      The data intended to be provided to the distance function.
  extra
      Metadata that is separate from the item that should also be added
      to the window, but is not included to be passed to the distance
      function.
  
  Returns
  -------
  A boolean (true/false) to indicate if the point was added.
docstr_tok: ["Update","the","window","with","a","new","point",",","only","added","if",">","min","distance",".","If","min","distance","is","0",",","we","do","not","need","to","do","the","calculation",".","The","item","(","and","extra","metadata",")","will","not","be","added","to","the","window","if","it","is","too","close","to","an","existing","point",".","Parameters","--","--","--","--","--","item","The","data","intended","to","be","provided","to","the","distance","function",".","extra","Metadata","that","is","separate","from","the","item","that","should","also","be","added","to","the","window",",","but","is","not","included","to","be","passed","to","the","distance","function",".","Returns","--","--","--","-","A","boolean","(","true\/false",")","to","indicate","if","the","point","was","added","."]
code: def update(
      self,
      item: typing.Any,
      n_neighbors: int = 1,
      extra: typing.Any | None = None,
  ):
      """Update the window with a new point, only added if > min distance.
  
      If min distance is 0, we do not need to do the calculation. The item
      (and extra metadata) will not be added to the window if it is too close
      to an existing point.
  
      Parameters
      ----------
      item
          The data intended to be provided to the distance function.
      extra
          Metadata that is separate from the item that should also be added
          to the window, but is not included to be passed to the distance
          function.
  
      Returns
      -------
      A boolean (true/false) to indicate if the point was added.
  
      """
      # If min distance is 0, we add all points
      if self.min_distance_keep == 0:
          self.append(item, extra=extra)
          return True
  
      # Don't add VERY similar points to window
      nearest = self.search(item, n_neighbors)
  
      # Distance always in the last index, (item <extra> distance)
      if not nearest or nearest[0][-1] < self.min_distance_keep:
          self.append(item, extra=extra)
          return True
      return False
  
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 3 for calling the LazySearch obj's underlying member method code with example usage: obj.update(item, n_neighbors, extra) and returns: False, True, True