SPRAAK
|
main routines and types for handling MLP's More...
Data Structures | |
struct | SprMlpLayer |
a (named) layer in the MLP More... | |
struct | SprMlpArg |
extra arguments for the (non-linear) functions More... | |
struct | SprMlpFun |
the (non-linear) function on an arc More... | |
struct | SprMlpParam |
pointers to all params for the current arc More... | |
union | _Union2_MLP_MAIN_ |
optional extra parameter(s) (constants) More... | |
union | _Union3_MLP_MAIN_ |
struct | SprMlpXFun |
struct | SprMlpProc |
union | _Union4_MLP_MAIN_ |
forward evaluation of all relevant arcs More... | |
union | _Union5_MLP_MAIN_ |
backward training of all relevant arcs More... | |
struct | SprMlpConnect |
a connection between two layers More... | |
struct | SprMlpNormList |
struct | SprWgdParam |
weights | partial_derivs | time_av_moment2 | time_av_moment1 More... | |
struct | SprCgParam |
struct | SprMLP |
the main MLP structure More... | |
Macros | |
#define | spr_dt_nn_float_data |
#define | SPR_MLP_MODIF_EVAL |
#define | SPR_MLP_MODIF_TRAIN_X |
#define | SPR_MLP_MODIF_TRAIN_GD |
#define | SPR_MLP_MODIF_TRAIN_WGD |
#define | SPR_MLP_MODIF_TRAIN_WGD2 |
#define | SPR_MLP_MODIF_TRAIN_SCG |
#define | SPR_MLP_MODIF_TRAIN_WSCG |
#define | SPR_MLP_MODIF_TRAIN_CG |
#define | SPR_MLP_MODIF_TRAIN_WCG |
#define | spr_mlp_check_training(mlp, flags) |
Typedefs | |
typedef double | SprNNFloatCalc |
typedef float | SprNNFloatData |
typedef SprNNFloatCalc(* | _FuncPtr1_MLP_MAIN_ )(SprNNFloatCalc x, SprMlpParam *p, const struct t_mlp_xfun *op) |
typedef SprNNFloatCalc(* | SprMlpNLF )(SprNNFloatCalc x, SprMlpParam *p, const SprMlpXFun *op) |
typedef SprNNFloatCalc(* | SprMlpNorm )(SprNNFloatCalc dd, SprMLP *mlp) |
Enumerations | |
enum | { SPR_MLP_OPT_TRAIN, SPR_MLP_OPT_PROP, SPR_MLP_TREE_TRAIN, SPR_MLP_LAYER_TREE, SPR_MLP_CONNECT_SUM, SPR_MLP_CONNECT_PROD, SPR_MLP_LAYER_INIT0, SPR_MLP_LAYER_INIT1, SPR_MLP_LAYER_VSET, SPR_MLP_LAYER_USED, SPR_MLP_LAYER_MUSED, SPR_MLP_LAYER_PROP, SPR_MLP_OPT_CONST, SPR_MLP_OPT_BLOCK, SPR_MLP_OPT_TC_SET, SPR_MLP_OPT_PB_SET, SPR_MLP_CONNECT_BIAS } |
enum | { SPR_MLP_LEFT_CHILD, SPR_MLP_RIGHT_CHILD, SPR_MLP_SHIFT_CHILD } |
tree-structured evaluation More... | |
enum | { SPR_MLP_TM_ANY, SPR_MLP_TM_WGT, SPR_MLP_TM_WGTP, SPR_MLP_TM_CG } |
Functions | |
SprMLP * | spr_mlp_free (SprMLP *mlp) |
int | spr_mlp_write (const char *fname, SprMLP *mlp, int write_dsc) |
SprMLP * | spr_mlp_read (const char *fname) |
void | spr_set_norm_const (SprNNFloatData *norm_const, SprMlpConnect *src) |
int | spr_mlp_modif (SprMLP *mlp, int action,...) |
SprNNFloatData * | spr_mlp_norm_output (SprMLP *mlp) |
Normalize the output (sum equals to 1.0). More... | |
main routines and types for handling MLP's
The main routines and types for handling MLP's.
An MLP consist of different layers with some interconnection between them. Every connection (arc) between a node in the source layer and a node in the destination layer consist of a sequence of linear and non-linear functions. These sequences of functions are common to all arcs between the nodes of the two layers involved. The free parameters of the functions are however specific for every connection (with the exception of the simple 1-to-1 connection scheme between input and output which may also use shared parameters). Functions may have extra arguments which are specified between braces '()', seperated by commas. The allowed number of arguments, their type (float, integer or string) and the effect they have, depend on the function. In some cases, some of the immediate function arguments replace one or more of the free (arc specific) parameters.
The available linear and non-linear functions are:
The available connection types are:
The MLP description file has the following structure:
[layers] Input <nr_input_nodes> <layer_name> <nr_nodes> Output <nr_output_nodes> [connections] <from>[+] <to> <sum/prod> <type> [ndx_file] <param_file> <functions> ... [options] <options>
A layer thus has a unique name and a size (number of nodes). A connection is described with a source and destination layer, the combination operator (sum or prod), a connection type and a sequence of functions.
The optional '+' that may follow the name of the input layer indicates that one extra bias node must be added. For the 'sum' combination, the bias is the first node and has a value of 1. For the 'prod' combination, the bias is the last node with a value of 2.
The connection type has the following format:
<type>(<alt_opt>)
The <alt_opt> is optional and modifies the default behaviour of the connection type. The following connection types are available:
The functions are described as follows:
<name>[<train_arg>](<extra_args>)
The train arguments <train_arg> are optional. They are specified between square brackets '[]' and consist of the letters:
The extra arguments are specified between braces '()', seperated by commas. For the list allowed arguments per function, their type (float, integer or string) and the effect they have depend on the function, see above.
The index file that specifies the reduced connectivity consists of the concattenation of (-1) terminated arrays (of the type I32) listing the set of outputs for each input. For example, the following indices
describe the connections of a layer that transforms 3 inputs into 4 outputs with the following connectivity:
The binary tree (tree connection type) has the following properties:
The tree structure is stored as a two valued (of the type I32) tuple per node. The first value contains the (right) child information:
with offset_to_right_child equal to 0 if the node does not have a right child. The second value contains the parent information:
with ndx_of_parent_node_base0, is_left_child and is_right_child equal to -1, 0 and 0 respectively for the root node.
TODO