OpenANN  1.1.0
An open source library for artificial neural networks.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions
OpenANN::Optimizable Class Referenceabstract

Represents an optimizable object. More...

#include <Optimizable.h>

+ Inheritance diagram for OpenANN::Optimizable:

Public Member Functions

virtual ~Optimizable ()
 
virtual void finishedIteration ()
 This callback is called after each optimization algorithm iteration. More...
 
Batch Methods

Functions that must be implemented in every Optimizable.

virtual bool providesInitialization ()=0
 Check if the object knows how to initialize its parameters. More...
 
virtual void initialize ()=0
 Initialize the optimizable parameters. More...
 
virtual unsigned dimension ()=0
 Request the number of optimizable parameters. More...
 
virtual const Eigen::VectorXd & currentParameters ()=0
 Request the current parameters. More...
 
virtual void setParameters (const Eigen::VectorXd &parameters)=0
 Set new parameters. More...
 
virtual double error ()=0
 Compute error on training set. More...
 
virtual bool providesGradient ()=0
 Check if the object provides a gradient of the error function with respect to its parameters. More...
 
virtual Eigen::VectorXd gradient ()=0
 Compute gradient of the error function with respect to the parameters. More...
 
Mini-batch Methods

Functions that should be implemented to speed up optimization and are required by some optimization algorithms.

virtual unsigned examples ()
 Request number of training examples. More...
 
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 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 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...
 
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...
 

Detailed Description

Represents an optimizable object.

An optimizable object can be arbitrary as long as it provides some objective function. The objective function in this context is called error function and will be minimized. This could be e.g. the sum of squared error between predictions and targets for a neural network. But the idea behind this is more general. We can e.g. optimize the reward in a reinforcement learning problem or the energy of an unsupervised model like an RBM.

Constructor & Destructor Documentation

virtual OpenANN::Optimizable::~Optimizable ( )
inlinevirtual

Member Function Documentation

virtual const Eigen::VectorXd& OpenANN::Optimizable::currentParameters ( )
pure virtual

Request the current parameters.

Returns
current parameters

Implemented in OpenANN::Net, OpenANN::RBM, OpenANN::IntrinsicPlasticity, NeuroEvolutionAgent, and OpenANN::SparseAutoEncoder.

virtual unsigned OpenANN::Optimizable::dimension ( )
pure virtual

Request the number of optimizable parameters.

Returns
number of optimizable parameters

Implemented in OpenANN::Net, OpenANN::RBM, NeuroEvolutionAgent, OpenANN::IntrinsicPlasticity, and OpenANN::SparseAutoEncoder.

virtual double OpenANN::Optimizable::error ( )
pure virtual

Compute error on training set.

Returns
current error on training set or objective function value

Implemented in OpenANN::Net, OpenANN::RBM, NeuroEvolutionAgent, OpenANN::IntrinsicPlasticity, and OpenANN::SparseAutoEncoder.

virtual double OpenANN::Optimizable::error ( unsigned  n)
inlinevirtual

Compute error of a given training example.

Parameters
nindex of the training example in the dataset
Returns
error of the n-th training example
virtual Eigen::VectorXd OpenANN::Optimizable::error ( std::vector< int >::const_iterator  startN,
std::vector< int >::const_iterator  endN 
)
virtual

Calculates the errors of given training examples.

Parameters
startNiterator over index vector
endNiterator over index vector
Returns
each row contains the error for one training example
virtual void OpenANN::Optimizable::errorGradient ( int  n,
double &  value,
Eigen::VectorXd &  grad 
)
virtual

Calculates the function value and gradient of a training example.

Parameters
nindex of training example
valuefunction value
gradgradient of the function, lenght must be dimension()

Reimplemented in OpenANN::Net.

virtual void OpenANN::Optimizable::errorGradient ( double &  value,
Eigen::VectorXd &  grad 
)
virtual

Calculates the function value and gradient of all training examples.

Parameters
valuefunction value
gradgradient of the function, lenght must be dimension()

Reimplemented in OpenANN::Net, and OpenANN::SparseAutoEncoder.

virtual void OpenANN::Optimizable::errorGradient ( std::vector< int >::const_iterator  startN,
std::vector< int >::const_iterator  endN,
double &  value,
Eigen::VectorXd &  grad 
)
virtual

Calculates the accumulated gradient and error of given training examples.

Parameters
startNiterator over index vector
endNiterator over index vector
valuefunction value
gradgradient of the function, lenght must be dimension()
Returns
each row contains the gradient for one training example

Reimplemented in OpenANN::Net, and OpenANN::RBM.

virtual unsigned OpenANN::Optimizable::examples ( )
inlinevirtual

Request number of training examples.

Returns
number of training examples

Reimplemented in OpenANN::Net, OpenANN::RBM, and OpenANN::IntrinsicPlasticity.

virtual void OpenANN::Optimizable::finishedIteration ( )
inlinevirtual

This callback is called after each optimization algorithm iteration.

Reimplemented in OpenANN::Net.

virtual Eigen::VectorXd OpenANN::Optimizable::gradient ( )
pure virtual

Compute gradient of the error function with respect to the parameters.

Returns
gradient

Implemented in OpenANN::Net, OpenANN::RBM, OpenANN::IntrinsicPlasticity, NeuroEvolutionAgent, and OpenANN::SparseAutoEncoder.

virtual Eigen::VectorXd OpenANN::Optimizable::gradient ( unsigned  n)
inlinevirtual

Compute gradient of a given training example.

Parameters
nindex of the training example in the dataset
Returns
gradient of the n-th training example
virtual Eigen::VectorXd OpenANN::Optimizable::gradient ( std::vector< int >::const_iterator  startN,
std::vector< int >::const_iterator  endN 
)
virtual

Calculates the accumulated gradient of given training examples.

Parameters
startNiterator over index vector
endNiterator over index vector
Returns
each row contains the gradient for one training example
virtual void OpenANN::Optimizable::initialize ( )
pure virtual

Initialize the optimizable parameters.

Implemented in OpenANN::Net, OpenANN::RBM, NeuroEvolutionAgent, OpenANN::IntrinsicPlasticity, and OpenANN::SparseAutoEncoder.

virtual bool OpenANN::Optimizable::providesGradient ( )
pure virtual

Check if the object provides a gradient of the error function with respect to its parameters.

Returns
does the optimizable provide a gradient?

Implemented in OpenANN::Net, OpenANN::RBM, NeuroEvolutionAgent, OpenANN::IntrinsicPlasticity, and OpenANN::SparseAutoEncoder.

virtual bool OpenANN::Optimizable::providesInitialization ( )
pure virtual

Check if the object knows how to initialize its parameters.

Returns
does the optimizable object provide a parameter initialization?

Implemented in OpenANN::Net, OpenANN::RBM, NeuroEvolutionAgent, OpenANN::IntrinsicPlasticity, and OpenANN::SparseAutoEncoder.

virtual void OpenANN::Optimizable::setParameters ( const Eigen::VectorXd &  parameters)
pure virtual

Set new parameters.

Parameters
parametersnew parameters

Implemented in OpenANN::Net, OpenANN::RBM, NeuroEvolutionAgent, OpenANN::IntrinsicPlasticity, and OpenANN::SparseAutoEncoder.


The documentation for this class was generated from the following file: