mirror of https://github.com/apache/lucene.git
LUCENE-6854 - adjusted precision calculation, minor fix in SNBC test
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1723759 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2580956b8b
commit
056940632d
|
@ -167,7 +167,7 @@ public class ConfusionMatrixGenerator {
|
|||
public double getPrecision(String klass) {
|
||||
Map<String, Long> classifications = linearizedMatrix.get(klass);
|
||||
double tp = 0;
|
||||
double fp = 0;
|
||||
double fp = -1;
|
||||
if (classifications != null) {
|
||||
for (Map.Entry<String, Long> entry : classifications.entrySet()) {
|
||||
if (klass.equals(entry.getKey())) {
|
||||
|
@ -253,7 +253,7 @@ public class ConfusionMatrixGenerator {
|
|||
*/
|
||||
public double getPrecision() {
|
||||
double tp = 0;
|
||||
double fp = 0;
|
||||
double fp = -linearizedMatrix.size();
|
||||
for (Map.Entry<String, Map<String, Long>> classification : linearizedMatrix.entrySet()) {
|
||||
String klass = classification.getKey();
|
||||
for (Map.Entry<String, Long> entry : classification.getValue().entrySet()) {
|
||||
|
|
|
@ -75,7 +75,8 @@ public class SimpleNaiveBayesClassifierTest extends ClassificationTestBase<Bytes
|
|||
try {
|
||||
Analyzer analyzer = new NGramAnalyzer();
|
||||
leafReader = getSampleIndex(analyzer);
|
||||
checkCorrectClassification(new CachingNaiveBayesClassifier(leafReader, analyzer, null, categoryFieldName, textFieldName), TECHNOLOGY_INPUT, TECHNOLOGY_RESULT);
|
||||
SimpleNaiveBayesClassifier classifier = new SimpleNaiveBayesClassifier(leafReader, analyzer, null, categoryFieldName, textFieldName);
|
||||
checkCorrectClassification(classifier, TECHNOLOGY_INPUT, TECHNOLOGY_RESULT);
|
||||
} finally {
|
||||
if (leafReader != null) {
|
||||
leafReader.close();
|
||||
|
|
Loading…
Reference in New Issue