-
Notifications
You must be signed in to change notification settings - Fork 246
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
Text 158 #112
base: master
Are you sure you want to change the base?
Text 158 #112
Changes from all commits
eefce46
7f7f5ce
f077ccf
cc78b98
8e9ec84
fe6977d
4ef1fb3
809a097
199ed38
cc818da
1d178b4
61becad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ public static void setUp() { | |
@Test | ||
public void testGettingJaccardDistance() { | ||
// Expected Jaccard distance = 1.0 - (intersect / union) | ||
assertEquals(1.0, classBeingTested.apply("", "")); | ||
assertEquals(0.0, classBeingTested.apply("", "")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only works because the unit test passes in the same string on both sides, i.e. Do not use == to measure equality. This measures the same object reference. Try this in your test:
You should fix the code to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, but
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, you are right. It was my mistake carried over from fixing another similarity class to use However you should consider using |
||
assertEquals(1.0, classBeingTested.apply("left", "")); | ||
assertEquals(1.0, classBeingTested.apply("", "right")); | ||
assertEquals(1.0 - (3.0 / 4), classBeingTested.apply("frog", "fog")); | ||
|
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.
It looks like this comment is out of sync with the code.
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.
Please, can you describe why this comment looks wrong? For me it's good, shows the formula, as well as in JaccardSimilarityTest.java
// Expected Jaccard similarity = (intersect / union)
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.
Because the comment reads:
and the next line is in contradiction with this comment, expecting 0.0, not 1.0.
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.
Sorry @garydgregory , I'm still not convinced.
Intersection of two empty sets is empty set, union is also empty set. They are equal. So Jaccard similarity is 1. And therefore distance is 0.