33 #ifndef GRT_MLP_HEADER
34 #define GRT_MLP_HEADER
37 #include "../../../CoreModules/Regressifier.h"
66 MLP &operator=(
const MLP &rhs);
107 virtual bool clear();
114 virtual bool print()
const;
123 virtual bool save( std::fstream &file )
const;
132 virtual bool load( std::fstream &file );
141 UINT getNumClasses()
const;
158 bool init(
const UINT numInputNeurons,
const UINT numHiddenNeurons,
const UINT numOutputNeurons);
177 bool init(
const UINT numInputNeurons,
const UINT numHiddenNeurons,
const UINT numOutputNeurons,
const UINT inputLayerActivationFunction,
178 const UINT hiddenLayerActivationFunction,
const UINT outputLayerActivationFunction);
184 void printNetwork()
const;
191 bool checkForNAN()
const;
199 std::string activationFunctionToString(
const UINT activationFunction)
const;
207 UINT activationFunctionFromString(
const std::string activationName)
const;
215 bool validateActivationFunction(
const UINT avactivationFunction)
const;
222 UINT getNumInputNeurons()
const;
229 UINT getNumHiddenNeurons()
const;
236 UINT getNumOutputNeurons()
const;
243 UINT getInputLayerActivationFunction()
const;
250 UINT getHiddenLayerActivationFunction()
const;
257 UINT getOutputLayerActivationFunction()
const;
267 UINT getNumRandomTrainingIterations()
const;
274 Float getTrainingRate()
const;
281 Float getMomentum()
const;
288 Float getGamma()
const;
296 Float getTrainingError()
const;
303 bool getClassificationModeActive()
const;
310 bool getRegressionModeActive()
const;
346 bool getNullRejectionEnabled()
const;
355 Float getNullRejectionCoeff()
const;
364 Float getNullRejectionThreshold()
const;
374 Float getMaximumLikelihood()
const;
395 UINT getPredictedClassLabel()
const;
404 bool setInputLayerActivationFunction(
const UINT activationFunction);
413 bool setHiddenLayerActivationFunction(
const UINT activationFunction);
422 bool setOutputLayerActivationFunction(
const UINT activationFunction);
432 bool setTrainingRate(
const Float trainingRate);
441 bool setMomentum(
const Float momentum);
450 bool setGamma(
const Float gamma);
462 bool setNumRandomTrainingIterations(
const UINT numRandomTrainingIterations);
470 bool setNullRejection(
const bool useNullRejection);
481 bool setNullRejectionCoeff(
const Float nullRejectionCoeff);
492 bool inline isNAN(
const Float v)
const;
500 bool loadLegacyModelFromFile( std::fstream &file );
511 Float back_prop(
const VectorFloat &inputVector,
const VectorFloat &targetVector,
const Float alpha,
const Float beta);
531 UINT numInputNeurons;
532 UINT numHiddenNeurons;
533 UINT numOutputNeurons;
534 UINT inputLayerActivationFunction;
535 UINT hiddenLayerActivationFunction;
536 UINT outputLayerActivationFunction;
537 UINT numRandomTrainingIterations;
551 bool classificationModeActive;
552 bool useNullRejection;
553 UINT predictedClassLabel;
554 Float nullRejectionThreshold;
555 Float nullRejectionCoeff;
569 enum TrainingModes{ONLINE_GRADIENT_DESCENT};
575 #endif //GRT_MLP_HEADER
virtual bool predict(VectorFloat inputVector)
This class implements a Neuron that is used by the Multilayer Perceptron.
virtual bool predict_(VectorFloat &inputVector)
virtual bool train(ClassificationData trainingData)
virtual bool save(const std::string filename) const
virtual bool deepCopyFrom(const Regressifier *regressifier)
virtual bool load(const std::string filename)
virtual bool print() const
virtual bool train_(ClassificationData &trainingData)