Skip to content

Commit

Permalink
silence warning on traditionalgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgigante committed Jun 19, 2018
1 parent 2f312c9 commit d52327f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 0 additions & 4 deletions graphtools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ def _reduce_data(self):
data = self.data
if sparse.issparse(data):
data = data.toarray()
if data.shape[1] > 500:
warnings.warn("Building a graph on data of shape {} is "
"expensive. Consider setting n_pca.".format(
data.shape), UserWarning)
return data

def get_params(self):
Expand Down
8 changes: 6 additions & 2 deletions graphtools/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class kNNGraph(DataGraph):

def __init__(self, data, knn=5, decay=None,
distance='euclidean',
thresh=1e-4, **kwargs):
thresh=1e-4, n_pca=None, **kwargs):
self.knn = knn
self.decay = decay
self.distance = distance
Expand All @@ -72,8 +72,12 @@ def __init__(self, data, knn=5, decay=None,
warnings.warn("Cannot set knn ({k}) to be greater than "
"data.shape[0] ({n}). Setting knn={n}".format(
k=knn, n=data.shape[0]))
if n_pca is None and data.shape[1] > 500:
warnings.warn("Building a kNNGraph on data of shape {} is "
"expensive. Consider setting n_pca.".format(
data.shape), UserWarning)

super().__init__(data, **kwargs)
super().__init__(data, n_pca=n_pca, **kwargs)

def get_params(self):
"""Get parameters from this object
Expand Down

0 comments on commit d52327f

Please sign in to comment.