Fix replication for files > 4GB on 32-bit platforms
[xapian.git] / xapian-letor / ranker.h
blob145a52507e48ea045dc55fa0f090366a3f6aad9d
1 /* ranker.h: The abstract ranker file.
3 * Copyright (C) 2012 Parth Gupta
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18 * USA
21 #ifndef RANKER_H
22 #define RANKER_H
25 #include <xapian.h>
26 #include <xapian/intrusive_ptr.h>
27 #include <xapian/types.h>
28 #include <xapian/visibility.h>
30 #include <ranklist.h>
31 #include <evalmetric.h>
33 #include <list>
34 #include <map>
37 using namespace std;
40 namespace Xapian {
42 class XAPIAN_VISIBILITY_DEFAULT Ranker {
45 std::list<Xapian::RankList> traindata;
46 std::list<Xapian::RankList> validata;
47 std::list<Xapian::RankList> testdata;
49 Xapian::EvalMetric trainMetric;
50 Xapian::EvalMetric testMetric;
51 public:
52 Ranker();
54 /* Override all the four methods below in the ranker sub-classes files
55 * wiz svmranker.cc , listnet.cc, listmle.cc and so on
57 std::list<double> rank(const Xapian::RankList & rl);
59 void learn_model();
61 void load_model(const std::string & model_file);
63 void save_model();
65 /* This method should read the letor format data and transform into the list of
66 * Xapian::RankList format
68 std::list<Xapian::RankList> load_data(const std::string & data_file);
73 #endif /* RANKER_H */