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.
Softmax.h
Go to the documentation of this file.
1 
26 #ifndef GRT_SOFTMAX_HEADER
27 #define GRT_SOFTMAX_HEADER
28 
29 #include "../../CoreModules/Classifier.h"
30 #include "SoftmaxModel.h"
31 
32 GRT_BEGIN_NAMESPACE
33 
41 class GRT_API Softmax : public Classifier
42 {
43  public:
53  Softmax(const bool useScaling=false,const Float learningRate = 0.1,const Float minChange = 1.0e-10,const UINT maxNumEpochs = 1000,const UINT batchSize = 50);
54 
60  Softmax(const Softmax &rhs);
61 
65  virtual ~Softmax(void);
66 
73  Softmax &operator=(const Softmax &rhs);
74 
82  virtual bool deepCopyFrom(const Classifier *classifier);
83 
91  virtual bool train_(ClassificationData &trainingData);
92 
100  virtual bool predict_(VectorFloat &inputVector);
101 
108  virtual bool clear();
109 
117  virtual bool save( std::fstream &file ) const;
118 
126  virtual bool load( std::fstream &file );
127 
133  Vector< SoftmaxModel > getModels() const;
134 
135 
141  static std::string getId();
142 
143  //Tell the compiler we are using the base class train method to stop hidden virtual function warnings
144  using MLBase::save;
145  using MLBase::load;
146 
147 protected:
148  bool trainSoftmaxModel(UINT classLabel,SoftmaxModel &model,ClassificationData &data);
149  bool loadLegacyModelFromFile( std::fstream &file );
150 
151  UINT batchSize;
152  Vector< SoftmaxModel > models;
153 
154 private:
155  static const std::string id;
156  static RegisterClassifierModule< Softmax > registerModule;
157 };
158 
159 GRT_END_NAMESPACE
160 
161 #endif //GRT_SOFTMAX_HEADER
162 
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 Classifier *classifier)
Definition: Classifier.h:64
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:109
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190
This file implements a container for a Softmax model.
virtual bool clear()
Definition: Classifier.cpp:151
This is the main base class that all GRT Classification algorithms should inherit from...
Definition: Classifier.h:41