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

Evaluations.
[libgnn]


Detailed Description

The gnn_node structure, taken the way it is, provides a very low-level implementation of gradient models. Its programming interface it very versatile, but sometimes, for simpler problems, it can be hard to use.

The present module provides a high-level programming interface, where the 3 most frequent tasks have been packed into complex, but easy-to-use routines.

The API provides routines for the following tasks:

All the previous evaluation tasks need a special structure containing all the needed buffers in order to perform the required evaluations. There are three types of buffers: Before calling the functions, you should first create an appropiate buffer. This is done by calling gnn_eval_new for outputs, gnn_grad_new for gradients and gnn_line_new for line evaluations. These buffers are then given to the evaluation functions. After using them, you should free the buffers with gnn_eval_destroy, gnn_grad_destroy or gnn_line_destroy respectively.

Usually, you should call the evaluation functions giving them the needed buffers, and after then access the its fields in order to obtain the result using the provided macros and functions.

When an evaluation buffer is destroyed, its associated objects, like the gnn_node or gnn_crit used for its allocation, won't be destroyed. These should be deallocated separately. These three type of buffers do not own the associated gnn_node, gnn_dataset : Datasets for Training., and all required structures to build them. This means that these have to be destroyed separately.

Using gnn_eval.

The Evaluations. evaluation interface takes a given model, and a set of inputs, and computes the corresponding outputs.

Example use:

   gnn_node   *node;
   gnn_input  *input;
   gnn_output *output;
   gnn_eval   *eval;

   // Create the needed objects.
   node   = my_new_custom_node ();
   input  = my_new_custom_input ();
   output = my_new_custom_output ();

   // Allocate the evaluation buffer.
   eval = gnn_eval_new (node, input, output);

   // Compute all estimated outputs: the gnn_node evaluates each
   // input example and puts the results into the gnn_output.
   gnn_eval_all (eval);
   
   // Now, "output" contains the results. Do something with them.
   ...
   
   // Destroy buffer and objects.
   gnn_eval_destroy (eval);
   gnn_node_destroy (node);
   gnn_input_destroy (input);
   gnn_output_destroy (output);

Using gnn_grad.

The Evaluations. evaluation interface takes a given model, a criterion and a dataset, and computes the weighted sum of errors , the weighted sum of the gradient with respect to the inputs , or the weighted sum of the gradients with respect to the parameters .

When calling one of the evaluation routines (that is, either by calling gnn_grad_pats or gnn_grad_all), you have to specify how far the computation should be performed. That's the purpose of the last flag parameter:

The values that haven't been computed shouldn't be accessed, because their values are undefined.

Example use:

   double E;
   gsl_vector *Dx;
   
   gnn_node      *node;
   gnn_criterion *crit;
   gnn_dataset   *data;
   gnn_grad      *grad;

   // Create the needed objects.
   node = my_new_custom_node ();
   crit = my_new_custom_criterion ();
   data = my_new_custom_dataset ();

   // Allocate the gradient evaluation buffer.
   grad = gnn_grad_new (node, crit, data);

   // In this example, we need to compute the gradient with respect
   // to the inputs. So we will execute the evaluation routine with the
   // "gnnGradDx" flag.
   gnn_grad_all (grad, gnnGradDx);

   // We can retrieve the results now by using the macros.
   
   // First, get the weighted error which was also computed.
   E = GNN_GRAD_E (grad);
   
   // Now, get the gradient. First allocate a vector were to store the
   // result, and then use the macro to access the buffer's internal
   // Dx vector.
   Dx = gsl_vector_alloc (GNN_GRAD_INPUT_SIZE (grad));
   gsl_vector_memcpy (Dx, GNN_GRAD_DX (grad));
   
   // Do something else here...
   ...

   // Destroy buffer and objects.
   gnn_grad_destroy (grad);
   gnn_node_destroy (node);
   gnn_criterion_destroy (crit);
   gnn_dataset_destroy (data);

Using gnn_line.

The Evaluations. evaluation interface takes an already built Evaluations. buffer plus a direction, and computes the error or the error derivative along the given line.

When calling one of the evaluation routines (that is, either by calling gnn_line_pats or gnn_line_all), you have to specify how far the computation should be performed. That's the purpose of the last flag parameter:

The values that haven't been computed shouldn't be accessed, because their values are undefined.

Example use:

   double E;
   double DE;
   gsl_vector *d;

   gnn_grad *grad;
   gnn_line *line;

   // Create the needed objects.
   grad = my_new_custom_grad ();
   
   // In this example, we want to compute the error derivative along
   // the first parameter. So we have to prepare the corresponding
   // directional vector.
   d = gsl_vector_calloc (GNN_GRAD_PARAMETER_SIZE (grad));
   gsl_vector_set (d, 0, 1.0);
   
   // Allocate the line evaluation buffer.
   line = gnn_line_new (grad, d);

   // We have to execute the evaluation routine with the "gnnLineDE"
   // flag in order to get the derivative computed.
   gnn_line_all (line, 0.0, gnnLineDE);

   // Get the results by using the macros.
   E  = GNN_LINE_E (line);
   DE = GNN_LINE_DE (line);
   
   // Of course, the evaluation can be performed at another point which
   // can be more convenient for the application.
   gnn_line_all (line, 1.0, gnnLineDE);
   ...

   // Do something else here...
   ...

   // Destroy buffer and objects.
   gnn_line_destroy (line);
   gnn_node_destroy (GNN_GRAD_GET_NODE (grad));
   gnn_criterion_destroy (GNN_GRAD_GET_CRITERION (grad));
   gnn_dataset_destroy (GNN_GRAD_GET_DATASET (grad));
   gnn_grad_destroy (grad);

Defines

#define GNN_EVAL_GET_NODE(eval)   ((eval)->node)
 Returns a pointer to the associated gnn_node.

#define GNN_EVAL_GET_INPUT(eval)   ((eval)->in)
 Returns a pointer to the associated gnn_input : Reading and handling of sets of vectors..

#define GNN_EVAL_GET_OUTPUT(eval)   ((eval)->out)
 Returns a pointer to the associated gnn_output : Writing sets of vectors..

#define GNN_EVAL_INPUT_SIZE(eval)   ((eval)->n)
 Returns the size of the input.

#define GNN_EVAL_OUTPUT_SIZE(eval)   ((eval)->m)
 Returns the size of the output.

#define GNN_EVAL_PARAMETER_SIZE(eval)   ((eval)->l)
 Returns the size of the parameter vector.

#define GNN_EVAL_AMOUNT(eval)   ((eval)->P)
 Returns the amount of examples to be evaluated by the Evaluations..

#define GNN_GRAD_GET_NODE(grad)   ((grad)->node)
 Returns a pointer to the associated gnn_node.

#define GNN_GRAD_GET_INPUT(grad)   ((grad)->in)
 Returns a pointer to the associated gnn_input : Reading and handling of sets of vectors..

#define GNN_GRAD_GET_OUTPUT(grad)   ((grad)->out)
 Returns a pointer to the associated gnn_output : Writing sets of vectors..

#define GNN_GRAD_INPUT_SIZE(grad)   ((grad)->n)
 Returns the size of the input.

#define GNN_GRAD_OUTPUT_SIZE(grad)   ((grad)->m)
 Returns the size of the output.

#define GNN_GRAD_PARAMETER_SIZE(grad)   ((grad)->l)
 Returns the size of the parameter vector.

#define GNN_GRAD_AMOUNT(grad)   ((grad)->P)
 Returns the amount of examples considered by the Evaluations..

#define GNN_GRAD_SUMP(grad)   ((grad)->mp)
 Returns the last pattern weight sum.

#define GNN_GRAD_SUME(grad)   ((grad)->mp * (grad)->me)
 Returns the sum of the last batch's error.

#define GNN_GRAD_E(grad)   ((grad)->me)
 Returns the last batch's mean error sum.

#define GNN_GRAD_DX(grad)   ((grad)->mdx)
 Returns the last batch's mean error sum.

#define GNN_GRAD_DW(grad)   ((grad)->mdw)
 Returns the last batch's mean error sum.

#define GNN_LINE_W(line)   ((line)->w)
 Returns the origin of the line evaluations.

#define GNN_LINE_DIR(line)   ((line)->d)
 Returns the direction of the line evaluations.

#define GNN_LINE_E(line)   ((line)->error)
 Returns the last computed error along the line evaluation.

#define GNN_LINE_DE(line)   ((line)->derivative)
 Returns the last computed derivative along the line evaluation.


Typedefs

typedef _gnn_eval gnn_eval
 Evaluation buffer structure.

typedef _gnn_grad gnn_grad
 Error and Gradients Evaluation buffer structure.

typedef enum _gnn_grad_eval gnn_grad_eval
 Gradient evaluation flags.

typedef _gnn_line gnn_line
 Directional Error and Gradients Evaluation buffer structure.

typedef enum _gnn_line_eval gnn_line_eval
 Line evaluation flags.


Functions

gnn_evalgnn_eval_new (gnn_node *node, gnn_input *in, gnn_output *out)
 Builds a new buffer for output evaluation.

void gnn_eval_destroy (gnn_eval *eval)
 Destroys an evaluation buffer.

int gnn_eval_pats (gnn_eval *eval, size_t s, size_t n)
 Computes the outputs for a given input set.

int gnn_eval_all (gnn_eval *eval)
 Computes the outputs for a given input set.

gnn_gradgnn_grad_new (gnn_node *node, gnn_criterion *crit, gnn_dataset *data)
 Builds a new buffer for gradient evaluation.

void gnn_grad_destroy (gnn_grad *grad)
 Destroys a gradient buffer.

int gnn_grad_pats (gnn_grad *grad, gnn_grad_eval flag, size_t s, size_t n)
 Compute the mean cost and gradients.

int gnn_grad_all (gnn_grad *grad, gnn_grad_eval flag)
 Compute the mean cost and gradients.

gnn_linegnn_line_new (gnn_grad *grad, gsl_vector *direction)
 Returns a new buffer structure for line evaluations.

void gnn_line_destroy (gnn_line *line)
 Destroys a given line evaluation buffer.

int gnn_line_set_direction (gnn_line *line, const gsl_vector *dir)
 Sets a new direction for the Evaluations. structure.

const gsl_vector * gnn_line_get_direction (gnn_line *line)
 Gets the installed directional vector .

int gnn_line_set_origin (gnn_line *line, const gsl_vector *origin)
 Sets a new origin for the Evaluations. structure.

const gsl_vector * gnn_line_get_origin (gnn_line *line)
 Gets the installed origin vector .

gnn_gradgnn_line_get_grad (gnn_line *line)
 Gets the installed Evaluations. evaluation buffer.

int gnn_line_pats (gnn_line *line, double alpha, gnn_line_eval flag, size_t s, size_t n)
 Compute mean cost and gradients along a direction for a minibatch.

int gnn_line_all (gnn_line *line, double alpha, gnn_line_eval flag)
 Compute mean cost and gradients along a direction for a minibatch.


Define Documentation

#define GNN_EVAL_AMOUNT eval       ((eval)->P)
 

This macro returns the number of examples to be evaluated by the Evaluations. evaluation buffer. Basically, it is the number of examples contained in the associated gnn_input : Reading and handling of sets of vectors. object.

Definition at line 98 of file gnn_evaluation.h.

#define GNN_EVAL_GET_INPUT eval       ((eval)->in)
 

Definition at line 60 of file gnn_evaluation.h.

#define GNN_EVAL_GET_NODE eval       ((eval)->node)
 

Definition at line 53 of file gnn_evaluation.h.

#define GNN_EVAL_GET_OUTPUT eval       ((eval)->out)
 

Definition at line 67 of file gnn_evaluation.h.

#define GNN_EVAL_INPUT_SIZE eval       ((eval)->n)
 

Definition at line 74 of file gnn_evaluation.h.

#define GNN_EVAL_OUTPUT_SIZE eval       ((eval)->m)
 

Definition at line 81 of file gnn_evaluation.h.

#define GNN_EVAL_PARAMETER_SIZE eval       ((eval)->l)
 

Definition at line 88 of file gnn_evaluation.h.

#define GNN_GRAD_AMOUNT grad       ((grad)->P)
 

This macro returns the number of examples considered in the computation of the weighted values. Basically, it is the number of examples contained in the associated gnn_dataset : Datasets for Training. object.

Definition at line 156 of file gnn_evaluation.h.

#define GNN_GRAD_DW grad       ((grad)->mdw)
 

This macro returns the last gradient with respect its parameters, given by

for the last processed minibatch in the given Evaluations. buffer.

Definition at line 216 of file gnn_evaluation.h.

#define GNN_GRAD_DX grad       ((grad)->mdx)
 

This macro returns the last gradient with respect its inputs, given by

for the last processed minibatch in the given Evaluations. buffer.

Definition at line 206 of file gnn_evaluation.h.

#define GNN_GRAD_E grad       ((grad)->me)
 

This macro returns the last mean error, given by

for the last processed minibatch in the given Evaluations. buffer.

Definition at line 196 of file gnn_evaluation.h.

#define GNN_GRAD_GET_INPUT grad       ((grad)->in)
 

Definition at line 118 of file gnn_evaluation.h.

#define GNN_GRAD_GET_NODE grad       ((grad)->node)
 

Definition at line 111 of file gnn_evaluation.h.

#define GNN_GRAD_GET_OUTPUT grad       ((grad)->out)
 

Definition at line 125 of file gnn_evaluation.h.

#define GNN_GRAD_INPUT_SIZE grad       ((grad)->n)
 

Definition at line 132 of file gnn_evaluation.h.

#define GNN_GRAD_OUTPUT_SIZE grad       ((grad)->m)
 

Definition at line 139 of file gnn_evaluation.h.

#define GNN_GRAD_PARAMETER_SIZE grad       ((grad)->l)
 

Definition at line 146 of file gnn_evaluation.h.

#define GNN_GRAD_SUME grad       ((grad)->mp * (grad)->me)
 

This macro returns the last sum of errors, given by

for the last processed minibatch in the given Evaluations. buffer.

Definition at line 186 of file gnn_evaluation.h.

#define GNN_GRAD_SUMP grad       ((grad)->mp)
 

This macro returns the sum

of the last processed minibatch in the given Evaluations. buffer.

Definition at line 176 of file gnn_evaluation.h.

#define GNN_LINE_DE line       ((line)->derivative)
 

This macro returns the value of the computed derivate along the last line evaluation.

Definition at line 258 of file gnn_evaluation.h.

#define GNN_LINE_DIR line       ((line)->d)
 

This macro returns a pointer to the directional vector where all directional evaluations are evaluated at.

Definition at line 240 of file gnn_evaluation.h.

#define GNN_LINE_E line       ((line)->error)
 

This macro returns the value of the last computed average error along the last line evaluation.

Definition at line 249 of file gnn_evaluation.h.

#define GNN_LINE_W line       ((line)->w)
 

This macro returns a pointer to the origin where all directional evaluations are evaluated at.

Definition at line 231 of file gnn_evaluation.h.


Typedef Documentation

typedef struct _gnn_eval gnn_eval
 

This structure contains the necessary elements for performing a full dataset evaluation.

Definition at line 277 of file gnn_evaluation.h.

typedef struct _gnn_grad gnn_grad
 

This structure contains the necessary values and buffers for performing the computation of averaged gradients and errors over datasets.

Definition at line 306 of file gnn_evaluation.h.

typedef enum _gnn_grad_eval gnn_grad_eval
 

This special datatype is used by the gradient evaluation functions. It tells them how far the batch should be processed, i.e. if it should compute , and , in this order of dependence.

Definition at line 345 of file gnn_evaluation.h.

typedef struct _gnn_line gnn_line
 

This structure contains the necessary values and buffers for performing the computation of averaged gradients and errors over datasets, evaluated along a given direction, treating the node's function as a one-dimensional function.

The structure contains the direction and a error and gradient evaluation buffer (Evaluations.).

Definition at line 367 of file gnn_evaluation.h.

typedef enum _gnn_line_eval gnn_line_eval
 

This special datatype is used by the line evaluation functions. It tells them if they should computed only the error along the given line or if they also should compute the error derivative.

Definition at line 388 of file gnn_evaluation.h.


Function Documentation

int gnn_eval_all gnn_eval   eval
 

This function computes, given a set of input samples, all associated outputs, storing them into the output device provided by the Evaluations. structure. The patterns that are evaluated are those between and .

Parameters:
eval  A pointer to a Evaluations..
s  The index of the first input sample to be evaluated.
n  The amount of samples to be evaluated.
Returns:
Returns 0 if suceeded.

Definition at line 418 of file gnn_evaluation.c.

void gnn_eval_destroy gnn_eval   eval
 

Parameters:
eval  A pointer a Evaluations. buffer.

Definition at line 355 of file gnn_evaluation.c.

gnn_eval* gnn_eval_new gnn_node   node,
gnn_input   in,
gnn_output   out
 

This function builds a new Evaluations. buffer structure for computing outputs.

Parameters:
node  A pointer to a gnn_node.
in  A pointer to a gnn_input : Reading and handling of sets of vectors. input sampler.
out  A pointer to a gnn_output : Writing sets of vectors. output device.
Returns:
Returns a pointer to a new buffer structure of NULL if failed.

Definition at line 284 of file gnn_evaluation.c.

int gnn_eval_pats gnn_eval   eval,
size_t    s,
size_t    n
 

This function computes, given a set of input samples, all associated outputs, storing them into the output device provided by the Evaluations. structure. The patterns that are evaluated are those between and .

Parameters:
eval  A pointer to a Evaluations..
s  The index of the first input sample to be evaluated.
n  The amount of samples to be evaluated.
Returns:
Returns 0 if suceeded.

Definition at line 379 of file gnn_evaluation.c.

int gnn_grad_all gnn_grad   grad,
gnn_grad_eval    flag
 

This function behaves like the Evaluations. function, but it computes the gradients and the error over the whole dataset. That is, it computes:

and

where is the -th pattern's weight, is the gradient with respect to the inputs evaluated at the -th pattern, is the gradient with respect to the parameters evaluated at the -th pattern, and is the cost/error for the -th output.

Recall that is the number of patterns contained in the dataset.

The evaluation flag can be:

  • gnnGradE : only compute mean error .
  • gnnGradDx : compute and .
  • gnnGradDw : compute and and
The computed values can be retrieved directly from the Evaluations. buffer:
 // compute all
 gnn_grad_all (g, gnnGradDw);

 // now, get them
 e  = GNN_GRAD_E (g);       // e is a double
 dx = GNN_GRAD_DX (g);      // dx is a gsl_vector *
 dw = GNN_GRAD_DW (g);      // dw is a gsl_vector *

 sp = GNN_GRAD_SUMP (g);    // sp is a double
 se = GNN_GRAD_SUME (g);    // se is a double
Parameters:
grad  A pointer to a Evaluations..
flag  The evaluation flag.
Returns:
Returns 0 if suceeded.

Definition at line 720 of file gnn_evaluation.c.

void gnn_grad_destroy gnn_grad   grad
 

Parameters:
grad  A pointer a Evaluations. buffer.

Definition at line 527 of file gnn_evaluation.c.

gnn_grad* gnn_grad_new gnn_node   node,
gnn_criterion   crit,
gnn_dataset   data
 

This function builds a new Evaluations. buffer structure for computing gradients.

Parameters:
node  A pointer to a gnn_node.
crit  A pointer to a gnn_criterion : Basic Criterion Function..
data  A pointer to a gnn_dataset : Datasets for Training..
Returns:
Returns a pointer to a new buffer structure of NULL if failed.

Definition at line 442 of file gnn_evaluation.c.

int gnn_grad_pats gnn_grad   grad,
gnn_grad_eval    flag,
size_t    s,
size_t    n
 

This function computes many things simultaneously in one pass. It builds estimations of the gradients and and the cost by averaging over the n patterns starting at s. That is, this function computes:

and

where is the -th pattern's weight, is the gradient with respect to the inputs evaluated at the -th pattern, is the gradient with respect to the parameters evaluated at the -th pattern, and is the cost/error for the -th output.

In order to obtain the results, you should tell the function how far it should process the patterns, using a special flag. The evaluation flag can be:

  • gnnGradE : only compute mean error .
  • gnnGradDx : compute and .
  • gnnGradDw : compute and and
The computed values can be retrieved directly from the Evaluations. buffer:
 // compute all
 gnn_grad_pats (g, gnnGradDw, 10, 20);

 // now, get them
 e  = GNN_GRAD_E (g);       // e is a double
 dx = GNN_GRAD_DX (g);      // dx is a gsl_vector *
 dw = GNN_GRAD_DW (g);      // dw is a gsl_vector *

 sp = GNN_GRAD_SUMP (g);    // sp is a double
 se = GNN_GRAD_SUME (g);    // se is a double

The starting index s should be within the valid bounds. The size n of the batch will be adapted if s + n exceeds the valid bounds. That is, e.g. if there are 10 patterns (and so the index of the last pattern to be considered is 9), and s=8 and n=4, then the last pattern in the averaging will be 9, although 8+4=12.

Parameters:
grad  A pointer to a Evaluations..
flag  The evaluation flag.
s  The index of the first pattern in the dataset to be considered in the averaging.
n  The amount of patterns to be considered.
Returns:
Returns 0 if suceeded.

Definition at line 600 of file gnn_evaluation.c.

int gnn_line_all gnn_line   line,
double    alpha,
gnn_line_eval    flag
 

This function behaves like the Evaluations. function, but it computes the error and its derivative along a given line. That is, it performs all evaluations at

where are the node's current parameters, is a scalar and is a given direction, treating the function as it where just a one-dimensional function. All patterns are used for this evaluation.

The flag flag tells the function if it should compute only the error (gnnLineE) or the error with its derivative along the line (gnnLineDE). The approximated derivative is apropiately scaled in order to match the real derivative:

The results can be recovered by the macros Evaluations. and Evaluations.:

 gnn_grad *grad;
 gnn_line *line;
 double    error;

 // build grad and line buffers
 ...

 // evaluate all patterns at 1.2
 gnn_line_all (line, 1.2, gnnLineE);

 // get results
 error      = GNN_LINE_E (line);

Warning:
A line evaluation modifies the gnn_node's internal parameters. In order to recover the original vector, call this function with .
Parameters:
line  A pointer to a Evaluations..
alpha  The scalar .
flag  The evaluation flag.
Returns:
Returns 0 if suceeded.

Definition at line 1072 of file gnn_evaluation.c.

void gnn_line_destroy gnn_line   line
 

This function frees the Evaluations.'s internal buffers and deallocates the structure. The installed Evaluations. error and gradient evaluation buffer won't be destroyed.

Parameters:
line  A pointer to a Evaluations..

Definition at line 806 of file gnn_evaluation.c.

const gsl_vector* gnn_line_get_direction gnn_line   line
 

This function returns a pointer to the currently used directional buffer used by the Evaluations. buffer for its line evaluations.

Parameters:
line  A pointer to a Evaluations..
Returns:
Returns a pointer to the directional vector.

Definition at line 860 of file gnn_evaluation.c.

gnn_grad* gnn_line_get_grad gnn_line   line
 

This function returns a buffer for the installed Evaluations. error and gradients evaluation buffer used by the current Evaluations. structure for its line evaluation.

Parameters:
line  A pointer to a Evaluations..
Returns:
Returns a pointer to the internal Evaluations. structure.

Definition at line 925 of file gnn_evaluation.c.

const gsl_vector* gnn_line_get_origin gnn_line   line
 

This function returns a pointer to the currently used origin vector by the Evaluations. for its line evaluations.

Parameters:
line  A pointer to a Evaluations..
Returns:
Returns a pointer to the origin vector.

Definition at line 907 of file gnn_evaluation.c.

gnn_line* gnn_line_new gnn_grad   grad,
gsl_vector *    direction
 

This function builds a new buffer structure for line evaluations. The direction is given by the direction vector, and the origin is set at the gnn_node's current parameter vector. If the direction is omitted (NULL is given), then it will be a null vector.

Parameters:
grad  A pointer to a Evaluations..
direction  A pointer to a gsl_vector.
Returns:
Returns a pointer to the new Evaluations. buffer or NULL if failed.

Definition at line 747 of file gnn_evaluation.c.

int gnn_line_pats gnn_line   line,
double    alpha,
gnn_line_eval    flag,
size_t    s,
size_t    n
 

This function behaves like the Evaluations. function, but it computes the error and its derivative along a given line. That is, it performs all evaluations at

where are the node's current parameters, is a scalar and is a given direction, treating the function as it where just a one-dimensional function. The patterns starting at s and ending at s+n are used for the averaging.

The flag flag tells the function if it should compute only the error (gnnLineE) or the error with its derivative along the line (gnnLineDE). The approximated derivative is apropiately scaled in order to match the real derivative:

The results can be recovered by the macros Evaluations. and Evaluations.:

 gnn_grad *grad;
 gnn_line *line;
 double    error;
 double    derivative;

 // build grad and line buffers
 ...

 // evaluate the patterns 11-30 at 0.5
 gnn_line_pats (line, 0.5, gnnLineDE, 11, 30);

 // get results
 error      = GNN_LINE_E (line);
 derivative = GNN_LINE_DE (line);

Warning:
A line evaluation modifies the gnn_node's internal parameters. In order to recover the original vector, call this function with .
Parameters:
line  A pointer to a Evaluations..
alpha  The scalar .
flag  The evaluation flag.
s  The first pattern index .
n  The size of the minibatch .
Returns:
Returns 0 if suceeded.

Definition at line 984 of file gnn_evaluation.c.

int gnn_line_set_direction gnn_line   line,
const gsl_vector *    dir
 

This function sets a new directional vector for the line evaluation buffer. The vector should be of the correct size.

Parameters:
line  A pointer to a Evaluations..
dir  A pointer to a gsl_vector.
Returns:
Returns 0 if succeeded.

Definition at line 831 of file gnn_evaluation.c.

int gnn_line_set_origin gnn_line   line,
const gsl_vector *    origin
 

This function sets a new origin vector for the line evaluation buffer. The vector should be of the correct size.

Parameters:
line  A pointer to a Evaluations..
origin  A pointer to a gsl_vector.
Returns:
Returns 0 if succeeded.

Definition at line 878 of file gnn_evaluation.c.


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