Skip to content

Commit

Permalink
ensure an extra component is added because the first component is dro…
Browse files Browse the repository at this point in the history
…pped
  • Loading branch information
satra committed Sep 17, 2014
1 parent 3b3b739 commit 4c96193
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sklearn/manifold/spectral_embedding_.py
Expand Up @@ -644,7 +644,7 @@ def diffusion_embedding(adjacency, n_components=8, diffusion_time=None,
A = adjacency/(v[:, None] * v[None, :])
A = np.squeeze(A * [A > 1e-5])
if n_components is not None:
lambdas, vectors = eigsh(A, k=n_components)
lambdas, vectors = eigsh(A, k=n_components + 1)
else:
lambdas, vectors = eigsh(A, k=max(2, int(np.sqrt(ndim/2))))
lambdas = lambdas[::-1]
Expand Down Expand Up @@ -688,7 +688,7 @@ class DiffusionEmbedding(SpectralEmbedding):
"""

def __init__(self, diffusion_time=0., n_components='auto',
def __init__(self, diffusion_time=0., n_components=None,
affinity="nearest_neighbors", gamma=None, random_state=None,
eigen_solver=None, n_neighbors=None):
super(DiffusionEmbedding, self).__init__(n_components=n_components,
Expand Down

0 comments on commit 4c96193

Please sign in to comment.