SYNOPSIS

Public Member Functions

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.

Private Member Functions

void Train (const arma::rowvec &D)

Training Function.

Private Attributes

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.

Detailed Description

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat>class mlpack::perceptron::Perceptron< LearnPolicy, WeightInitializationPolicy, MatType >

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 & Destructor Documentation

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::\fBPerceptron\fP (const MatType &data, const arma::Row< size_t > &labels, intiterations)

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.

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::\fBPerceptron\fP (const \fBPerceptron\fP<> &other, MatType &data, const arma::rowvec &D, const arma::Row< size_t > &labels)

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.

Member Function Documentation

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> void \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::Classify (const MatType &test, arma::Row< size_t > &predictedLabels)

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.

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> void \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::Train (const arma::rowvec &D)\fC [private]\fP

Training Function. It trains on trainData using the cost matrix D

Parameters:

D Cost matrix. Stores the cost of mispredicting instances

Member Data Documentation

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> arma::Row<size_t> \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::classLabels\fC [private]\fP

Stores the class labels for the input data.

Definition at line 88 of file perceptron.hpp.

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> size_t \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::iter\fC [private]\fP

To store the number of iterations.

Definition at line 85 of file perceptron.hpp.

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> arma::mat \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::trainData\fC [private]\fP

Stores the training data to be used later on in UpdateWeights.

Definition at line 94 of file perceptron.hpp.

template<typename LearnPolicy = SimpleWeightUpdate, typename WeightInitializationPolicy = ZeroInitialization, typename MatType = arma::mat> arma::mat \fBmlpack::perceptron::Perceptron\fP< LearnPolicy, WeightInitializationPolicy, MatType >::weightVectors\fC [private]\fP

Stores the weight vectors for each of the input class labels.

Definition at line 91 of file perceptron.hpp.

Author

Generated automatically by Doxygen for MLPACK from the source code.