dkpro / dkpro-similarity

Word and text similarity measures
https://dkpro.github.io/dkpro-similarity
Other
53 stars 22 forks source link

Different results for TokenPairDistanceMeasureTest and TokenPairOrderingMeasureTest #53

Closed nicolaierbs closed 8 years ago

nicolaierbs commented 8 years ago

I executed the following two tests both using Eclipse and the command 'mvn clean install' and the outcome turned out to be different. In Eclipse the test finished successfully, while they failed in the terminal.

Any clues?


T E S T S

Running dkpro.similarity.algorithms.structure.TokenPairDistanceMeasureTest Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.069 sec <<< FAILURE! - in dkpro.similarity.algorithms.structure.TokenPairDistanceMeasureTest run(dkpro.similarity.algorithms.structure.TokenPairDistanceMeasureTest) Time elapsed: 0.068 sec <<< FAILURE! java.lang.AssertionError: expected:<0.755> but was:<0.6407693851706187> at org.junit.Assert.fail(Assert.java:93) at org.junit.Assert.failNotEquals(Assert.java:647) at org.junit.Assert.assertEquals(Assert.java:443) at org.junit.Assert.assertEquals(Assert.java:512) at dkpro.similarity.algorithms.structure.TokenPairDistanceMeasureTest.run(TokenPairDistanceMeasureTest.java:93)

Running dkpro.similarity.algorithms.structure.TokenPairOrderingMeasureTest Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec <<< FAILURE! - in dkpro.similarity.algorithms.structure.TokenPairOrderingMeasureTest run(dkpro.similarity.algorithms.structure.TokenPairOrderingMeasureTest) Time elapsed: 0.002 sec <<< FAILURE! java.lang.AssertionError: expected:<0.928> but was:<0.18898223650461377> at org.junit.Assert.fail(Assert.java:93) at org.junit.Assert.failNotEquals(Assert.java:647) at org.junit.Assert.assertEquals(Assert.java:443) at org.junit.Assert.assertEquals(Assert.java:512) at dkpro.similarity.algorithms.structure.TokenPairOrderingMeasureTest.run(TokenPairOrderingMeasureTest.java:68)

Results :

Failed tests: TokenPairDistanceMeasureTest.run:93 expected:<0.755> but was:<0.6407693851706187> TokenPairOrderingMeasureTest.run:68 expected:<0.928> but was:<0.18898223650461377>

daxenberger commented 8 years ago

Java versions?

nicolaierbs commented 8 years ago

You're right. I use Java 7 in Eclipse and Java 8 when using Maven directly.

I'll keep this issue open to investigate why different Java versions change results.

reckart commented 8 years ago

This is typically due to changes in iteration orders over hashmaps or hashsets. Mind that for these classes, the iteration order is undefined. Can typically be fixed by explicitly sorting or using the "linked" versions of these classes to iterate in insertion order.

nicolaierbs commented 8 years ago

Thanks Richard. Changing to linked version solved this issues.

reckart commented 8 years ago

Please assign milestones before or latest when closing issues.