Feat C++ API
A feature engineering automation tool
MulticlassLogisticRegression.h
Go to the documentation of this file.
1 /* This program is free software; you can redistribute it and/or modify
2  * it under the terms of the GNU General Public License as published by
3  * the Free Software Foundation; either version 3 of the License, or
4  * (at your option) any later version.
5  *
6  * Written (W) 2012 Sergey Lisitsyn
7  * Copyright (C) 2012 Sergey Lisitsyn
8  */
9 
10 #ifndef MULTICLASSLOGISTICREGRESSION_H_
11 #define MULTICLASSLOGISTICREGRESSION_H_
12 #include <shogun/lib/config.h>
13 #include <shogun/lib/common.h>
14 #include <shogun/features/DotFeatures.h>
15 #include <shogun/machine/LinearMulticlassMachine.h>
16 
17 #include <shogun/multiclass/MulticlassOneVsRestStrategy.h>
18 #include <shogun/io/SGIO.h>
19 #include <shogun/mathematics/Math.h>
20 #include <shogun/labels/MulticlassLabels.h>
21 #include <shogun/lib/slep/slep_mc_plain_lr.h>
22 
23 #include <vector>
24 
25 using std::vector;
26 #include <Eigen/Dense>
27 #include <shogun/base/some.h>
28 
29 namespace shogun
30 {
31 
35  class CMulticlassLogisticRegression : public CLinearMulticlassMachine
36  {
37  public:
38 
39  MACHINE_PROBLEM_TYPE(PT_MULTICLASS)
40 
41 
43 
49  CMulticlassLogisticRegression(float64_t z, CDotFeatures* feats, CLabels* labs);
50 
53 
55  virtual const char* get_name() const;
56 
60  void set_z(float64_t z);
61 
65  inline float64_t get_z() const;
66 
70  void set_epsilon(float64_t epsilon);
71 
75  float64_t get_epsilon() const;
76 
80  void set_max_iter(int32_t max_iter);
81 
85  inline int32_t get_max_iter() const;
86 
88  vector<SGVector<float64_t>> get_w();
89  void set_w(vector<Eigen::VectorXd>& wnew);
90 
92  vector<float64_t> get_bias();
93 
94  protected:
95 
97  virtual bool train_machine(CFeatures* data = NULL);
98 
99  private:
100 
102  void init_defaults();
103 
105  void register_parameters();
106 
107  protected:
108 
110  float64_t m_z;
111 
113  float64_t m_epsilon;
114 
116  int32_t m_max_iter;
117 
118  };
119 }
120 #endif
void set_w(vector< Eigen::VectorXd > &wnew)
virtual bool train_machine(CFeatures *data=NULL)