GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
LogisticRegression.h
Go to the documentation of this file.
1 
26 #ifndef GRT_LOGISTIC_REGRESSION_HEADER
27 #define GRT_LOGISTIC_REGRESSION_HEADER
28 
29 #include "../../CoreModules/Regressifier.h"
30 
31 GRT_BEGIN_NAMESPACE
32 
38 class GRT_API LogisticRegression : public Regressifier
39 {
40 public:
51  LogisticRegression(const bool useScaling=true,const Float learningRate=0.01,const Float minChange=1.0e-5,const UINT batchSize=1,const UINT maxNumEpochs=500,const UINT minNumEpochs=1);
52 
59 
63  virtual ~LogisticRegression(void);
64 
71  LogisticRegression &operator=(const LogisticRegression &rhs);
72 
80  virtual bool deepCopyFrom(const Regressifier *regressifier);
81 
89  virtual bool train_(RegressionData &trainingData);
90 
98  virtual bool predict_(VectorFloat &inputVector);
99 
107  virtual bool save( std::fstream &file ) const;
108 
116  virtual bool load( std::fstream &file );
117 
123  UINT getMaxNumIterations() const;
124 
132  bool setMaxNumIterations(UINT maxNumIterations);
133 
139  static std::string getId();
140 
141  //Tell the compiler we are using the base class train method to stop hidden virtual function warnings
142  using MLBase::save;
143  using MLBase::load;
144 
145 protected:
146  inline Float sigmoid(const Float x) const;
147  bool loadLegacyModelFromFile( std::fstream &file );
148 
149  Float w0;
151 
152 private:
154  static const std::string id;
155 };
156 
157 GRT_END_NAMESPACE
158 
159 #endif //GRT_LOGISTIC_REGRESSION_HEADER
160 
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool deepCopyFrom(const Regressifier *regressifier)
Definition: Regressifier.h:64
VectorFloat w
The weights vector.
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:109
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190