Skip to content

[MRG] Fix quadruplets scoring #220

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

Conversation

wdevazelhes
Copy link
Member

There was a problem with scoring in LSML: this PR fixes it (and adds a non-regression test as well as a small test for prediction for pairs learners)

@wdevazelhes wdevazelhes changed the title FIX: fix lsml scoring [MRG] Fix quadruplets scoring Jun 13, 2019
@@ -641,4 +641,4 @@ def score(self, quadruplets):
score : float
The quadruplets score.
"""
return - np.mean(self.predict(quadruplets))
return np.mean((self.predict(quadruplets) + 1) / 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be equivalent to pred.mean() / 2 + 0.5, which is more efficient to compute.

I'd also add a comment explaining that the prediction is a vector of either -1 or 1 values, and that we're rescaling to [0, 1].

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 agree, done

@wdevazelhes
Copy link
Member Author

If everybody agrees, I think we are good to merge

@perimosocordiae perimosocordiae merged commit 8c3cb3e into scikit-learn-contrib:master Jun 18, 2019
@perimosocordiae
Copy link
Contributor

Agreed, merged.

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.

3 participants