rev2004 / cleartk

Automatically exported from code.google.com/p/cleartk
0 stars 0 forks source link

The MutualInformationTest.testMutualInformationFeatureSelection() is failed in Java 1.8.0 #417

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Update to the Java version 1.8.0
run MutualInformationTest.testMutualInformationFeatureSelection()

What is the expected output?
Test passes

What do you see instead?

What version of the product are you using? On what operating system?
ClearTK 2.0.1
java version "1.8.0_40"
OS X Yosemite

Comment:
In the above test, the order of 'Bag_Covered:pig' and 'Bag_Covered:wolf' is 
changed between two version of java. The information of both cases are the 
same. 

Original issue reported on code.google.com by mjla...@gmail.com on 24 Mar 2015 at 5:59

GoogleCodeExporter commented 9 years ago
Fixes the issue 417.

The problem is because of HashBasedTable used in MutualInformationStats. This 
causes the order of featureNames in
MutualInformationFeatureSelectionExtractor.train() becomes arbitarary.
To fix this, I added TreeSet<String>(featureNames) to always have the same 
ordering.

Original comment by mjla...@gmail.com on 24 Mar 2015 at 6:26