class GradientMachine

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

Inheritance:


Public Fields

[more]bool is_free
true if freeMemory() has been already called
[more]List* params
Contains all parameters which will be updated with the gradient descent.
[more]List* der_params
Contains the derivatives for all parameters.
[more]int n_params
Contains the number of parameters.
[more]real* beta
Contains the derivative with respect to the inputs

Public Methods

[more] GradientMachine()
[more]virtual void init()
It only calls allocateMemory()
[more]virtual int numberOfParams() = 0
Return the size of params.
[more]virtual void iterInitialize()
This function is called before each training iteration.
[more]virtual void backward(List* inputs, real* alpha) = 0
Given the inputs and the derivatives alpha with respect to the outputs, update beta and der_params
[more]virtual void allocateMemory()
Allocate memory.
[more]virtual void freeMemory()
Free the memory allocated with allocateMemory() Do nothing if is_free is true.
[more]virtual void loadFILE(FILE* file)
By default, load the params
[more]virtual void saveFILE(FILE* file)
By default, save the params


Inherited from Machine:

Public Fields

oint n_inputs
oint n_outputs
oList* outputs

Public Methods

ovirtual void forward(List* inputs)
ovirtual void reset()


Inherited from Object:

Public Methods

ovoid addOption(const char* name, int size, void* ptr, const char* help="", bool is_allowed_after_init=false)
ovoid addIOption(const char* name, int* ptr, int init_value, const char* help="", bool is_allowed_after_init=false)
ovoid addROption(const char* name, real* ptr, real init_value, const char* help="", bool is_allowed_after_init=false)
ovoid addBOption(const char* name, bool* ptr, bool init_value, const char* help="", bool is_allowed_after_init=false)
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 load(const char* filename)
ovoid save(const char* filename)


Documentation

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

obool is_free
true if freeMemory() has been already called

oList* params
Contains all parameters which will be updated with the gradient descent. Almost all machines will have only one node for this list. Note that the integer for each node is the number of parameters contained in the pointer of this node.

oList* der_params
Contains the derivatives for all parameters. Warning: params and der_params must have the same structure. (same number of nodes, same lenghts)

oint n_params
Contains the number of parameters. It's in fact the sum of all node size contained in params or der_params.

oreal* beta
Contains the derivative with respect to the inputs

o GradientMachine()

ovirtual void init()
It only calls allocateMemory()

ovirtual int numberOfParams() = 0
Return the size of params. Note: it's the sum of the size in each node of params.

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

ovirtual void backward(List* inputs, real* alpha) = 0
Given the inputs and the derivatives alpha with respect to the outputs, update beta and der_params

ovirtual void allocateMemory()
Allocate memory. By default, given n_inputs, n_outputs and n_params, allocate beta, outputs, params and der_params.

ovirtual void freeMemory()
Free the memory allocated with allocateMemory() Do nothing if is_free is true. Set is_free to true. This function have to set n_params. All classes which redefine this function should call it in the destructor.

ovirtual void loadFILE(FILE* file)
By default, load the params

ovirtual void saveFILE(FILE* file)
By default, save the params


Direct child classes:
Tanh
SumMachine
SparseLinear
Softmax
Sigmoid
Mixer
LogSoftmax
LogSigmoid
LogRBF
Linear
InputsSelect
Exp
Distribution
Criterion
ConnectedMachine
Author:
Ronan Collobert (collober@iro.umontreal.ca)

Alphabetic index HTML hierarchy of classes or Java



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