#include <gsl/gsl_matrix.h>#include "gnn_node.h"#include "gnn_criterion.h"#include "gnn_dataset.h"#include "gnn_output.h"Include dependency graph for gnn_evaluation.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | _gnn_eval |
| struct | _gnn_grad |
| struct | _gnn_line |
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_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. | |
Enumerations | |
| enum | _gnn_grad_eval { gnnGradE, gnnGradDx, gnnGradDw } |
| enum | _gnn_line_eval { gnnLineE, gnnLineDE } |
Functions | |
| gnn_eval * | gnn_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_grad * | gnn_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_line * | gnn_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_grad * | gnn_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. | |
|
|
This macro returns the sum
of the last processed minibatch in the given Evaluations. buffer. Definition at line 176 of file gnn_evaluation.h. |
|
|
Definition at line 347 of file gnn_evaluation.h. |
|
|
Definition at line 390 of file gnn_evaluation.h. |
|
|
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
Definition at line 418 of file gnn_evaluation.c. |
|
|
Definition at line 355 of file gnn_evaluation.c. |
|
||||||||||||||||
|
This function builds a new Evaluations. buffer structure for computing outputs.
Definition at line 284 of file gnn_evaluation.c. |
|
||||||||||||||||
|
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
Definition at line 379 of file gnn_evaluation.c. |
|
||||||||||||
|
This function behaves like the gnn_grad_pats function, but it computes the gradients and the error over the whole dataset. That is, it computes:
and
where
Recall that The evaluation flag can be:
// 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
Definition at line 720 of file gnn_evaluation.c. |
|
|
Definition at line 527 of file gnn_evaluation.c. |
|
||||||||||||||||
|
This function builds a new Evaluations. buffer structure for computing gradients.
Definition at line 442 of file gnn_evaluation.c. |
|
||||||||||||||||||||
|
This function computes many things simultaneously in one pass. It builds estimations of the gradients
and
where 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:
// 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.
Definition at line 600 of file gnn_evaluation.c. |
|
||||||||||||||||
|
This function behaves like the gnn_grad_pats function, but it computes the error and its derivative along a given line. That is, it performs all evaluations at
where
The flag flag tells the function if it should compute only the error (
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);
Definition at line 1072 of file gnn_evaluation.c. |
|
|
This function frees the Evaluations.'s internal buffers and deallocates the structure. The installed Evaluations. error and gradient evaluation buffer won't be destroyed.
Definition at line 806 of file gnn_evaluation.c. |
|
|
This function returns a pointer to the currently used directional buffer
Definition at line 860 of file gnn_evaluation.c. |
|
|
This function returns a buffer for the installed Evaluations. error and gradients evaluation buffer used by the current Evaluations. structure for its line evaluation.
Definition at line 925 of file gnn_evaluation.c. |
|
|
This function returns a pointer to the currently used origin vector
Definition at line 907 of file gnn_evaluation.c. |
|
||||||||||||
|
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.
Definition at line 747 of file gnn_evaluation.c. |
|
||||||||||||||||||||||||
|
This function behaves like the gnn_grad_pats function, but it computes the error and its derivative along a given line. That is, it performs all evaluations at
where
The flag flag tells the function if it should compute only the error (
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);
Definition at line 984 of file gnn_evaluation.c. |
|
||||||||||||
|
This function sets a new directional vector
Definition at line 831 of file gnn_evaluation.c. |
|
||||||||||||
|
This function sets a new origin vector
Definition at line 878 of file gnn_evaluation.c. |
1.2.18