Skip to content

Commit

Permalink
BUG: Compare strings for equality, not identity.
Browse files Browse the repository at this point in the history
Strings in Python are usually interned (https://en.wikipedia.org/wiki/String_interning) but not always, so comparing identity can fail.
  • Loading branch information
Jorge-C committed Oct 30, 2013
1 parent 30eb78d commit 1564765
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sklearn/manifold/mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ def fit_transform(self, X, init=None, y=None):
"dissimilarity matrix, set "
"``dissimilarity=precomputed``.")

if self.dissimilarity is "precomputed":
if self.dissimilarity == "precomputed":
self.dissimilarity_matrix_ = X
elif self.dissimilarity is "euclidean":
elif self.dissimilarity == "euclidean":
self.dissimilarity_matrix_ = euclidean_distances(X)
else:
raise ValueError("Proximity must be 'precomputed' or 'euclidean'."
Expand Down

0 comments on commit 1564765

Please sign in to comment.