-
-
Notifications
You must be signed in to change notification settings - Fork 26k
[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
[MRG+1] Pass affinity to fix connectivity in linkage tree #9357
Conversation
There was a problem hiding this 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') |
There was a problem hiding this comment.
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
.
b56d36f
to
44554bd
Compare
@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. |
44554bd
to
ed12cf0
Compare
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. |
ed12cf0
to
4109eaa
Compare
4109eaa
to
174dc7b
Compare
Fixed @jnothman |
There was a problem hiding this 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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much clearer.
Thanks @brenolf |
Reference Issue
Resolves #9308.
What does this implement/fix? Explain your changes.
Pass the affinity value to be used by
pairwise_distances
in alinkage_tree
call.Any other comments?
No.