def transform(self, X, y=None):
        """Computes the (weighted) graph of Neighbors for points in X

        Parameters
        ----------
        X : array-like, shape (n_samples_transform, n_features)
            Sample data

        Returns
        -------
        Xt : CSR sparse matrix, shape (n_samples_fit, n_samples_transform)
            Xt[i, j] is assigned the weight of edge that connects i to j.
            Only the neighbors have an explicit value.
        """

        if X is None:
            n_samples_transform = self.n_samples_fit
        else:
            n_samples_transform = X.shape[0]

        if X is None:
            indices, distances = self.pynndescent_._neighbor_graph
        else:
            indices, distances = self.pynndescent_.query(
                X, k=self.n_neighbors, queue_size=self.search_queue_size
            )

        result = lil_matrix(
            (n_samples_transform, n_samples_transform), dtype=np.float32
        )
        result.rows = indices
        result.data = distances

        return result.tocsr()
def transform ( self , X , y = None ) : if X is None : n_samples_transform = self . n_samples_fit else : n_samples_transform = X . shape [ 0 ] if X is None : indices , distances = self . pynndescent_ . _neighbor_graph else : indices , distances = self . pynndescent_ . query ( X , k = self . n_neighbors , queue_size = self . search_queue_size ) result = lil_matrix ( ( n_samples_transform , n_samples_transform ) , dtype = np . float32 ) result . rows = indices result . data = distances return result . tocsr ( )
Computes the (weighted) graph of Neighbors for points in X

        Parameters
        ----------
        X : array-like, shape (n_samples_transform, n_features)
            Sample data

        Returns
        -------
        Xt : CSR sparse matrix, shape (n_samples_fit, n_samples_transform)
            Xt[i, j] is assigned the weight of edge that connects i to j.
            Only the neighbors have an explicit value.