double c) throws IOException {
double log2toe = 1.0d / Math.log(2.0d);
TopDocsMeanVariance f_td = td;
MeanVarianceScoreDoc temp[] = f_td.MeanVariancescoreDocs;
// System.out.println("number: "+temp.length);
TopMeanVarianceDocCollector collector = null;
HashMap scoreHM = new HashMap();
for (int k = 0; k < temp.length; k++) {
scoreHM.put(temp[k].doc, temp[k].score);
}
for (int d = 0; d < 19; d++) {
collector = new TopMeanVarianceDocCollector(temp.length);
for (int j = 0; j <= d; j++) {
collector.collect(temp[j].doc, temp[j].score + 100.0d,
temp[j].mean, temp[j].variance);
}
for (int i = d + 1; i < temp.length; i++) {
double currentScore = Double.parseDouble(scoreHM.get(
temp[i].doc).toString());
double adjustAmount = currentScore / (d + 2);
for (int s = 0; s <= d; s++) {
double docScore = Double.parseDouble(scoreHM.get(
temp[s].doc).toString());
adjustAmount += 1.0 / (d + 2)
* (correlation(temp[s].doc, temp[i].doc) * 0.01);// Math.sqrt(temp[s].variance
// *temp[i].variance));//+
// currentScore*docScore
}
// b_correlation /2.0/Math.log(d+2)/ log2toe
// *correlation(temp[d].doc,temp[i].doc)*0.01;//Math.sqrt(temp[d].variance
// *temp[i].variance);
// System.out.println(
// Double.toString(correlation(temp[d].doc,temp[i].doc)) +"\t" +
// Double.toString(adjustAmount));
temp[i].score = adjustAmount;// *temp[d].score*temp[i].score;
// c *correlation(temp[d].doc,temp[i].doc);
// System.out.println(temp[d].doc+" "+temp[i].doc);
// System.out.println("Score: "+temp[i].score +
// " Correlation: "+correlation(temp[d].doc,temp[i].doc));
collector.collect(temp[i].doc, temp[i].score, temp[i].mean,
temp[i].variance);
// temp[i].score-= c /Math.log(d+2)/ log2toe
// *correlation(temp[d].doc,temp[i].doc);
// //c *correlation(temp[d].doc,temp[i].doc);
// // System.out.println(temp[d].doc+" "+temp[i].doc);
// // System.out.println("Score: "+temp[i].score +
// " Correlation: "+correlation(temp[d].doc,temp[i].doc));
// collector.collect(temp[i].doc, temp[i].score, temp[i].mean,
// temp[i].variance);
}
f_td = collector.topDocs();
temp = f_td.MeanVariancescoreDocs;
}
return f_td;
}