MLPACK  1.0.11
perceptron.hpp
Go to the documentation of this file.
1 
22 #ifndef __MLPACK_METHODS_PERCEPTRON_PERCEPTRON_HPP
23 #define __MLPACK_METHODS_PERCEPTRON_PERCEPTRON_HPP
24 
25 #include <mlpack/core.hpp>
26 
30 
31 namespace mlpack {
32 namespace perceptron {
33 
43 template<typename LearnPolicy = SimpleWeightUpdate,
44  typename WeightInitializationPolicy = ZeroInitialization,
45  typename MatType = arma::mat>
47 {
48  public:
59  Perceptron(const MatType& data, const arma::Row<size_t>& labels, int iterations);
60 
69  void Classify(const MatType& test, arma::Row<size_t>& predictedLabels);
70 
81  Perceptron(const Perceptron<>& other, MatType& data, const arma::rowvec& D, const arma::Row<size_t>& labels);
82 
83 private:
85  size_t iter;
86 
88  arma::Row<size_t> classLabels;
89 
91  arma::mat weightVectors;
92 
94  arma::mat trainData;
95 
101  void Train(const arma::rowvec& D);
102 };
103 
104 } // namespace perceptron
105 } // namespace mlpack
106 
107 #include "perceptron_impl.hpp"
108 
109 #endif
void Train(const arma::rowvec &D)
Training Function.
arma::mat weightVectors
Stores the weight vectors for each of the input class labels.
Definition: perceptron.hpp:91
Perceptron(const MatType &data, const arma::Row< size_t > &labels, int iterations)
Constructor - constructs the perceptron by building the weightVectors matrix, which is later used in ...
arma::Row< size_t > classLabels
Stores the class labels for the input data.
Definition: perceptron.hpp:88
void Classify(const MatType &test, arma::Row< size_t > &predictedLabels)
Classification function.
arma::mat trainData
Stores the training data to be used later on in UpdateWeights.
Definition: perceptron.hpp:94
size_t iter
To store the number of iterations.
Definition: perceptron.hpp:85
This class implements a simple perceptron (i.e., a single layer neural network).
Definition: perceptron.hpp:46