Skip to content

Commit

Permalink
Fix training related files and tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
VaibhavKansagara authored and ojwb committed Jul 1, 2022
1 parent 2a43250 commit 39f6e08
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions xapian-letor/tests/api_letor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions xapian-letor/tests/testdata/training_data.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions xapian-letor/tests/testdata/training_data_ndcg.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion xapian-letor/tests/testdata/training_data_one_document.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions xapian-letor/tests/testdata/training_data_three_correct.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 39f6e08

Please sign in to comment.