class_docstr: Performs approximate nearest neighbor search using LSH forest.
  
  LSH Forest: Locality Sensitive Hashing forest [1] is an alternative
  method for vanilla approximate nearest neighbor search methods.
  LSH forest data structure has been implemented using sorted
  arrays and binary search and 32 bit fixed-length hashes.
  Random projection is used as the hash family which approximates
  cosine distance.
  
  The cosine distance is defined as ``1 - cosine_similarity``: the lowest
  value is 0 (identical point) but it is bounded above by 2 for the farthest
  points. Its value does not depend on the norm of the vector points but
  only on their relative angles.
  
  Read more in the :ref:`User Guide <approximate_nearest_neighbors>`.
  
  Parameters
  ----------
  
  n_estimators : int (default = 10)
      Number of trees in the LSH Forest.
  
  min_hash_match : int (default = 4)
      lowest hash length to be searched when candidate selection is
      performed for nearest neighbors.
  
  n_candidates : int (default = 10)
      Minimum number of candidates evaluated per estimator, assuming enough
      items meet the `min_hash_match` constraint.
  
  n_neighbors : int (default = 5)
      Number of neighbors to be returned from query function when
      it is not provided to the :meth:`kneighbors` method.
  
  radius : float, optinal (default = 1.0)
      Radius from the data point to its neighbors. This is the parameter
      space to use by default for the :meth`radius_neighbors` queries.
  
  radius_cutoff_ratio : float, optional (default = 0.9)
      A value ranges from 0 to 1. Radius neighbors will be searched until
      the ratio between total neighbors within the radius and the total
      candidates becomes less than this value unless it is terminated by
      hash length reaching `min_hash_match`.
  
  random_state : int, RandomState instance or None, optional (default=None)
      If int, random_state is the seed used by the random number generator;
      If RandomState instance, random_state is the random number generator;
      If None, the random number generator is the RandomState instance used
      by `np.random`.
  
  Attributes
  ----------
  
  hash_functions_ : list of GaussianRandomProjectionHash objects
      Hash function g(p,x) for a tree is an array of 32 randomly generated
      float arrays with the same dimension as the data set. This array is
      stored in GaussianRandomProjectionHash object and can be obtained
      from ``components_`` attribute.
  
  trees_ : array, shape (n_estimators, n_samples)
      Each tree (corresponding to a hash function) contains an array of
      sorted hashed values. The array representation may change in future
      versions.
  
  original_indices_ : array, shape (n_estimators, n_samples)
      Original indices of sorted hashed values in the fitted index.
  
  References
  ----------
  
  .. [1] M. Bawa, T. Condie and P. Ganesan, "LSH Forest: Self-Tuning
         Indexes for Similarity Search", WWW '05 Proceedings of the
         14th international conference on World Wide Web,  651-660,
         2005.
  
  Examples
  --------
    >>> from sklearn.neighbors import LSHForest
  
    >>> X_train = [[5, 5, 2], [21, 5, 5], [1, 1, 1], [8, 9, 1], [6, 10, 2]]
    >>> X_test = [[9, 1, 6], [3, 1, 10], [7, 10, 3]]
    >>> lshf = LSHForest(random_state=42)
    >>> lshf.fit(X_train)  # doctest: +NORMALIZE_WHITESPACE
    LSHForest(min_hash_match=4, n_candidates=50, n_estimators=10,
              n_neighbors=5, radius=1.0, radius_cutoff_ratio=0.9,
              random_state=42)
    >>> distances, indices = lshf.kneighbors(X_test, n_neighbors=2)
    >>> distances                                        # doctest: +ELLIPSIS
    array([[ 0.069...,  0.149...],
           [ 0.229...,  0.481...],
           [ 0.004...,  0.014...]])
    >>> indices
    array([[1, 2],
           [2, 0],
           [4, 0]])
class_docstr_tok: ["Performs","approximate","nearest","neighbor","search","using","LSH","forest",".","LSH","Forest",":","Locality","Sensitive","Hashing","forest","[","1","]","is","an","alternative","method","for","vanilla","approximate","nearest","neighbor","search","methods",".","LSH","forest","data","structure","has","been","implemented","using","sorted","arrays","and","binary","search","and","32","bit","fixed-length","hashes",".","Random","projection","is","used","as","the","hash","family","which","approximates","cosine","distance",".","The","cosine","distance","is","defined","as","``","1","-","cosine_similarity","``",":","the","lowest","value","is","0","(","identical","point",")","but","it","is","bounded","above","by","2","for","the","farthest","points",".","Its","value","does","not","depend","on","the","norm","of","the","vector","points","but","only","on","their","relative","angles",".","Read","more","in","the",":","ref",":","`","User","Guide","<","approximate_nearest_neighbors",">","`",".","Parameters","--","--","--","--","--","n_estimators",":","int","(","default","=","10",")","Number","of","trees","in","the","LSH","Forest",".","min_hash_match",":","int","(","default","=","4",")","lowest","hash","length","to","be","searched","when","candidate","selection","is","performed","for","nearest","neighbors",".","n_candidates",":","int","(","default","=","10",")","Minimum","number","of","candidates","evaluated","per","estimator",",","assuming","enough","items","meet","the","`","min_hash_match","`","constraint",".","n_neighbors",":","int","(","default","=","5",")","Number","of","neighbors","to","be","returned","from","query","function","when","it","is","not","provided","to","the",":","meth",":","`","kneighbors","`","method",".","radius",":","float",",","optinal","(","default","=","1.0",")","Radius","from","the","data","point","to","its","neighbors",".","This","is","the","parameter","space","to","use","by","default","for","the",":","meth","`","radius_neighbors","`","queries",".","radius_cutoff_ratio",":","float",",","optional","(","default","=","0.9",")","A","value","ranges","from","0","to","1",".","Radius","neighbors","will","be","searched","until","the","ratio","between","total","neighbors","within","the","radius","and","the","total","candidates","becomes","less","than","this","value","unless","it","is","terminated","by","hash","length","reaching","`","min_hash_match","`",".","random_state",":","int",",","RandomState","instance","or","None",",","optional","(","default=None",")","If","int",",","random_state","is","the","seed","used","by","the","random","number","generator",";","If","RandomState","instance",",","random_state","is","the","random","number","generator",";","If","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","`","np.random","`",".","Attributes","--","--","--","--","--","hash_functions_",":","list","of","GaussianRandomProjectionHash","objects","Hash","function","g","(","p",",","x",")","for","a","tree","is","an","array","of","32","randomly","generated","float","arrays","with","the","same","dimension","as","the","data","set",".","This","array","is","stored","in","GaussianRandomProjectionHash","object","and","can","be","obtained","from","``","components_","``","attribute",".","trees_",":","array",",","shape","(","n_estimators",",","n_samples",")","Each","tree","(","corresponding","to","a","hash","function",")","contains","an","array","of","sorted","hashed","values",".","The","array","representation","may","change","in","future","versions",".","original_indices_",":","array",",","shape","(","n_estimators",",","n_samples",")","Original","indices","of","sorted","hashed","values","in","the","fitted","index",".","References","--","--","--","--","--","..","[","1","]","M.","Bawa",",","T.","Condie","and","P.","Ganesan",",","``","LSH","Forest",":","Self-Tuning","Indexes","for","Similarity","Search","''",",","WWW","'05","Proceedings","of","the","14th","international","conference","on","World","Wide","Web",",","651-660",",","2005",".","Examples","--","--","--","--",">",">",">","from","sklearn.neighbors","import","LSHForest",">",">",">","X_train","=","[","[","5",",","5",",","2","]",",","[","21",",","5",",","5","]",",","[","1",",","1",",","1","]",",","[","8",",","9",",","1","]",",","[","6",",","10",",","2","]","]",">",">",">","X_test","=","[","[","9",",","1",",","6","]",",","[","3",",","1",",","10","]",",","[","7",",","10",",","3","]","]",">",">",">","lshf","=","LSHForest","(","random_state=42",")",">",">",">","lshf.fit","(","X_train",")","#","doctest",":","+NORMALIZE_WHITESPACE","LSHForest","(","min_hash_match=4",",","n_candidates=50",",","n_estimators=10",",","n_neighbors=5",",","radius=1.0",",","radius_cutoff_ratio=0.9",",","random_state=42",")",">",">",">","distances",",","indices","=","lshf.kneighbors","(","X_test",",","n_neighbors=2",")",">",">",">","distances","#","doctest",":","+ELLIPSIS","array","(","[","[","0.069","...",",","0.149","...","]",",","[","0.229","...",",","0.481","...","]",",","[","0.004","...",",","0.014","...","]","]",")",">",">",">","indices","array","(","[","[","1",",","2","]",",","[","2",",","0","]",",","[","4",",","0","]","]",")"]
docstr: Fit the LSH forest on the data.
  
  This creates binary hashes of input data points by getting the
  dot product of input points and hash_function then
  transforming the projection into a binary string array based
  on the sign (positive/negative) of the projection.
  A sorted array of binary hashes is created.
  
  Parameters
  ----------
  X : array_like or sparse (CSR) matrix, shape (n_samples, n_features)
      List of n_features-dimensional data points. Each row
      corresponds to a single data point.
  
  Returns
  -------
  self : object
      Returns self.
docstr_tok: ["Fit","the","LSH","forest","on","the","data",".","This","creates","binary","hashes","of","input","data","points","by","getting","the","dot","product","of","input","points","and","hash_function","then","transforming","the","projection","into","a","binary","string","array","based","on","the","sign","(","positive\/negative",")","of","the","projection",".","A","sorted","array","of","binary","hashes","is","created",".","Parameters","--","--","--","--","--","X",":","array_like","or","sparse","(","CSR",")","matrix",",","shape","(","n_samples",",","n_features",")","List","of","n_features-dimensional","data","points",".","Each","row","corresponds","to","a","single","data","point",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def fit(self, X, y=None):
      """Fit the LSH forest on the data.
  
      This creates binary hashes of input data points by getting the
      dot product of input points and hash_function then
      transforming the projection into a binary string array based
      on the sign (positive/negative) of the projection.
      A sorted array of binary hashes is created.
  
      Parameters
      ----------
      X : array_like or sparse (CSR) matrix, shape (n_samples, n_features)
          List of n_features-dimensional data points. Each row
          corresponds to a single data point.
  
      Returns
      -------
      self : object
          Returns self.
      """
  
      self._fit_X = check_array(X, accept_sparse="csr")
  
      # Creates a g(p,x) for each tree
      self.hash_functions_ = []
      self.trees_ = []
      self.original_indices_ = []
  
      rng = check_random_state(self.random_state)
      int_max = np.iinfo(np.int32).max
  
      for i in range(self.n_estimators):
          # This is g(p,x) for a particular tree.
          # Builds a single tree. Hashing is done on an array of data points.
          # `GaussianRandomProjection` is used for hashing.
          # `n_components=hash size and n_features=n_dim.
          hasher = GaussianRandomProjectionHash(
              MAX_HASH_SIZE, rng.randint(0, int_max)
          )
          hashes = hasher.fit_transform(self._fit_X)[:, 0]
          original_index = np.argsort(hashes)
          bin_hashes = hashes[original_index]
          self.original_indices_.append(original_index)
          self.trees_.append(bin_hashes)
          self.hash_functions_.append(hasher)
  
      self._generate_masks()
  
      return self
  
imports: import numpy
  import warnings
  from scipy import sparse
  from .base import KNeighborsMixin, RadiusNeighborsMixin
  from ..base import BaseEstimator
  from ..utils.validation import check_array
  from ..utils import check_random_state
  from ..metrics.pairwise import pairwise_distances
  from ..random_projection import GaussianRandomProjection
label_desc: Use image node_id 6 for calling the LSHForest obj's underlying member method code with example usage: obj.fit(X, y) and returns: self