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

Skip to content

[MRG+1] Add sample_weight parameter to metrics.jaccard_similarity_score #3497

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

Closed
wants to merge 6 commits into from

Conversation

jatinshah
Copy link
Contributor

  • Include this metric in sample_weight test in tests/test_common.py

 - Include this metric in sample_weight test in tests/test_common.py
@jatinshah jatinshah changed the title Add sample_weight parameter to metrics.jaccard_similarity_score #3450 Add sample_weight parameter to metrics.jaccard_similarity_score Jul 29, 2014
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.0%) when pulling c0225ab on jatinshah:master into e894205 on scikit-learn:master.

@@ -237,7 +238,7 @@ def confusion_matrix(y_true, y_pred, labels=None):
return CM


def jaccard_similarity_score(y_true, y_pred, normalize=True):
def jaccard_similarity_score(y_true, y_pred, normalize=True, sample_weight=None):
Copy link
Member

Choose a reason for hiding this comment

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

Please limit line length to 79 chars, in accordance with PEP8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will fix.

@arjoly
Copy link
Member

arjoly commented Jul 29, 2014

Could you document your improvement in the what's new?

@jatinshah
Copy link
Contributor Author

@arjoly Sure, can describe the improvements. Where is What's New located?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 6a2c60c on jatinshah:master into e894205 on scikit-learn:master.

@jatinshah
Copy link
Contributor Author

@arjoly - Any idea why the test is failing?

The detailed CI logs say that values with sample_weight=None and sample_weight=ones for unnormalized Jaccard are not same. The error log also displays the values as 105.20595238095238 and 105.20595238095237

@jnothman
Copy link
Member

doc/whats_new.rst

On 29 July 2014 23:13, Coveralls [email protected] wrote:

[image: Coverage Status] https://coveralls.io/builds/1018844

Coverage increased (+0.0%) when pulling 6a2c60c
6a2c60c
on jatinshah:master
into e894205
e894205
on scikit-learn:master
.


Reply to this email directly or view it on GitHub
#3497 (comment)
.

@arjoly
Copy link
Member

arjoly commented Jul 29, 2014

This looks some tests are checking assert equal instead of assert almost equal

@jatinshah
Copy link
Contributor Author

And this test does not fail on my local machine - so not sure what is going on.

@jatinshah
Copy link
Contributor Author

Is it ok to change the failing tests to assert almost equal instead of equal?

- Replace sample weight invariance tests to check for
  almost equal instead of equal
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 8f8c607 on jatinshah:master into cbcae04 on scikit-learn:master.

@jnothman
Copy link
Member

Yes.

On 30 July 2014 14:14, Jatin Shah [email protected] wrote:

Is it ok to change the failing tests to assert almost equal instead of
equal?


Reply to this email directly or view it on GitHub
#3497 (comment)
.

@jatinshah
Copy link
Contributor Author

OK. It's done.

............


- Add ``sample_weight`` parameter to `metrics.jaccard_similarity_score`.
Copy link
Member

Choose a reason for hiding this comment

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

please include this under 0.16

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 5c16096 on jatinshah:master into cbcae04 on scikit-learn:master.

@jnothman
Copy link
Member

LGTM!

@jnothman jnothman changed the title Add sample_weight parameter to metrics.jaccard_similarity_score [MRG+1] Add sample_weight parameter to metrics.jaccard_similarity_score Jul 30, 2014
@arjoly
Copy link
Member

arjoly commented Jul 30, 2014

Is it ok to change the failing tests to assert almost equal instead of equal?

The small variations are due to small floating point arithmetic errors. Asserting that 6 decimals (the default of assert_almost_equal) is enough to check correctness and equality in most cases.

@arjoly
Copy link
Member

arjoly commented Jul 30, 2014

+1 I am going to merge by rebase !

@arjoly
Copy link
Member

arjoly commented Jul 30, 2014

Merge by rebase 1b2833a. Thanks and congratulation for your first contribution.

@arjoly arjoly closed this Jul 30, 2014
@jatinshah
Copy link
Contributor Author

Thanks @arjoly.

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.

4 participants