Skip to content

Commit 8243cf0

Browse files
committed
minor
1 parent ff19791 commit 8243cf0

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

data/topics.351-400.xml

+18
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,24 @@ activity is also relevant.
971971

972972
</narr></top>
973973

974+
<top>
975+
<num> 400
976+
</num><title> Amazon rain forest
977+
978+
</title><desc>
979+
What measures are being taken by local South
980+
American authorities to preserve the Amazon
981+
tropical rain forest?
982+
983+
</desc><narr>
984+
Relevant documents may identify: the official
985+
organizations, institutions, and individuals
986+
of the countries included in the Amazon rain
987+
forest; the measures being taken by them to
988+
preserve the rain forest; and indications of
989+
degrees of success in these endeavors.
990+
991+
</narr></top>
974992

975993
</topics>
976994

src/main/java/org/experiments/SimpleQppEvalFlow.java

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.experiments;
22

3+
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
34
import org.apache.lucene.search.TopDocs;
45
import org.apache.lucene.search.similarities.LMDirichletSimilarity;
56
import org.apache.lucene.search.similarities.Similarity;
@@ -10,6 +11,7 @@
1011
import org.qpp.NQCCalibratedSpecificity;
1112
import org.qpp.NQCSpecificity;
1213
import org.qpp.QPPMethod;
14+
import org.qpp.WIGSpecificity;
1315
import org.trec.TRECQuery;
1416

1517
import java.util.HashMap;
@@ -35,6 +37,7 @@ public static void main(String[] args) {
3537
//NQCCalibratedSpecificity qppMethod = new NQCCalibratedSpecificity(loader.getSearcher());
3638
//qppMethod.setParameters(2, 2, 0.5f);
3739
NQCSpecificity qppMethod = new NQCSpecificity(Settings.getSearcher());
40+
//WIGSpecificity qppMethod = new WIGSpecificity(Settings.getSearcher());
3841
Similarity sim = new LMDirichletSimilarity(1000);
3942

4043
final int nwanted = Settings.getNumWanted();
@@ -60,8 +63,25 @@ public static void main(String[] args) {
6063
System.out.println(String.format("%s: AP = %.4f, QPP = %.4f", query.id, evaluatedMetricValues[i], qppEstimates[i]));
6164
i++;
6265
}
63-
double corr = new KendalCorrelation().correlation(evaluatedMetricValues, qppEstimates);
64-
System.out.println(String.format("Kendall's = %.4f", corr));
66+
double pearsons = new PearsonsCorrelation().correlation(evaluatedMetricValues, qppEstimates);
67+
double kendals = new KendalCorrelation().correlation(evaluatedMetricValues, qppEstimates);
68+
69+
boolean ref, pred;
70+
int correct = 0;
71+
int numpairs = 0;
72+
for (int j=0; j < evaluatedMetricValues.length-1; j++) {
73+
for (int k=j+1; k < evaluatedMetricValues.length; k++) {
74+
ref = evaluatedMetricValues[j] < evaluatedMetricValues[k];
75+
pred = qppEstimates[j] < qppEstimates[k];
76+
correct += ref && pred? 1: 0;
77+
numpairs++;
78+
}
79+
}
80+
System.out.println(numpairs);
81+
System.out.println(String.format("acc = %.4f, r = %.4f, tau = %.4f",
82+
correct/(float)(numpairs),
83+
pearsons, kendals));
84+
6585
} catch (Exception ex) {
6686
ex.printStackTrace();
6787
}

0 commit comments

Comments
 (0)