docstr: Initialize trust scores.
  
  Parameters
  ----------
  k_filter
      Number of neighbors used during either kNN distance or probability filtering.
  alpha
      Fraction of instances to filter out to reduce impact of outliers.
  filter_type
      Filter method: ``'distance_knn'`` | ``'probability_knn'``.
  leaf_size
      Number of points at which to switch to brute-force. Affects speed and memory required to build trees.
      Memory to store the tree scales with `n_samples / leaf_size`.
  metric
      Distance metric used for the tree. See `sklearn` DistanceMetric class for a list of available metrics.
  dist_filter_type
      Use either the distance to the k-nearest point (``dist_filter_type = 'point'``) or
      the average distance from the first to the k-nearest point in the data (``dist_filter_type = 'mean'``).
code: def __init__(
      self,
      k_filter: int = 10,
      alpha: float = 0.0,
      filter_type: Optional[str] = None,
      leaf_size: int = 40,
      metric: str = "euclidean",
      dist_filter_type: str = "point",
  ) -> None:
      """
      Initialize trust scores.
  
      Parameters
      ----------
      k_filter
          Number of neighbors used during either kNN distance or probability filtering.
      alpha
          Fraction of instances to filter out to reduce impact of outliers.
      filter_type
          Filter method: ``'distance_knn'`` | ``'probability_knn'``.
      leaf_size
          Number of points at which to switch to brute-force. Affects speed and memory required to build trees.
          Memory to store the tree scales with `n_samples / leaf_size`.
      metric
          Distance metric used for the tree. See `sklearn` DistanceMetric class for a list of available metrics.
      dist_filter_type
          Use either the distance to the k-nearest point (``dist_filter_type = 'point'``) or
          the average distance from the first to the k-nearest point in the data (``dist_filter_type = 'mean'``).
      """
      self.k_filter = k_filter
      self.alpha = alpha
      self.filter = filter_type
      self.eps = 1e-12
      self.leaf_size = leaf_size
      self.metric = metric
      self.dist_filter_type = dist_filter_type
  
file_path: alibi/alibi/confidence/trustscore.py
imports: import logging
  from typing import Any, Optional, Tuple
  import numpy
  from sklearn.neighbors import KDTree, KNeighborsClassifier
label_desc: Use image node_id 1 to create a new TrustScore object  with example: obj = TrustScore(k_filter, alpha, filter_type, leaf_size, metric, dist_filter_type)