예제 #1
0
파일: test.py 프로젝트: anukat2015/AIR
 def testEvaluateRankingLastZeroWithCutoff(self):
     ev = NdcgEval()
     dot_prod = np.dot(self.query.get_feature_vectors(),
         self.zero_weights.transpose())
     ranking = ev._sort_docids_by_score(self.query.get_docids(),
         dot_prod, ties="last")
     self.assertAlmostEquals(0.4452805, ev.evaluate_ranking(ranking,
         self.query, cutoff=10))
예제 #2
0
 def testEvaluateRankingLastZeroWithCutoff(self):
     ev = NdcgEval()
     dot_prod = np.dot(self.query.get_feature_vectors(),
                       self.zero_weights.transpose())
     ranking = ev._sort_docids_by_score(self.query.get_docids(),
                                        dot_prod,
                                        ties="last")
     self.assertAlmostEquals(
         0.4452805, ev.evaluate_ranking(ranking, self.query, cutoff=10))
예제 #3
0
파일: test.py 프로젝트: anukat2015/AIR
 def testGetNdcg(self):
     ev = NdcgEval()
     self.assertAlmostEqual(ev.get_ndcg([0, 0, 1, 0], [1, 0, 0, 0]), 0.5)
     self.assertAlmostEqual(ev.get_ndcg([0, 1, 0, 0], [1, 0, 0, 0]),
         0.6309298)
     self.assertAlmostEqual(ev.get_ndcg([0, 0, 0, 0], [1, 0, 0, 0]), 0)
예제 #4
0
 def testGetNdcg(self):
     ev = NdcgEval()
     self.assertAlmostEqual(ev.get_ndcg([0, 0, 1, 0], [1, 0, 0, 0]), 0.5)
     self.assertAlmostEqual(ev.get_ndcg([0, 1, 0, 0], [1, 0, 0, 0]),
                            0.6309298)
     self.assertAlmostEqual(ev.get_ndcg([0, 0, 0, 0], [1, 0, 0, 0]), 0)