Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

gnn_node Parameters API
[gnn_node : Basic Building Block for Gradient Machines.]


Detailed Description

The Parameter API (Applicaction Programming Interface) provides extended functionality to manipulate a gnn_node's parameters.

Every gnn_node contains a set of parameters (it can be empty of course). By changing them, the function's behaviour is changed. Formally, the parameters allow the model to be adapted to a particular case. It is, therefore, very important to provide extended functionality for manipulating them.

Every node contains two types of parameters:

Schematically, this can be depicted as (for an atomic node):

When two nodes A and B are composed using a third node C, then C will be at the root, and will provide direct access to all parameters (that is, the parameters of the whole tree):

This is absolutely transparent to the programmer. Note that each node knows exactly which ones are its local parameters, but to get direct access to them, use the extension API.

Note that in general, a node which is not a leaf rarely posseses its own parameters.

The good thing here is that you gain direct access to the new (concatenated) parameter as it were a single vector.

There are two more objects you should know of: the gradient with respect to the parameters, and the freeze flags, both vectors of the same size as the parameter vector. The first is a buffer, were the gradient should be computed. The second is a special flag vector: they specify if a given parameter is actually free to be changed (free parameter) of if it has been frozen (and can't be changed). These additional vectors can also be manipulated using this interface.

Some technical details:

So, the node accesses its local parameters (which are some kind of "global" and independent entities that can perfectly be shared with other nodes) through a parameter handle.

Simultaneously, the node also posseses a special parameter bundle, which gives him access to the whole tree's parameters.

Although it can be useful to know about the internal details of the parameter managing and its implementation, the gnn_node Parameters API provides a transparent set of functions to manipulate them. The important things to note are:


Functions

int gnn_node_param_get_size (gnn_node *node)
 Returns the size of the parameter vector.

int gnn_node_param_get (gnn_node *node, gsl_vector *w)
 Get the node's parameters.

int gnn_node_param_set (gnn_node *node, const gsl_vector *w)
 Sets new values for the parameter vector.

int gnn_node_param_freeze_flags_get (gnn_node *node, gsl_vector_int *f)
 Get the freeze flags.

int gnn_node_param_freeze_flags_set (gnn_node *node, const gsl_vector_int *f)
 Sets new freeze flags.

int gnn_node_param_freeze (gnn_node *node, int i)
 Freeze the i-th parameter.

int gnn_node_param_unfreeze (gnn_node *node, int i)
 Unfreeze the i-th parameter.

int gnn_node_param_is_frozen (gnn_node *node, int i)
 Check if the i-th parameter is frozen.

int gnn_node_param_are_frozen (gnn_node *node)
 Check if all the node's parameters are frozen.

int gnn_node_param_freeze_all (gnn_node *node)
 Freeze all parameters.

int gnn_node_param_unfreeze_all (gnn_node *node)
 Unfreeze all parameters.

int gnn_node_param_share (const gnn_node *node, gnn_node *client)
 Share the node's parameters.


Function Documentation

int gnn_node_param_are_frozen gnn_node   node
 

This function returns 1 if all parameters are frozen.

Parameters:
node  A pointer to an gnn_node.
Returns:
Returns 1 if frozen, 0 if not.

Definition at line 912 of file gnn_node.c.

int gnn_node_param_freeze gnn_node   node,
int    i
 

This function freezes the i-th parameter.

Parameters:
node  A pointer to an gnn_node.
i  The index of the parameter to be frozen.
Returns:
Returns 0 if suceeded.

Definition at line 862 of file gnn_node.c.

int gnn_node_param_freeze_all gnn_node   node
 

This function freezes all the node's parameters.

Parameters:
node  A pointer to an gnn_node.
Returns:
Returns 0 if suceeded.

Definition at line 931 of file gnn_node.c.

int gnn_node_param_freeze_flags_get gnn_node   node,
gsl_vector_int *    f
 

This function fills the given integer vector f with the node's freeze flags.

Implementation Note: The parameter vector is build with the node's parameter bundle.

Parameters:
node  A pointer to an gnn_node.
f  A gsl_vector_int sufficiently large to store the values.
Returns:
Returns 0 if suceeded.

Definition at line 826 of file gnn_node.c.

int gnn_node_param_freeze_flags_set gnn_node   node,
const gsl_vector_int *    f
 

This function sets new freeze flags for the node. They should be given as a gsl_vector_int, where 1=freeze and 0=free-parameter.

Parameters:
node  A pointer to an gnn_node.
f  A gsl_vector_int containing the new values for the parameter vector.
Returns:
Returns 0 if suceeded.

Definition at line 845 of file gnn_node.c.

int gnn_node_param_get gnn_node   node,
gsl_vector *    w
 

This function fills the input buffer w with the node's parameter values.

Implementation Note: The parameter vector is build with the node's parameter bundle.

Parameters:
node  A pointer to an gnn_node.
w  A gsl_vector sufficiently large to store the values.
Returns:
Returns 0 if suceeded.

Definition at line 786 of file gnn_node.c.

int gnn_node_param_get_size gnn_node   node
 

This function returns , the size of the parameter vector.

Parameters:
node  A pointer to an gnn_node.
Returns:
The size of the parameter vector .

Definition at line 766 of file gnn_node.c.

int gnn_node_param_is_frozen gnn_node   node,
int    i
 

This function returns 1 if the i-th parameter is frozen.

Parameters:
node  A pointer to an gnn_node.
i  The index of the parameter to be checked.
Returns:
Returns 1 if frozen, 0 if not.

Definition at line 896 of file gnn_node.c.

int gnn_node_param_set gnn_node   node,
const gsl_vector *    w
 

This function sets new values for the node's parameter vector. The new values are taken by the buffer w (of the correct size) given as input argument.

Parameters:
node  A pointer to an gnn_node.
w  A gsl_vector containing the new values for the parameter vector.
Returns:
Returns 0 if suceeded.

Definition at line 805 of file gnn_node.c.

int gnn_node_param_share const gnn_node   node,
gnn_node   client
 

This function share the node's parameters with the client node.

@warning: This function should be called on nodes that aren't connected only.

Parameters:
node  A pointer to an gnn_node.
client  A pointer to an gnn_node.
Returns:
Returns 0 if suceeded.

Definition at line 966 of file gnn_node.c.

int gnn_node_param_unfreeze gnn_node   node,
int    i
 

This function unfreezes the i-th parameter.

Parameters:
node  A pointer to an gnn_node.
i  The index of the parameter to be unfrozen.
Returns:
Returns 0 if suceeded.

Definition at line 879 of file gnn_node.c.

int gnn_node_param_unfreeze_all gnn_node   node
 

This function unfreezes all the node's parameters.

Parameters:
node  A pointer to an gnn_node.
Returns:
Returns 0 if suceeded.

Definition at line 947 of file gnn_node.c.


Generated on Sun Jun 13 20:51:43 2004 for libgnn Gradient Retropropagation Machine Library by doxygen1.2.18