14 #ifndef __MLPACK_METHODS_PERCEPTRON_PERCEPTRON_HPP
15 #define __MLPACK_METHODS_PERCEPTRON_PERCEPTRON_HPP
24 namespace perceptron {
35 template<
typename LearnPolicy = SimpleWeightUpdate,
36 typename WeightInitializationPolicy = ZeroInitialization,
37 typename MatType = arma::mat>
51 Perceptron(
const MatType& data,
const arma::Row<size_t>& labels,
int iterations);
61 void Classify(
const MatType& test, arma::Row<size_t>& predictedLabels);
73 Perceptron(
const Perceptron<>& other, MatType& data,
const arma::rowvec& D,
const arma::Row<size_t>& labels);
93 void Train(
const arma::rowvec& D);
99 #include "perceptron_impl.hpp"
void Train(const arma::rowvec &D)
Training Function.
arma::mat weightVectors
Stores the weight vectors for each of the input class labels.
Linear algebra utility functions, generally performed on matrices or vectors.
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.
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.
size_t iter
To store the number of iterations.
This class implements a simple perceptron (i.e., a single layer neural network).