|  | OpenANN
    1.1.0
    An open source library for artificial neural networks. | 
Feedforward multilayer neural network. More...
#include <Net.h>
 Inheritance diagram for OpenANN::Net:
 Inheritance diagram for OpenANN::Net:| Public Member Functions | |
| Net () | |
| Create feedforward neural network.  More... | |
| virtual | ~Net () | 
| Architecture Definition | |
| These functions must be called to define the architecture of the network. | |
| Net & | inputLayer (int dim1, int dim2=1, int dim3=1) | 
| Add an input layer.  More... | |
| Net & | alphaBetaFilterLayer (double deltaT, double stdDev=0.05) | 
| Add a alpha-beta filter layer.  More... | |
| Net & | fullyConnectedLayer (int units, ActivationFunction act, double stdDev=0.05, bool bias=true) | 
| Add a fully connected hidden layer.  More... | |
| Net & | restrictedBoltzmannMachineLayer (int H, int cdN=1, double stdDev=0.01, bool backprop=true) | 
| Add a layer that contains an RBM.  More... | |
| Net & | sparseAutoEncoderLayer (int H, double beta, double rho, ActivationFunction act) | 
| Add a sparse auto-encoder.  More... | |
| Net & | compressedLayer (int units, int params, ActivationFunction act, const std::string &compression, double stdDev=0.05, bool bias=true) | 
| Add a compressed fully connected hidden layer.  More... | |
| Net & | extremeLayer (int units, ActivationFunction act, double stdDev=5.0, bool bias=true) | 
| Add a fully connected hidden layer with fixed weights.  More... | |
| Net & | intrinsicPlasticityLayer (double targetMean, double stdDev=1.0) | 
| Add an intrinsic plasticity layer that is able to learn the parameters of a logistic activation function.  More... | |
| Net & | convolutionalLayer (int featureMaps, int kernelRows, int kernelCols, ActivationFunction act, double stdDev=0.05, bool bias=true) | 
| Add a convolutional layer.  More... | |
| Net & | subsamplingLayer (int kernelRows, int kernelCols, ActivationFunction act, double stdDev=0.05, bool bias=true) | 
| Add a subsampling layer.  More... | |
| Net & | maxPoolingLayer (int kernelRows, int kernelCols) | 
| Add a max-pooling layer.  More... | |
| Net & | localReponseNormalizationLayer (double k, int n, double alpha, double beta) | 
| Add a local response normalization layer.  More... | |
| Net & | dropoutLayer (double dropoutProbability) | 
| Add a dropout layer.  More... | |
| Net & | outputLayer (int units, ActivationFunction act, double stdDev=0.05, bool bias=true) | 
| Add a fully connected output layer.  More... | |
| Net & | compressedOutputLayer (int units, int params, ActivationFunction act, const std::string &compression, double stdDev=0.05, bool bias=true) | 
| Add a compressed output layer.  More... | |
| Net & | addLayer (Layer *layer) | 
| Add a new layer to this deep neural network.  More... | |
| Net & | addOutputLayer (Layer *layer) | 
| Add a new output layer to this deep neural network.  More... | |
| Access Internal Structure | |
| unsigned int | numberOflayers () | 
| Request number of layers.  More... | |
| Layer & | getLayer (unsigned int l) | 
| Access layer.  More... | |
| OutputInfo | getOutputInfo (unsigned int l) | 
| Request information about output of a given layer.  More... | |
| DataSet * | propagateDataSet (DataSet &dataSet, int l) | 
| Propagate data set through the first l layers.  More... | |
| Persistence | |
| void | save (const std::string &fileName) | 
| Save network.  More... | |
| void | save (std::ostream &stream) | 
| Save network.  More... | |
| void | load (const std::string &fileName) | 
| Load network from file.  More... | |
| void | load (std::istream &stream) | 
| Load network from stream.  More... | |
| Optimization Contol | |
| Net & | setRegularization (double l1Penalty=0.0, double l2Penalty=0.0, double maxSquaredWeightNorm=0.0) | 
| Net & | setErrorFunction (ErrorFunction errorFunction) | 
| Set the error function.  More... | |
| Net & | useDropout (bool activate=true) | 
| Toggle dropout.  More... | |
| Inherited Functions | |
| virtual Eigen::VectorXd | operator() (const Eigen::VectorXd &x) | 
| Make a prediction.  More... | |
| virtual Eigen::MatrixXd | operator() (const Eigen::MatrixXd &X) | 
| Make predictions.  More... | |
| virtual unsigned int | dimension () | 
| Request the number of optimizable parameters.  More... | |
| virtual const Eigen::VectorXd & | currentParameters () | 
| Request the current parameters.  More... | |
| virtual void | setParameters (const Eigen::VectorXd ¶meters) | 
| Set new parameters.  More... | |
| virtual bool | providesInitialization () | 
| Check if the object knows how to initialize its parameters.  More... | |
| virtual void | initialize () | 
| Initialize the optimizable parameters.  More... | |
| virtual unsigned int | examples () | 
| Request number of training examples.  More... | |
| virtual double | error (unsigned int n) | 
| virtual double | error () | 
| Compute error on training set.  More... | |
| virtual bool | providesGradient () | 
| Check if the object provides a gradient of the error function with respect to its parameters.  More... | |
| virtual Eigen::VectorXd | gradient (unsigned int n) | 
| virtual Eigen::VectorXd | gradient () | 
| Compute gradient of the error function with respect to the parameters.  More... | |
| virtual void | errorGradient (int n, double &value, Eigen::VectorXd &grad) | 
| Calculates the function value and gradient of a training example.  More... | |
| virtual void | errorGradient (double &value, Eigen::VectorXd &grad) | 
| Calculates the function value and gradient of all training examples.  More... | |
| virtual void | errorGradient (std::vector< int >::const_iterator startN, std::vector< int >::const_iterator endN, double &value, Eigen::VectorXd &grad) | 
| Calculates the accumulated gradient and error of given training examples.  More... | |
| virtual void | finishedIteration () | 
| This callback is called after each optimization algorithm iteration.  More... | |
|  Public Member Functions inherited from OpenANN::Learner | |
| Learner () | |
| virtual | ~Learner () | 
| virtual Learner & | trainingSet (Eigen::MatrixXd &input, Eigen::MatrixXd &output) | 
| Set training set.  More... | |
| virtual Learner & | trainingSet (DataSet &trainingSet) | 
| Set training set.  More... | |
| virtual Learner & | removeTrainingSet () | 
| Remove the training set from the learner.  More... | |
| virtual Learner & | validationSet (Eigen::MatrixXd &input, Eigen::MatrixXd &output) | 
| Set validation set.  More... | |
| virtual Learner & | validationSet (DataSet &validationSet) | 
| Set validation set.  More... | |
| virtual Learner & | removeValidationSet () | 
| Remove the validation set from the learner.  More... | |
|  Public Member Functions inherited from OpenANN::Optimizable | |
| virtual | ~Optimizable () | 
| virtual double | error (unsigned n) | 
| Compute error of a given training example.  More... | |
| virtual Eigen::VectorXd | gradient (unsigned n) | 
| Compute gradient of a given training example.  More... | |
| virtual Eigen::VectorXd | error (std::vector< int >::const_iterator startN, std::vector< int >::const_iterator endN) | 
| Calculates the errors of given training examples.  More... | |
| virtual Eigen::VectorXd | gradient (std::vector< int >::const_iterator startN, std::vector< int >::const_iterator endN) | 
| Calculates the accumulated gradient of given training examples.  More... | |
| Protected Member Functions | |
| void | initializeNetwork () | 
| void | forwardPropagate (double *error) | 
| void | backpropagate () | 
| Protected Attributes | |
| std::vector< OutputInfo > | infos | 
| std::vector< Layer * > | layers | 
| std::vector< double * > | parameters | 
| std::vector< double * > | derivatives | 
| Regularization | regularization | 
| ErrorFunction | errorFunction | 
| bool | dropout | 
| bool | initialized | 
| int | P | 
| int | L | 
| Eigen::VectorXd | parameterVector | 
| Eigen::VectorXd | tempGradient | 
| Eigen::MatrixXd | tempInput | 
| Eigen::MatrixXd | tempOutput | 
| Eigen::MatrixXd | tempError | 
| std::stringstream | architecture | 
|  Protected Attributes inherited from OpenANN::Learner | |
| DataSet * | trainSet | 
| DataSet * | validSet | 
| bool | deleteTrainSet | 
| bool | deleteValidSet | 
| int | N | 
Feedforward multilayer neural network.
You can specify many different types of layers and choose the architecture almost arbitrary.
| OpenANN::Net::Net | ( | ) | 
Create feedforward neural network.
| 
 | virtual | 
| Net& OpenANN::Net::alphaBetaFilterLayer | ( | double | deltaT, | 
| double | stdDev = 0.05 | ||
| ) | 
Add a alpha-beta filter layer.
| deltaT | temporal difference between two steps | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| 
 | protected | 
| Net& OpenANN::Net::compressedLayer | ( | int | units, | 
| int | params, | ||
| ActivationFunction | act, | ||
| const std::string & | compression, | ||
| double | stdDev = 0.05, | ||
| bool | bias = true | ||
| ) | 
Add a compressed fully connected hidden layer.
| units | number of nodes (neurons) | 
| params | number of parameters to represent the incoming weights of a neuron in this layer | 
| act | activation function | 
| compression | type of compression matrix, possible values are dct, gaussian, sparse, average, edge | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
| Net& OpenANN::Net::compressedOutputLayer | ( | int | units, | 
| int | params, | ||
| ActivationFunction | act, | ||
| const std::string & | compression, | ||
| double | stdDev = 0.05, | ||
| bool | bias = true | ||
| ) | 
Add a compressed output layer.
This will initialize the network.
| units | number of nodes (neurons) | 
| params | number of parameters to represent the incoming weights of a neuron in this layer | 
| act | activation function | 
| compression | type of compression matrix, possible values are dct, gaussian, sparse, average, edge | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
| Net& OpenANN::Net::convolutionalLayer | ( | int | featureMaps, | 
| int | kernelRows, | ||
| int | kernelCols, | ||
| ActivationFunction | act, | ||
| double | stdDev = 0.05, | ||
| bool | bias = true | ||
| ) | 
Add a convolutional layer.
| featureMaps | number of feature maps | 
| kernelRows | number of kernel rows | 
| kernelCols | number of kernel columns | 
| act | activation function | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
| 
 | virtual | 
| 
 | virtual | 
Request the number of optimizable parameters.
Implements OpenANN::Optimizable.
| Net& OpenANN::Net::dropoutLayer | ( | double | dropoutProbability) | 
Add a dropout layer.
| dropoutProbability | probability of suppression during training | 
| 
 | virtual | 
| 
 | virtual | 
Compute error on training set.
Implements OpenANN::Optimizable.
| 
 | virtual | 
Calculates the function value and gradient of a training example.
| n | index of training example | 
| value | function value | 
| grad | gradient of the function, lenght must be dimension() | 
Reimplemented from OpenANN::Optimizable.
| 
 | virtual | 
Calculates the function value and gradient of all training examples.
| value | function value | 
| grad | gradient of the function, lenght must be dimension() | 
Reimplemented from OpenANN::Optimizable.
| 
 | virtual | 
Calculates the accumulated gradient and error of given training examples.
| startN | iterator over index vector | 
| endN | iterator over index vector | 
| value | function value | 
| grad | gradient of the function, lenght must be dimension() | 
Reimplemented from OpenANN::Optimizable.
| 
 | virtual | 
Request number of training examples.
Reimplemented from OpenANN::Optimizable.
| Net& OpenANN::Net::extremeLayer | ( | int | units, | 
| ActivationFunction | act, | ||
| double | stdDev = 5.0, | ||
| bool | bias = true | ||
| ) | 
Add a fully connected hidden layer with fixed weights.
| units | number of nodes (neurons) | 
| act | activation function | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
| 
 | virtual | 
This callback is called after each optimization algorithm iteration.
Reimplemented from OpenANN::Optimizable.
| 
 | protected | 
| Net& OpenANN::Net::fullyConnectedLayer | ( | int | units, | 
| ActivationFunction | act, | ||
| double | stdDev = 0.05, | ||
| bool | bias = true | ||
| ) | 
Add a fully connected hidden layer.
| units | number of nodes (neurons) | 
| act | activation function | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
| Layer& OpenANN::Net::getLayer | ( | unsigned int | l) | 
Access layer.
| l | index of layer | 
| OutputInfo OpenANN::Net::getOutputInfo | ( | unsigned int | l) | 
Request information about output of a given layer.
| l | index of the layer | 
| 
 | virtual | 
| 
 | virtual | 
Compute gradient of the error function with respect to the parameters.
Implements OpenANN::Optimizable.
| 
 | virtual | 
Initialize the optimizable parameters.
Implements OpenANN::Optimizable.
| 
 | protected | 
| Net& OpenANN::Net::inputLayer | ( | int | dim1, | 
| int | dim2 = 1, | ||
| int | dim3 = 1 | ||
| ) | 
Add an input layer.
| dim1 | first dimension of the input, e. g. number of color channels of an image | 
| dim2 | second dimension, e. g. number of rows of an image | 
| dim3 | third dimension, e. g. number of columns of an image | 
| Net& OpenANN::Net::intrinsicPlasticityLayer | ( | double | targetMean, | 
| double | stdDev = 1.0 | ||
| ) | 
Add an intrinsic plasticity layer that is able to learn the parameters of a logistic activation function.
| targetMean | desired mean of the output distribution, must be within [0, 1], e.g. 0.2 | 
| stdDev | standard deviation of the Gaussian distributed initial biases | 
| void OpenANN::Net::load | ( | const std::string & | fileName) | 
Load network from file.
| fileName | name of the file | 
| void OpenANN::Net::load | ( | std::istream & | stream) | 
Load network from stream.
| stream | input stream | 
| Net& OpenANN::Net::localReponseNormalizationLayer | ( | double | k, | 
| int | n, | ||
| double | alpha, | ||
| double | beta | ||
| ) | 
Add a local response normalization layer.
 
 
| k | hyperparameter, k >= 1, e.g. 1 or 2 | 
| n | number of adjacent feature maps | 
| alpha | controls strength of inhibition, alpha > 0, e.g. 1e-4 | 
| beta | controls strength of inhibition, beta > 0, e.g. 0.75 | 
| Net& OpenANN::Net::maxPoolingLayer | ( | int | kernelRows, | 
| int | kernelCols | ||
| ) | 
Add a max-pooling layer.
| kernelRows | number of kernel rows | 
| kernelCols | number of kernel columns | 
| unsigned int OpenANN::Net::numberOflayers | ( | ) | 
Request number of layers.
| 
 | virtual | 
| 
 | virtual | 
Make predictions.
| X | Each row represents an input vector. | 
Implements OpenANN::Learner.
| Net& OpenANN::Net::outputLayer | ( | int | units, | 
| ActivationFunction | act, | ||
| double | stdDev = 0.05, | ||
| bool | bias = true | ||
| ) | 
Add a fully connected output layer.
This will initialize the network.
| units | number of nodes (neurons) | 
| act | activation function | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
Propagate data set through the first l layers.
| dataSet | original dataset | 
| l | index of the layer | 
| 
 | virtual | 
Check if the object provides a gradient of the error function with respect to its parameters.
Implements OpenANN::Optimizable.
| 
 | virtual | 
Check if the object knows how to initialize its parameters.
Implements OpenANN::Optimizable.
| Net& OpenANN::Net::restrictedBoltzmannMachineLayer | ( | int | H, | 
| int | cdN = 1, | ||
| double | stdDev = 0.01, | ||
| bool | backprop = true | ||
| ) | 
Add a layer that contains an RBM.
| H | number of nodes (neurons) | 
| cdN | number of gibbs sampling steps for pretraining | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| backprop | finetune weights with backpropagation | 
| void OpenANN::Net::save | ( | const std::string & | fileName) | 
Save network.
| fileName | name of the file | 
| void OpenANN::Net::save | ( | std::ostream & | stream) | 
Save network.
| stream | output stream | 
| Net& OpenANN::Net::setErrorFunction | ( | ErrorFunction | errorFunction) | 
Set the error function.
| errorFunction | error function | 
| 
 | virtual | 
| Net& OpenANN::Net::setRegularization | ( | double | l1Penalty = 0.0, | 
| double | l2Penalty = 0.0, | ||
| double | maxSquaredWeightNorm = 0.0 | ||
| ) | 
| Net& OpenANN::Net::sparseAutoEncoderLayer | ( | int | H, | 
| double | beta, | ||
| double | rho, | ||
| ActivationFunction | act | ||
| ) | 
Add a sparse auto-encoder.
| H | number of outputs | 
| beta | weight of sparsity | 
| rho | desired mean activation of hidden neurons | 
| act | activation function of the hidden layer | 
| Net& OpenANN::Net::subsamplingLayer | ( | int | kernelRows, | 
| int | kernelCols, | ||
| ActivationFunction | act, | ||
| double | stdDev = 0.05, | ||
| bool | bias = true | ||
| ) | 
Add a subsampling layer.
| kernelRows | number of kernel rows | 
| kernelCols | number of kernel columns | 
| act | activation function | 
| stdDev | standard deviation of the Gaussian distributed initial weights | 
| bias | add bias term | 
| Net& OpenANN::Net::useDropout | ( | bool | activate = true) | 
Toggle dropout.
| activate | turn dropout on or off | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
| 
 | protected | 
 1.8.4
 1.8.4