source: orange/source/orange/liblinear_interface.hpp @ 11703:9b8d8ab7820c

Revision 11703:9b8d8ab7820c, 1.7 KB checked in by janezd <janez.demsar@…>, 7 months ago (diff)

Removed the GPL copyright notice from all files except orangeqt.

Line 
1#ifndef LINEAR_HPP
2#define LINEAR_HPP
3
4// LIBLINEAR header
5
6#include "linear.h"
7
8#include <map>
9#include "classify.hpp"
10#include "learn.hpp"
11#include "orange.hpp"
12#include "domain.hpp"
13#include "examplegen.hpp"
14#include "table.hpp"
15#include "examples.hpp"
16
17// Alternative model save/load routines (using iostream, needed for in memory serialization)
18int linear_save_model_alt(string &, model *);
19model *linear_load_model_alt(string &);
20
21WRAPPER(ExampleTable)
22
23class ORANGE_API TLinearLearner : public TLearner{
24public:
25    __REGISTER_CLASS
26   
27    CLASSCONSTANTS(Lossfunction1_old_) enum {L2_LR, L2Loss_SVM_Dual, L2Loss_SVM, L1Loss_SVM_Dual }; //For backwards compatibility with 1.4 version.
28    CLASSCONSTANTS(Lossfunction1) enum {L2R_LR, L2R_L2Loss_SVC_Dual, L2R_L2Loss_SVC, L2R_L1Loss_SVC_Dual, MCSVM_CS, L1R_L2Loss_SVC, L1R_LR, L2R_LR_Dual};
29    CLASSCONSTANTS(LIBLINEAR_VERSION: VERSION=180)
30   
31    int solver_type;    //P(&LinearLearner_Lossfunction1) Solver type (loss function1)
32    float eps;          //P Stopping criteria
33    float C;            //P Regularization parameter C
34    float bias;         //P bias parameter (default -1.0 - no bias)
35
36    TLinearLearner();
37    PClassifier operator()(PExampleGenerator, const int & = 0);
38};
39
40class ORANGE_API TLinearClassifier : public TClassifierFD {
41public:
42    __REGISTER_CLASS
43
44    TLinearClassifier() {};
45
46    TLinearClassifier(PDomain domain, struct model * model);
47
48    ~TLinearClassifier();
49
50    PDistribution classDistribution(const TExample &);
51    TValue operator()(const TExample&);
52
53    PFloatListList weights; //P Computed feature weights
54    float bias; //PR bias
55
56    model *getModel(){ return linmodel; }
57
58private:
59    model *linmodel;
60    // bias in double precision.
61    double dbias;
62    int get_nr_values();
63};
64
65WRAPPER(LinearLearner)
66WRAPPER(LinearClassifier)
67
68#endif /* LINEAR_HPP */
Note: See TracBrowser for help on using the repository browser.