class GradientMachine

Gradient machine: machine which can be trained with a gradient descent.

Inheritance:


Public Fields

[more]int n_inputs
Frame size of inputs sequences
[more]int n_outputs
Frame size of outputs sequences
[more]Parameters* params
Contains all parameters which will be updated with the gradient descent.
[more]Parameters* der_params
Contains the derivatives for all parameters.
[more]Sequence* beta
Contains the derivative with respect to the inputs

Public Methods

[more] GradientMachine(int n_inputs_, int n_outputs_, int n_params_=0)
Initialize a gradient machine with n_inputs_ for the input frame size, n_outputs_ for the output frame size and n_params_ parameters.
[more]virtual void iterInitialize()
This function is called before each training iteration.
[more]virtual void forward(Sequence* inputs)
Given a sequence, update outputs.
[more]virtual void backward(Sequence* inputs, Sequence* alpha)
Given a sequence, update the derivative with respect to the input (beta) and der_params.
[more]virtual void setPartialBackprop(bool flag=true)
Set the partial backprop flag
[more]virtual void frameForward(int t, real* f_inputs, real* f_outputs)
Given a frame f_inputs, updates f_outputs.
[more]virtual void frameBackward(int t, real* f_inputs, real* beta_, real* f_outputs, real* alpha_)
Given the f_inputs and the derivatives alpha_ with respect to the outputs, updates the derivative with respect to the inputs (beta_) and der_params.
[more]virtual void loadXFile(XFile* file)
By default, load the params field
[more]virtual void saveXFile(XFile* file)
By default, save the params field


Inherited from Machine:

Public Fields

oSequence* outputs

Public Methods

ovirtual void reset()
ovirtual void setDataSet(DataSet* dataset_)


Inherited from Object:

Public Fields

oAllocator* allocator

Public Methods

ovoid addOption(const char* name, int size, void* ptr, const char* help="")
ovoid addIOption(const char* name, int* ptr, int init_value, const char* help="")
ovoid addROption(const char* name, real* ptr, real init_value, const char* help="")
ovoid addBOption(const char* name, bool* ptr, bool init_value, const char* help="")
ovoid addOOption(const char* name, Object** ptr, Object* init_value, const char* help="")
ovoid setOption(const char* name, void* ptr)
ovoid setIOption(const char* name, int option)
ovoid setROption(const char* name, real option)
ovoid setBOption(const char* name, bool option)
ovoid setOOption(const char* name, Object* option)
ovoid load(const char* filename)
ovoid save(const char* filename)
ovoid* operator new(size_t size, Allocator* allocator_=NULL)
ovoid* operator new(size_t size, Allocator* allocator_, void* ptr_)
ovoid operator delete(void* ptr)


Documentation

Gradient machine: machine which can be trained with a gradient descent.

Gradient machines take in inputs sequences which have always the same frame size, given by n_inputs, and outputs sequences which have always the same frame size too, given by n_outputs.

oint n_inputs
Frame size of inputs sequences

oint n_outputs
Frame size of outputs sequences

oParameters* params
Contains all parameters which will be updated with the gradient descent. Almost all machines will have only one node in params.

oParameters* der_params
Contains the derivatives for all parameters. Warning: params and der_params must have the same structure.

oSequence* beta
Contains the derivative with respect to the inputs

o GradientMachine(int n_inputs_, int n_outputs_, int n_params_=0)
Initialize a gradient machine with n_inputs_ for the input frame size, n_outputs_ for the output frame size and n_params_ parameters. If n_inputs_ is 0, no beta sequence will be allocated. If n_outputs_ is 0, no outputs sequence will be allocated.

ovirtual void iterInitialize()
This function is called before each training iteration. By default, do nothing.

ovirtual void forward(Sequence* inputs)
Given a sequence, update outputs. By default, it uses frameForward(), to update each output frame given each input frame. It supposes by default the number of input and output frames is the same.

ovirtual void backward(Sequence* inputs, Sequence* alpha)
Given a sequence, update the derivative with respect to the input (beta) and der_params. If partial_backprop is false, don't update beta. By default, it uses frameBackward(), to update each beta frame given each input and alpha frame. It supposes by default the number of input and output frames is the same.

ovirtual void setPartialBackprop(bool flag=true)
Set the partial backprop flag

ovirtual void frameForward(int t, real* f_inputs, real* f_outputs)
Given a frame f_inputs, updates f_outputs. Used to easily create new classes. It is called by the default forward(), and it does nothing by default. If your machine needs to do special things on sequence (if input sequence do not have the same size as the output sequence), don't overload this function, but overload forward(). t is the current frame to be forwarded.

ovirtual void frameBackward(int t, real* f_inputs, real* beta_, real* f_outputs, real* alpha_)
Given the f_inputs and the derivatives alpha_ with respect to the outputs, updates the derivative with respect to the inputs (beta_) and der_params. It is called by the default backward(), and it does nothing by default. If your machine needs to do special things on sequence (if input sequence do not have the same size as the output sequence), don't overload this function, but overload backward(). t is the current frame to be back-propagated.

ovirtual void loadXFile(XFile* file)
By default, load the params field

ovirtual void saveXFile(XFile* file)
By default, save the params field


Direct child classes:
TemporalSubSampling
TemporalMean
TemporalConvolution
Tanh
SumMachine
SpatialSubSampling
SpatialConvolution
SoftPlus
SoftMax
Sigmoid
Mixer
LogSoftMax
LogSigmoid
LogRBF
LogMixer
Linear
InputsSelect
Exp
Distribution
Criterion
ConnectedMachine
Author:
Ronan Collobert (collober@idiap.ch)
See Also:
StochasticGradient

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.