Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG+1] Pass affinity to fix connectivity in linkage tree #9357

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 1 commit into from
Jul 18, 2017

Conversation

brenolf
Copy link
Contributor

@brenolf brenolf commented Jul 14, 2017

Reference Issue

Resolves #9308.

What does this implement/fix? Explain your changes.

Pass the affinity value to be used by pairwise_distances in a linkage_tree call.

Any other comments?

No.

@brenolf brenolf changed the title Pass affinity to fix connectivity in linkage tree [MRG] Pass affinity to fix connectivity in linkage tree Jul 14, 2017
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.

Also note that there's another PR for this issue (without test) at #9315

rng = np.random.RandomState(42)
X = rng.normal(size=(5, 5))

assert_raises(ValueError, linkage_tree, X, affinity='FakeAffinity')
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this test will pass at master, i.e. an error will be raised by another part of linkage_tree.

@brenolf brenolf force-pushed the pass-affinity-connectivity branch from b56d36f to 44554bd Compare July 16, 2017 21:17
@brenolf
Copy link
Contributor Author

brenolf commented Jul 16, 2017

@jnothman I didn't notice there was a PR for that. I added a test that targets only the change right now, I'm not sure if that's an acceptable pattern, though.

@brenolf brenolf force-pushed the pass-affinity-connectivity branch from 44554bd to ed12cf0 Compare July 16, 2017 21:20
@jnothman
Copy link
Member

This is okay. Not loving the test; would rather something that ensures correct functionality, but this is okay as a non-regression test.

I'd prefer a fix which makes affinity a required arg of _fix_connectivity with no default value. Remove n_components (unused) at the same time. Thanks.

@brenolf brenolf force-pushed the pass-affinity-connectivity branch from ed12cf0 to 4109eaa Compare July 17, 2017 03:18
@brenolf brenolf force-pushed the pass-affinity-connectivity branch from 4109eaa to 174dc7b Compare July 17, 2017 12:13
@brenolf
Copy link
Contributor Author

brenolf commented Jul 17, 2017

Fixed @jnothman

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.

As I said I'm equivocal about the test, but overall this is good. LGTM

@@ -30,8 +30,7 @@
# For non fully-connected graphs


def _fix_connectivity(X, connectivity, n_components=None,
affinity="euclidean"):
def _fix_connectivity(X, connectivity, affinity):
Copy link
Member

Choose a reason for hiding this comment

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

Much clearer.

@jnothman jnothman changed the title [MRG] Pass affinity to fix connectivity in linkage tree [MRG+1] Pass affinity to fix connectivity in linkage tree Jul 17, 2017
@TomDLT
Copy link
Member

TomDLT commented Jul 18, 2017

Thanks @brenolf

@TomDLT TomDLT merged commit ea9896b into scikit-learn:master Jul 18, 2017
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Aug 6, 2017
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should affinity be passed to _fix_connectivity in linkage_tree?
3 participants