xapian-inspect: Support glass instead of chert
[xapian.git] / xapian-letor / ranker / svmranker.h
blob35a356aa24ca0ef0a3859f0f812f448207160a19
1 /* svmranker.h: The svmranker 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 SVMRANKER_H
22 #define SVMRANKER_H
25 #include <xapian.h>
26 #include <xapian/intrusive_ptr.h>
27 #include <xapian/types.h>
28 #include <xapian/visibility.h>
30 #include "xapian-letor/ranker.h"
31 #include "xapian-letor/ranklist.h"
32 #include "xapian-letor/featurevector.h"
33 //#include "evalmetric.h"
35 #include <list>
36 #include <map>
38 using namespace std;
41 namespace Xapian {
43 class XAPIAN_VISIBILITY_DEFAULT SVMRanker: public Ranker {
45 string model;
46 double weight[];
47 public:
48 SVMRanker() {};
50 /* Override all the four methods below in the ranker sub-classes files
51 * wiz svmranker.cc , listnet.cc, listmle.cc and so on
53 std::list<double> rank(const Xapian::RankList & rl);
55 void learn_model();
57 void load_model(const std::string & model_file);
59 void save_model();
61 double score(const Xapian::FeatureVector & fv);
66 #endif /* SVMRANKER_H */