From 39f6e0824df2e6cfe9609f1f62cb9187623d15f1 Mon Sep 17 00:00:00 2001 From: Vaibhav Kansagara Date: Mon, 26 Aug 2019 00:48:44 +0530 Subject: [PATCH] Fix training related files and tests This are due to changes made from fixing ranker implementations, fixing indexing errors, adding Xavier initialisation, adding normalisation of gradient and adding bias combined. This also fixes scorer test which was wrong earlier. --- xapian-letor/tests/api_letor.cc | 6 ++++-- xapian-letor/tests/testdata/training_data.txt | 4 ++-- xapian-letor/tests/testdata/training_data_ndcg.txt | 4 ++-- xapian-letor/tests/testdata/training_data_one_document.txt | 2 +- xapian-letor/tests/testdata/training_data_three_correct.txt | 6 +++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xapian-letor/tests/api_letor.cc b/xapian-letor/tests/api_letor.cc index 782a77e69b7..de890c1cd23 100644 --- a/xapian-letor/tests/api_letor.cc +++ b/xapian-letor/tests/api_letor.cc @@ -569,6 +569,7 @@ DEFINE_TESTCASE(preparetrainingfilethree, generated && path) // ListNet_Ranker check DEFINE_TESTCASE(listnet_ranker, generated && path && writable) { + XFAIL_FOR_BACKEND("multi", "Testcase fails with multidatabase"); Xapian::ListNETRanker ranker; TEST_EXCEPTION(Xapian::FileNotFoundError, ranker.train_model("")); string db_path = get_database_path("db_index_two_documents", @@ -719,8 +720,8 @@ DEFINE_TESTCASE(scorer, generated && path && writable) Xapian::MSet mymset = enquire.get_mset(0, 10); string data_directory = test_driver::get_srcdir() + "/testdata/"; string query = data_directory + "querythree.txt"; - string qrel = data_directory + "qrelthree_correct.txt"; - string training_data = data_directory + "training_data_three_correct.txt"; + string qrel = data_directory + "score_qrel.txt"; + string training_data = data_directory + "training_data_ndcg.txt"; ranker.set_database_path(db_path); TEST_EQUAL(ranker.get_database_path(), db_path); ranker.set_query(Xapian::Query("score")); @@ -749,6 +750,7 @@ DEFINE_TESTCASE(scorer, generated && path && writable) // ListMLE_Ranker check DEFINE_TESTCASE(listmle_ranker, generated && path && writable) { + XFAIL_FOR_BACKEND("multi", "Testcase fails with multidatabase"); Xapian::ListMLERanker ranker; TEST_EXCEPTION(Xapian::FileNotFoundError, ranker.train_model("")); string db_path = get_database_path("db_index_two_documents", diff --git a/xapian-letor/tests/testdata/training_data.txt b/xapian-letor/tests/testdata/training_data.txt index 0831f1f3fac..e4d9dc868d4 100644 --- a/xapian-letor/tests/testdata/training_data.txt +++ b/xapian-letor/tests/testdata/training_data.txt @@ -1,2 +1,2 @@ -1 qid:20001 1:1 2:1 3:1 4:0.845488 5:1 6:1 7:-0.0841209 8:-0.0841209 9:-0.168242 10:1 11:1 12:1 13:-0.0129367 14:-0.00119658 15:-0.00155454 16:0.862496 17:1 18:1 19:1 #docid=1 -2 qid:20001 1:1 2:1 3:1 4:1 5:0.684948 6:0.692569 7:-0.0841209 8:-0.0841209 9:-0.168242 10:1 11:1 12:1 13:-0.0155709 14:-0.000817232 15:-0.00107417 16:1 17:0.759881 18:0.766323 19:0.937812 #docid=2 +1 qid:20001 1:1 2:1 3:1 4:0.845488 5:1 6:1 7:-0.0841209 8:-0.168242 9:-0.252363 10:1 11:1 12:1 13:-0.0129367 14:-0.00199393 15:-0.00233163 16:0.862496 17:1 18:1 19:1 #docid=1 +2 qid:20001 1:1 2:1 3:1 4:1 5:0.684726 6:0.692481 7:-0.0841209 8:-0.168242 9:-0.252363 10:1 11:1 12:1 13:-0.0155709 14:-0.00136188 15:-0.00161117 16:1 17:0.75991 18:0.766305 19:0.938816 #docid=2 diff --git a/xapian-letor/tests/testdata/training_data_ndcg.txt b/xapian-letor/tests/testdata/training_data_ndcg.txt index 2f2aac5e781..e4d9dc868d4 100644 --- a/xapian-letor/tests/testdata/training_data_ndcg.txt +++ b/xapian-letor/tests/testdata/training_data_ndcg.txt @@ -1,2 +1,2 @@ -3 qid:1 1:0 2:1 3:0.760188 4:0 5:0.925687 6:0.846727 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:0 17:0.948648 18:0.652527 19:0.63916 #docid=1 -5 qid:1 1:1 2:0 3:0.673239 4:1 5:0 6:0.749326 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:1 17:0 18:1 19:0.622809 #docid=2 +1 qid:20001 1:1 2:1 3:1 4:0.845488 5:1 6:1 7:-0.0841209 8:-0.168242 9:-0.252363 10:1 11:1 12:1 13:-0.0129367 14:-0.00199393 15:-0.00233163 16:0.862496 17:1 18:1 19:1 #docid=1 +2 qid:20001 1:1 2:1 3:1 4:1 5:0.684726 6:0.692481 7:-0.0841209 8:-0.168242 9:-0.252363 10:1 11:1 12:1 13:-0.0155709 14:-0.00136188 15:-0.00161117 16:1 17:0.75991 18:0.766305 19:0.938816 #docid=2 diff --git a/xapian-letor/tests/testdata/training_data_one_document.txt b/xapian-letor/tests/testdata/training_data_one_document.txt index e77d9c191df..3c00bff890d 100644 --- a/xapian-letor/tests/testdata/training_data_one_document.txt +++ b/xapian-letor/tests/testdata/training_data_one_document.txt @@ -1 +1 @@ -4 qid:110001 1:1 2:1 3:1 4:1 5:1 6:1 7:-0.155541 8:-0.155541 9:-0.311083 10:1 11:1 12:1 13:-0.0269673 14:-0.00143116 15:-0.00210018 16:1 17:1 18:1 19:1 #docid=1 +4 qid:110001 1:1 2:1 3:1 4:1 5:1 6:1 7:-0.155541 8:-0.311083 9:-0.466624 10:1 11:1 12:1 13:-0.0269673 14:-0.00573887 15:-0.0063153 16:1 17:1 18:1 19:1 #docid=1 diff --git a/xapian-letor/tests/testdata/training_data_three_correct.txt b/xapian-letor/tests/testdata/training_data_three_correct.txt index 65f8319ef5d..22eb61dbe49 100644 --- a/xapian-letor/tests/testdata/training_data_three_correct.txt +++ b/xapian-letor/tests/testdata/training_data_three_correct.txt @@ -1,3 +1,3 @@ -1 qid:1 1:0.356207 2:1 3:1 4:0.190267 5:1 6:1 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:0.232356 17:1 18:0.934444 19:1 #docid=3 -3 qid:1 1:0 2:1 3:0.760188 4:0 5:0.925687 6:0.846727 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:0 17:0.948648 18:0.652527 19:0.63916 #docid=1 -5 qid:1 1:1 2:0 3:0.673239 4:1 5:0 6:0.749326 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:1 17:0 18:1 19:0.622809 #docid=2 +1 qid:1 1:0.356207 2:0.954294 3:1 4:0.190267 5:0.998006 6:1 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:0.232356 17:0.979061 18:1 19:1 #docid=3 +3 qid:1 1:0 2:1 3:0.886478 4:0 5:1 6:0.952881 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:0 17:1 18:0.868281 19:0.784878 #docid=1 +5 qid:1 1:1 2:0 3:0.432443 4:1 5:0 6:0.517255 7:0 8:0 9:0 10:1 11:1 12:1 13:0 14:0 15:0 16:1 17:0 18:0.642348 19:0.395108 #docid=2