Gradient machine: machine which can be trained with a gradient descent.
Inheritance:
Public Fields
-
bool is_free
- true if freeMemory() has been already called
-
List* params
- Contains all parameters which will be updated with the gradient descent.
-
List* der_params
- Contains the derivatives for all parameters.
-
int n_params
- Contains the number of parameters.
-
real* beta
- Contains the derivative with respect to the inputs
Public Methods
-
GradientMachine()
-
virtual void init()
- It only calls allocateMemory()
-
virtual int numberOfParams() = 0
- Return the size of params.
-
virtual void iterInitialize()
- This function is called before each training iteration.
-
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
-
virtual void allocateMemory()
- Allocate memory.
-
virtual void freeMemory()
- Free the memory allocated with allocateMemory() Do nothing if is_free is true.
-
virtual void loadFILE(FILE* file)
- By default, load the params
-
virtual void saveFILE(FILE* file)
- By default, save the params
Inherited from Machine:
Public Fields
-
int n_inputs
-
int n_outputs
-
List* outputs
Public Methods
-
virtual void forward(List* inputs)
-
virtual void reset()
Inherited from Object:
Public Methods
-
void addOption(const char* name, int size, void* ptr, const char* help="", bool is_allowed_after_init=false)
-
void addIOption(const char* name, int* ptr, int init_value, const char* help="", bool is_allowed_after_init=false)
-
void addROption(const char* name, real* ptr, real init_value, const char* help="", bool is_allowed_after_init=false)
-
void addBOption(const char* name, bool* ptr, bool init_value, const char* help="", bool is_allowed_after_init=false)
-
void setOption(const char* name, void* ptr)
-
void setIOption(const char* name, int option)
-
void setROption(const char* name, real option)
-
void setBOption(const char* name, bool option)
-
void load(const char* filename)
-
void save(const char* filename)
Documentation
Gradient machine: machine which can
be trained with a gradient descent.
bool is_free
- true if freeMemory() has been already called
List* 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.
List* der_params
- Contains the derivatives for all parameters.
Warning: params and der_params
must have the same structure.
(same number of nodes, same lenghts)
int n_params
- Contains the number of parameters.
It's in fact the sum of all node size
contained in params or der_params.
real* beta
- Contains the derivative with respect to the inputs
GradientMachine()
virtual void init()
- It only calls allocateMemory()
virtual int numberOfParams() = 0
- Return the size of params.
Note: it's the sum of the size in each node
of params.
virtual void iterInitialize()
- This function is called before each
training iteration.
By default, do nothing.
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
virtual void allocateMemory()
- Allocate memory.
By default, given n_inputs, n_outputs and n_params,
allocate beta, outputs, params and der_params.
virtual 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.
virtual void loadFILE(FILE* file)
- By default, load the params
virtual 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++.