Skip to content

FIX Correctly sets MDS pairwise attribute #18278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2020

Conversation

thomasjpfan
Copy link
Member

Bug found while working on #18143

@thomasjpfan thomasjpfan changed the title BUG Fixes MDS pairwise attribute FIX Fixes MDS pairwise attribute Aug 27, 2020
@thomasjpfan thomasjpfan changed the title FIX Fixes MDS pairwise attribute FIX Correctly sets MDS pairwise attribute Aug 27, 2020
Copy link
Member

@alfaro96 alfaro96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you @thomasjpfan!

@@ -364,7 +367,7 @@ Changelog
- |Enhancement| :class:`multiclass.OneVsOneClassifier` now accepts
the inputs with missing values. Hence, estimators which can handle
missing values (may be a pipeline with imputation step) can be used as
a estimator for multiclass wrappers.
a estimator for multiclass wrappers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch (here and below)!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done with a pre-commit hook. (I normally revert these types of commits, but these slipped through).

@@ -386,7 +386,7 @@ def __init__(self, n_components=2, *, metric=True, n_init=4,

@property
def _pairwise(self):
return self.kernel == "precomputed"
return self.dissimilarity == "precomputed"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that this attribute was not tested because kernel is not an (hyper)parameter in sklearn.manifold.MDS.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know why this was not tested. There was nothing in the test suite that actually used the _pairwise property.

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not surprising it wasn't picked up. I wonder how many times MDS has been used in a grid search, let alone with precomputed dissimilarity!

@glemaitre glemaitre merged commit 576775d into scikit-learn:master Aug 28, 2020
@glemaitre
Copy link
Member

Good catch

jayzed82 pushed a commit to jayzed82/scikit-learn that referenced this pull request Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants