diff --git a/umap/umap_.py b/umap/umap_.py index 70bd0c70..32776a6a 100644 --- a/umap/umap_.py +++ b/umap/umap_.py @@ -559,7 +559,10 @@ def rptree_leaf_array(data, n_neighbors, rng_state, n_trees=10, angular=False): leaf_array = -1 * np.ones([len(leaves), leaf_size], dtype=np.int64) for i, leaf in enumerate(leaves): leaf_array[i, :len(leaf)] = leaf - except RecursionError: + except (RuntimeError, RecursionError): + warn('Random Projection forest initialisation failed due to recursion' + 'limit being reached. Something is a little strange with your ' + 'data, and this may take longer than normal to compute.') leaf_array = np.array([[-1]]) return leaf_array @@ -1558,6 +1561,8 @@ def fit(self, X, y=None): self.verbose ) + return self + def fit_transform(self, X, y=None): """Fit X into an embedded space and return that transformed output.