This class implements a simple perceptron (i.e., a single layer neural network).
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 Classification. Perceptron (const Perceptron<> &other, MatType &data, const arma::rowvec &D, const arma::Row< size_t > &labels)
Alternate constructor which copies parameters from an already initiated perceptron. void Classify (const MatType &test, arma::Row< size_t > &predictedLabels)
Classification function.
void Train (const arma::rowvec &D)
Training Function.
arma::Row< size_t > classLabels
Stores the class labels for the input data. size_t iter
To store the number of iterations. arma::mat trainData
Stores the training data to be used later on in UpdateWeights. arma::mat weightVectors
Stores the weight vectors for each of the input class labels.
This class implements a simple perceptron (i.e., a single layer neural network).
It converges if the supplied training dataset is linearly separable.
Template Parameters:
LearnPolicy Options of SimpleWeightUpdate and GradientDescent.
WeightInitializationPolicy Option of ZeroInitialization and RandomInitialization.
Definition at line 46 of file perceptron.hpp.
Constructor - constructs the perceptron by building the weightVectors matrix, which is later used in Classification. It adds a bias input vector of 1 to the input data to take care of the bias weights.
Parameters:
data Input, training data.
labels Labels of dataset.
iterations Maximum number of iterations for the perceptron learning algorithm.
Alternate constructor which copies parameters from an already initiated perceptron.
Parameters:
other The other initiated Perceptron object from which we copy the values from.
data The data on which to train this Perceptron object on.
D Weight vector to use while training. For boosting purposes.
labels The labels of data.
Classification function. After training, use the weightVectors matrix to classify test, and put the predicted classes in predictedLabels.
Parameters:
test Testing data or data to classify.
predictedLabels Vector to store the predicted classes after classifying test.
Training Function. It trains on trainData using the cost matrix D
Parameters:
D Cost matrix. Stores the cost of mispredicting instances
Stores the class labels for the input data.
Definition at line 88 of file perceptron.hpp.
To store the number of iterations.
Definition at line 85 of file perceptron.hpp.
Stores the training data to be used later on in UpdateWeights.
Definition at line 94 of file perceptron.hpp.
Stores the weight vectors for each of the input class labels.
Definition at line 91 of file perceptron.hpp.
Generated automatically by Doxygen for MLPACK from the source code.