class_docstr: A nearest neighbor distance metric that, for each target, returns
  the closest distance to any sample that has been observed so far.
  
  Args:
      metric (str): Either "euclidean" or "cosine".
      matching_threshold (float): The matching threshold. Samples with larger
          distance are considered an invalid match.
      budget (Optional[int]): If not None, fix samples per class to at most
          this number. Removes the oldest samples when the budget is reached.
  
  Attributes:
      samples (Dict[int -> List[ndarray]]): A dictionary that maps from target
          identities to the list of samples that have been observed so far.
docstr: Update the distance metric with new data.
  
  Args:
      features (ndarray): An NxM matrix of N features of dimensionality M.
      targets (ndarray): An integer array of associated target identities.
      active_targets (List[int]): A list of targets that are currently
          present in the scene.
docstr_tok: ["Update","the","distance","metric","with","new","data",".","Args",":","features","(","ndarray",")",":","An","NxM","matrix","of","N","features","of","dimensionality","M.","targets","(","ndarray",")",":","An","integer","array","of","associated","target","identities",".","active_targets","(","List","[","int","]",")",":","A","list","of","targets","that","are","currently","present","in","the","scene","."]
code: def partial_fit(self, features, targets, active_targets):
      """
      Update the distance metric with new data.
  
      Args:
          features (ndarray): An NxM matrix of N features of dimensionality M.
          targets (ndarray): An integer array of associated target identities.
          active_targets (List[int]): A list of targets that are currently
              present in the scene.
      """
      for feature, target in zip(features, targets):
          self.samples.setdefault(target, []).append(feature)
          if self.budget is not None:
              self.samples[target] = self.samples[target][
                  -self.budget :
              ]
      self.samples = {k: self.samples[k] for k in active_targets}
  
file_path: PaddleHub/modules/video/multiple_object_tracking/jde_darknet53/modeling/mot/matching/deepsort_matching.py
imports: import numpy
  from scipy.optimize import linear_sum_assignment
  from ..motion import kalman_filter
label_desc: Use image node_id 2 for calling the NearestNeighborDistanceMetric obj's underlying member method code with example usage: obj.partial_fit(features, targets, active_targets) without return types