Skip to content

adds code for safe return in case of no impostors for lmnn #36

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
Sep 29, 2016

Conversation

anirudt
Copy link
Contributor

@anirudt anirudt commented Sep 29, 2016

Attempt to fix #17 .

I have done it for LMNN, is there a need for the others?

@anirudt anirudt changed the title adds code for safe return in case of no imposters for lmnn adds code for safe return in case of no impostors for lmnn Sep 29, 2016
@@ -203,6 +206,9 @@ def _find_impostors(self, furthest_neighbors):
tmp = np.ravel_multi_index((i,j), shape)
i,j = np.unravel_index(np.unique(tmp), shape)
impostors.append(np.vstack((in_inds[j], out_inds[i])))
if len(impostors) == 0:
"""No impostors detected"""
return []
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for a docstring here. Also, you can just return impostors instead of returning a new empty list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do.

@perimosocordiae
Copy link
Contributor

Thanks! One small comment, but the change looks good overall. If something similar needs to be done for the other methods, we can handle those fixes separately.

@anirudt
Copy link
Contributor Author

anirudt commented Sep 29, 2016

Sure, @perimosocordiae . Looking at the CI Build Details, the unrelated RCA test hasn't gone through. Does it need a look into it?

@perimosocordiae
Copy link
Contributor

The test failure is unrelated, though it did make me smile: 0.25054383490356519 not less than 0.25. So close!

Thanks for your contribution!

@perimosocordiae perimosocordiae merged commit c74a058 into scikit-learn-contrib:master Sep 29, 2016
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.

Error when impostors list is empty
2 participants