Module Expr Str Import alias identifier Import alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str Assign NameStore Str Assign NameStore BinOpMult AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Num FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpBitAnd NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpBitOr NameLoad NameLoad keyword Str Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore CompareGt NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore SubscriptLoad NameLoad Index CompareLt NameLoad NameLoad While SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign NameStore BinOpFloorDiv BinOpAdd Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Num Assign TupleStore NameStore NameStore Call NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore CompareGt NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index NameLoad BinOpAdd NameLoad Num Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index UnaryOpInvert NameLoad SubscriptLoad NameLoad Index UnaryOpInvert NameLoad Assign NameStore SubscriptLoad NameLoad Index CompareLt NameLoad NameLoad Return NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body If CompareNotEq BinOpMod SubscriptLoad AttributeLoad NameLoad attr Index Num Num Num body Raise Call NameLoad Str Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Call AttributeLoad CompareGt NameLoad Num attr NameLoad attr keyword NameLoad Return Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num Num decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Return Call AttributeLoad NameLoad attr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults Num NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr keyword NameLoad keyword NameLoad decorator_list decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad keyword NameLoad Assign SubscriptStore NameLoad Slice NameLoad Return NameLoad decorator_list ClassDef bases NameLoad NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num Num Num Num Num NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If CompareEq AttributeLoad NameLoad attr TupleLoad Num body Return TupleLoad Call AttributeLoad NameLoad attr Num keyword AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num keyword NameLoad If Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword Num keyword Str Assign NameStore SubscriptLoad Call NameLoad NameLoad NameLoad keyword Str Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str keyword Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore BinOpAdd NameLoad Num Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad keyword NameLoad ExtSlice Slice Slice Num Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Num Slice Num Assign AttributeStore NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr keyword NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Num Assign NameStore Call NameLoad Assign NameStore BinOpMult AttributeLoad NameLoad attr AttributeLoad NameLoad attr While BoolOpAnd CompareGt NameLoad AttributeLoad NameLoad attr BoolOpOr CompareLt NameLoad NameLoad CompareLt Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad AugAssignAdd NameStore BinOpSub NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Slice NameLoad NameLoad attr AugAssignSub NameStore Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Call NameLoad NameLoad keyword AttributeLoad NameLoad attr If CompareLt SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Num NameLoad NameLoad Assign NameStore BinOpSub NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad SubscriptLoad NameLoad Slice NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Return TupleLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Slice NameLoad SubscriptLoad NameLoad Slice NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Num Assign NameStore BinOpSub Num AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr ListLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad keyword NameLoad While BoolOpAnd CompareGt NameLoad AttributeLoad NameLoad attr CompareGt NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore ListLoad For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Slice NameLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad Slice NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Slice NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad SubscriptLoad NameLoad Slice NameLoad Assign NameStore BinOpDiv SubscriptLoad AttributeLoad NameLoad attr Index Num Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore BinOpSub NameLoad Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr Call NameLoad NameLoad keyword Str Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr ListLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad Call AttributeLoad NameLoad attr Num NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr ExtSlice Slice Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr ListComp SubscriptLoad Call AttributeLoad NameLoad attr NameLoad ExtSlice Slice Index Num comprehension NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore ListComp Call NameLoad NameLoad NameLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr comprehension TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num Return TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad keyword Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If UnaryOpNot Call NameLoad NameLoad Str body Raise Call NameLoad Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad keyword Str Assign TupleStore NameStore NameStore TupleLoad ListLoad ListLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index ListLoad NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Return TupleLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad orelse Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str If UnaryOpNot Call NameLoad NameLoad Str body Raise Call NameLoad Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad keyword Str Assign TupleStore NameStore NameStore TupleLoad ListLoad ListLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index ListLoad NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Return TupleLoad Call NameLoad NameLoad Call NameLoad NameLoad orelse Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad keyword Str If UnaryOpNot Call NameLoad NameLoad Str body Return Call AttributeLoad NameLoad attr NameLoad If CompareNotEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num body Raise Call NameLoad Str Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num For NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad ExtSlice Slice Index Num Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad NameLoad Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad NameLoad If BoolOpOr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr TupleLoad AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list decorator_list
N/A N/A Approximate nearest neighbor search N/A numpy np N/A warnings scipy sparse base KNeighborsMixin RadiusNeighborsMixin base BaseEstimator utils.validation check_array utils check_random_state metrics.pairwise pairwise_distances random_projection GaussianRandomProjection N/A __all__ N/A LSHForest N/A HASH_DTYPE >u4 N/A MAX_HASH_SIZE N/A N/A N/A N/A np dtype HASH_DTYPE itemsize 8 _find_matching_indices N/A N/A tree bin_X left_mask right_mask N/A N/A N/A Finds indices in sorted array of integers.

    Most significant h bits in the binary representations of the
    integers are matched with the items' most significant h bits.
     N/A left_index N/A N/A np searchsorted tree N/A bin_X left_mask N/A right_index N/A N/A np searchsorted tree N/A bin_X right_mask side right N/A N/A left_index right_index N/A _find_longest_prefix_match N/A N/A tree bin_X hash_size left_masks right_masks N/A N/A N/A Find the longest prefix match in tree for each query in bin_X

    Most significant bits are considered as the prefix.
     N/A hi N/A N/A np empty_like bin_X dtype N/A np intp N/A N/A N/A hi fill hash_size N/A lo N/A N/A np zeros_like bin_X dtype N/A np intp N/A res N/A N/A np empty_like bin_X dtype N/A np intp N/A N/A left_idx right_idx N/A _find_matching_indices tree bin_X N/A left_masks N/A hi N/A right_masks N/A hi N/A found N/A right_idx left_idx N/A N/A res N/A found N/A lo N/A found hash_size N/A r N/A N/A np arange N/A N/A bin_X shape N/A 0 N/A kept N/A r N/A N/A lo hi N/A N/A N/A kept shape N/A 0 N/A N/A mid N/A N/A N/A N/A lo take kept N/A N/A hi take kept 2 N/A N/A left_idx right_idx N/A _find_matching_indices tree N/A N/A bin_X take kept N/A left_masks N/A mid N/A right_masks N/A mid N/A found N/A right_idx left_idx N/A mid_found N/A mid N/A found N/A N/A lo N/A N/A kept N/A found N/A mid_found 1 N/A N/A res N/A N/A kept N/A found mid_found N/A N/A hi N/A N/A kept N/A N/A found N/A mid N/A N/A found N/A kept N/A r N/A N/A lo hi N/A res N/A ProjectionToHashMixin N/A object N/A N/A Turn a transformed real-valued array into a hash _to_hash N/A N/A projected N/A N/A N/A N/A N/A N/A N/A projected shape N/A 1 8 0 N/A N/A N/A ValueError Require reduced dimensionality to be a multiple of 8 for hashing N/A out N/A N/A N/A N/A np packbits N/A N/A N/A projected 0 astype int view dtype HASH_DTYPE N/A N/A N/A out reshape N/A N/A projected shape N/A 0 -1 N/A staticmethod fit_transform N/A N/A self X y N/A None N/A N/A N/A N/A self fit X N/A N/A N/A self transform X N/A transform N/A N/A self X y N/A None N/A N/A N/A N/A self _to_hash N/A N/A N/A super ProjectionToHashMixin self transform X N/A N/A GaussianRandomProjectionHash N/A ProjectionToHashMixin GaussianRandomProjection N/A N/A Use GaussianRandomProjection to produce a cosine LSH fingerprint __init__ N/A N/A self n_components random_state N/A 8 None N/A N/A N/A N/A N/A super GaussianRandomProjectionHash self __init__ n_components n_components random_state random_state N/A N/A _array_of_arrays N/A N/A list_of_arrays N/A N/A N/A Creates an array of array from list of arrays. N/A out N/A N/A np empty N/A len list_of_arrays dtype object N/A N/A out N/A list_of_arrays N/A out N/A LSHForest N/A BaseEstimator KNeighborsMixin RadiusNeighborsMixin N/A N/A 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]])

     __init__ N/A N/A self n_estimators radius n_candidates n_neighbors min_hash_match radius_cutoff_ratio random_state N/A 10 1.0 50 5 4 0.9 None N/A N/A N/A self n_estimators n_estimators N/A N/A self radius radius N/A N/A self random_state random_state N/A N/A self n_candidates n_candidates N/A N/A self n_neighbors n_neighbors N/A N/A self min_hash_match min_hash_match N/A N/A self radius_cutoff_ratio radius_cutoff_ratio N/A _compute_distances N/A N/A self query candidates N/A N/A N/A Computes the cosine distance.

        Distance is from the query to points in the candidates array.
        Returns argsort of distances in the candidates
        array and sorted distances.
         N/A N/A N/A candidates shape N/A 0 N/A N/A N/A N/A N/A np empty 0 dtype N/A np int N/A N/A np empty 0 dtype float N/A N/A N/A sparse issparse N/A self _fit_X N/A N/A candidate_X N/A N/A self _fit_X N/A candidates N/A N/A candidate_X N/A N/A N/A self _fit_X take candidates axis 0 mode clip N/A distances N/A N/A pairwise_distances query candidate_X metric cosine N/A 0 N/A distance_positions N/A N/A np argsort distances N/A distances N/A N/A distances take distance_positions mode clip axis 0 N/A N/A distance_positions distances N/A _generate_masks N/A N/A self N/A N/A N/A Creates left and right masks for all hash lengths. N/A tri_size N/A MAX_HASH_SIZE 1 N/A left_mask N/A N/A N/A np tril N/A N/A np ones N/A tri_size tri_size dtype int N/A N/A N/A 1 N/A right_mask N/A left_mask N/A N/A -1 N/A -1 N/A N/A self _left_mask N/A N/A N/A N/A np packbits left_mask view dtype HASH_DTYPE N/A N/A self _right_mask N/A N/A N/A N/A np packbits right_mask view dtype HASH_DTYPE N/A _get_candidates N/A N/A self query max_depth bin_queries n_neighbors N/A N/A N/A Performs the Synchronous ascending phase.

        Returns an array of candidates, their distance ranks and
        distances.
         N/A index_size N/A N/A N/A self _fit_X shape N/A 0 N/A n_candidates 0 N/A candidate_set N/A set N/A min_candidates N/A N/A self n_candidates N/A self n_estimators N/A N/A N/A max_depth N/A self min_hash_match N/A N/A n_candidates min_candidates N/A N/A len candidate_set n_neighbors N/A N/A left_mask N/A N/A self _left_mask N/A max_depth N/A right_mask N/A N/A self _right_mask N/A max_depth N/A i N/A range N/A self n_estimators N/A N/A N/A start stop N/A _find_matching_indices N/A N/A self trees_ N/A i N/A bin_queries N/A i left_mask right_mask N/A n_candidates N/A stop start N/A N/A N/A candidate_set update N/A N/A N/A N/A N/A self original_indices_ N/A i N/A start stop tolist N/A max_depth 1 N/A candidates N/A N/A np fromiter candidate_set count N/A len candidate_set dtype N/A np intp N/A N/A N/A N/A candidates shape N/A 0 n_neighbors N/A N/A N/A N/A warnings warn N/A Number of candidates is not sufficient to retrieve %i neighbors with min_hash_match = %i. Candidates are filled up uniformly from unselected indices. N/A n_neighbors N/A self min_hash_match N/A remaining N/A N/A np setdiff1d N/A N/A np arange 0 index_size candidates N/A to_fill N/A n_neighbors N/A N/A candidates shape N/A 0 N/A candidates N/A N/A np concatenate N/A candidates N/A remaining N/A to_fill N/A N/A ranks distances N/A N/A self _compute_distances query N/A N/A candidates astype int N/A N/A N/A candidates N/A N/A ranks N/A n_neighbors N/A distances N/A n_neighbors N/A _get_radius_neighbors N/A N/A self query max_depth bin_queries radius N/A N/A N/A Finds radius neighbors from the candidates obtained.

        Their distances from query are smaller than radius.
        Returns radius neighbors and distances.
         N/A ratio_within_radius 1 N/A threshold N/A 1 N/A self radius_cutoff_ratio N/A total_candidates N/A N/A np array N/A dtype int N/A total_neighbors N/A N/A np array N/A dtype int N/A total_distances N/A N/A np array N/A dtype float N/A N/A N/A max_depth N/A self min_hash_match N/A ratio_within_radius threshold N/A N/A left_mask N/A N/A self _left_mask N/A max_depth N/A right_mask N/A N/A self _right_mask N/A max_depth N/A candidates N/A N/A i N/A range N/A self n_estimators N/A N/A N/A start stop N/A _find_matching_indices N/A N/A self trees_ N/A i N/A bin_queries N/A i left_mask right_mask N/A N/A N/A candidates extend N/A N/A N/A N/A N/A self original_indices_ N/A i N/A start stop tolist N/A candidates N/A N/A np setdiff1d candidates total_candidates N/A total_candidates N/A N/A np append total_candidates candidates N/A N/A ranks distances N/A N/A self _compute_distances query candidates N/A m N/A N/A np searchsorted distances radius side right N/A positions N/A N/A np searchsorted total_distances N/A distances N/A m N/A total_neighbors N/A N/A np insert total_neighbors positions N/A candidates N/A N/A ranks N/A m N/A total_distances N/A N/A np insert total_distances positions N/A distances N/A m N/A ratio_within_radius N/A N/A N/A total_neighbors shape N/A 0 N/A float N/A N/A total_candidates shape N/A 0 N/A max_depth N/A max_depth 1 N/A N/A total_neighbors total_distances N/A fit N/A N/A self X y N/A None N/A N/A 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.
         N/A N/A self _fit_X N/A check_array X accept_sparse csr N/A N/A self hash_functions_ N/A N/A N/A self trees_ N/A N/A N/A self original_indices_ N/A N/A rng N/A check_random_state N/A self random_state N/A int_max N/A N/A N/A np iinfo N/A np int32 max N/A i N/A range N/A self n_estimators N/A N/A hasher N/A GaussianRandomProjectionHash MAX_HASH_SIZE N/A N/A rng randint 0 int_max N/A hashes N/A N/A N/A hasher fit_transform N/A self _fit_X N/A N/A N/A 0 N/A original_index N/A N/A np argsort hashes N/A bin_hashes N/A hashes N/A original_index N/A N/A N/A N/A self original_indices_ append original_index N/A N/A N/A N/A self trees_ append bin_hashes N/A N/A N/A N/A self hash_functions_ append hasher N/A N/A N/A self _generate_masks N/A self N/A _query N/A N/A self X N/A N/A N/A Performs descending phase to find maximum depth. N/A bin_queries N/A N/A np asarray N/A N/A N/A N/A hasher transform X N/A N/A N/A 0 N/A hasher N/A self hash_functions_ N/A bin_queries N/A N/A np rollaxis bin_queries 1 N/A depths N/A N/A _find_longest_prefix_match tree tree_queries MAX_HASH_SIZE N/A self _left_mask N/A self _right_mask N/A N/A tree tree_queries N/A zip N/A self trees_ N/A N/A np rollaxis bin_queries 1 N/A N/A bin_queries N/A N/A np max depths axis 0 N/A kneighbors N/A N/A self X n_neighbors return_distance N/A None True N/A N/A Returns n_neighbors of approximate nearest neighbors.

        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 query.

        n_neighbors : int, opitonal (default = None)
            Number of neighbors required. If not provided, this will
            return the number specified at the initialization.

        return_distance : boolean, optional (default = False)
            Returns the distances of neighbors if set to True.

        Returns
        -------
        dist : array, shape (n_samples, n_neighbors)
            Array representing the cosine distances to each point,
            only present if return_distance=True.

        ind : array, shape (n_samples, n_neighbors)
            Indices of the approximate nearest points in the population
            matrix.
         N/A N/A N/A hasattr self hash_functions_ N/A N/A N/A ValueError estimator should be fitted. N/A N/A n_neighbors None N/A N/A n_neighbors N/A self n_neighbors N/A X N/A check_array X accept_sparse csr N/A N/A neighbors distances N/A N/A N/A N/A N/A bin_queries max_depth N/A N/A self _query X N/A i N/A range N/A N/A X shape N/A 0 N/A N/A N/A neighs dists N/A N/A self _get_candidates N/A X N/A N/A i N/A max_depth N/A i N/A bin_queries N/A i n_neighbors N/A N/A N/A neighbors append neighs N/A N/A N/A distances append dists N/A return_distance N/A N/A N/A N/A N/A np array distances N/A N/A np array neighbors N/A N/A N/A N/A np array neighbors N/A radius_neighbors N/A N/A self X radius return_distance N/A None True N/A N/A Finds the neighbors within a given radius of a point or points.

        Return the indices and distances of some points from the dataset
        lying in a ball with size ``radius`` around the points of the query
        array. Points lying on the boundary are included in the results.

        The result points are *not* necessarily sorted by distance to their
        query point.

        LSH Forest being an approximate method, some true neighbors from the
        indexed dataset might be missing from the results.

        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 query.

        radius : float
            Limiting distance of neighbors to return.
            (default is the value passed to the constructor).

        return_distance : boolean, optional (default = False)
            Returns the distances of neighbors if set to True.

        Returns
        -------
        dist : array, shape (n_samples,) of arrays
            Each element is an array representing the cosine distances
            to some points found within ``radius`` of the respective query.
            Only present if ``return_distance=True``.

        ind : array, shape (n_samples,) of arrays
            Each element is an array of indices for neighbors within ``radius``
            of the respective query.
         N/A N/A N/A hasattr self hash_functions_ N/A N/A N/A ValueError estimator should be fitted. N/A N/A radius None N/A N/A radius N/A self radius N/A X N/A check_array X accept_sparse csr N/A N/A neighbors distances N/A N/A N/A N/A N/A bin_queries max_depth N/A N/A self _query X N/A i N/A range N/A N/A X shape N/A 0 N/A N/A N/A neighs dists N/A N/A self _get_radius_neighbors N/A X N/A N/A i N/A max_depth N/A i N/A bin_queries N/A i radius N/A N/A N/A neighbors append neighs N/A N/A N/A distances append dists N/A return_distance N/A N/A N/A N/A _array_of_arrays distances N/A _array_of_arrays neighbors N/A N/A N/A _array_of_arrays neighbors N/A partial_fit N/A N/A self X y N/A None N/A N/A 
        Inserts new data into the already fitted LSH Forest.
        Cost is proportional to new total size, so additions
        should be batched.

        Parameters
        ----------
        X : array_like or sparse (CSR) matrix, shape (n_samples, n_features)
            New data point to be inserted into the LSH Forest.
         N/A X N/A check_array X accept_sparse csr N/A N/A N/A hasattr self hash_functions_ N/A N/A N/A N/A self fit X N/A N/A N/A N/A X shape N/A 1 N/A N/A N/A self _fit_X shape N/A 1 N/A N/A N/A ValueError Number of features in X and fitted array does not match. N/A n_samples N/A N/A X shape N/A 0 N/A n_indexed N/A N/A N/A self _fit_X shape N/A 0 N/A i N/A range N/A self n_estimators N/A N/A bin_X N/A N/A N/A N/A N/A self hash_functions_ N/A i transform X N/A N/A N/A 0 N/A positions N/A N/A N/A N/A self trees_ N/A i searchsorted bin_X N/A N/A N/A self trees_ N/A i N/A N/A np insert N/A N/A self trees_ N/A i positions bin_X N/A N/A N/A self original_indices_ N/A i N/A N/A np insert N/A N/A self original_indices_ N/A i positions N/A N/A np arange n_indexed N/A n_indexed n_samples N/A N/A N/A N/A sparse issparse X N/A N/A sparse issparse N/A self _fit_X N/A N/A N/A self _fit_X N/A N/A sparse vstack N/A N/A self _fit_X X N/A N/A N/A self _fit_X N/A N/A np row_stack N/A N/A self _fit_X X N/A self N/A N/A