Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
0.5
-
None
-
JRE 7
Description
Bayes classification results are unstable, and change during runtime!
Sample test:
MyClassifier classifier = new MyClassifier(new BayesAlgorithm(),params); //Custom simple wrapper for classifier
ClassifierResult category = classifier.classify("existing");
double resultA = category.getScore();
category = classifier.classify("nonexisting");
category = classifier.classify("existing");
double resultB = category.getScore();
Assert.assertEquals(resultA,resultB,0.0); // FAIL!!!
Test like the one above will fail. Because nonexisting tokens are added to InMemoryBayesDatastore->featureDictionary therefore datastore.getWeight("sumWeight", "vocabCount") change after classification of unknown feature. Moreover, the featureDictionary fills with not wanted strings using heapspace.