SPRAAK
|
Data Structures | |
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(* | SprMlpNorm )(SprNNFloatCalc dd, SprMLP *mlp) |
Enumerations | |
enum | { SPR_MLP_TM_ANY, SPR_MLP_TM_WGT, SPR_MLP_TM_WGTP, SPR_MLP_TM_CG } |
Functions | |
void | mlp_bwd_init (SprMLP *mlp) |
SprNNFloatData * | spr_mlp_eval (SprMLP *mlp, const float *x) |
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) |
int | spr_mlp_modif (SprMLP *mlp, int action,...) |
SprNNFloatData * | spr_mlp_norm_output (SprMLP *mlp) |
Normalize the output (sum equals to 1.0). More... | |
SprNNFloatData * | mlp_train_fwd (SprMLP *mlp, float *x) |
double | mlp_train_bwd (SprMLP *mlp) |
SprNNFloatCalc | mlp_train_err_ls (SprMLP *mlp, const float *t, const float *wgt, SprNNFloatCalc eps) |
SprNNFloatCalc | mlp_train_err_ml (SprMLP *mlp, int Ndx, SprNNFloatCalc eps) |
SprNNFloatCalc | mlp_train_err_ml1 (SprMLP *mlp, int Ndx, SprNNFloatCalc eps) |
int | mlp_update (SprMLP *mlp, int final) |
int | mlp_update_WGDI (SprMLP *mlp) |
void | spr_mlp_train_stats (SprStream *fd, SprMLP *mlp) |
int | spr_mlp_train_state_io (const char *fname, SprMLP *mlp, int save) |
#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 | |||
) |
Possible flags are: "MLP_TM_ANY" any traning method (not in eval/dummy train mode) "MLP_TM_WGT" W(GD/SCG/CG) training "MLP_TM_CG" (W)(S)CG training
typedef double SprNNFloatCalc |
typedef float SprNNFloatData |
typedef SprNNFloatCalc(* SprMlpNorm)(SprNNFloatCalc dd, SprMLP *mlp) |
void mlp_bwd_init | ( | SprMLP * | mlp | ) |
Reset all buffers (prepare for evaluation) and set the input buffer.
SprNNFloatData* spr_mlp_eval | ( | SprMLP * | mlp, |
const float * | x | ||
) |
Perform all routines to evaluate/train the MLP for the given input.
int spr_mlp_write | ( | const char * | fname, |
SprMLP * | mlp, | ||
int | write_dsc | ||
) |
Write a (trained) MLP to disk. See mlp_read() for the conventions on the location of the accompanying parameters files. If the write_dsc flag is set, a new description file is written.
SprMLP* spr_mlp_read | ( | const char * | fname | ) |
Read an MLP. The file fname contains the MLP network description. Parameter files are suposed to reside in the same subdirectory as the network description file.
int spr_mlp_modif | ( | SprMLP * | mlp, |
int | action, | ||
... | |||
) |
Modify some of the settings of the MLP. Return value: (-1) on error.
Possible actions: "MLP_MODIF_EVAL" Prepare the network for fast evaluation. "MLP_MODIF_TRAIN_X" Prepare the network for a dummy training session: evaluation + error measurement. "MLP_MODIF_TRAIN_GD" Prepare the network for training (gradient descent). "MLP_MODIF_TRAIN_WGD" Prepare the network for training with adaptive learning rates (each parameter has its own learning rate). Requires an extra float argument to specify the global learning rate. "MLP_MODIF_TRAIN_WGD2" Prepare the network for training with adaptive learning rates. Requires an extra float argument to specify the global learning rate. "MLP_MODIF_TRAIN_SCG" Prepare the network for training with the scaled conjugent gradient algorithm (Moller, M. Neural networks vol 6., pp 525-533, 1993). Requires one extra float arguments (sigma). "MLP_MODIF_TRAIN_WSCG" Prepare the network for training with the weighted scaled conjugent gradient algorithm. "MLP_MODIF_TRAIN_CG" Prepare the network for training with a conjugent gradient algorithm. Requires one extra float argument (sigma). "MLP_MODIF_TRAIN_WCG" Prepare the network for training with the weighted conjugent gradient algorithm. "MLP_MODIF_CLEAR" Clear training/fast-evaluation information. "MLP_MODIF_NORM" Define a new norm for the least-sqaures training. The arguments are a float representing the norm, and a pointer to a function that calculates that norm. If the function is NULL, a build in function is used.
SprNNFloatData* spr_mlp_norm_output | ( | SprMLP * | mlp | ) |
Normalize the output (sum equals to 1.0).
SprNNFloatData* mlp_train_fwd | ( | SprMLP * | mlp, |
float * | x | ||
) |
Forward evaluation of the MLP for training. Returns the output of the MLP.
double mlp_train_bwd | ( | SprMLP * | mlp | ) |
Do the backpropagation of the error, and return the regularisation error.
SprNNFloatCalc mlp_train_err_ls | ( | SprMLP * | mlp, |
const float * | t, | ||
const float * | wgt, | ||
SprNNFloatCalc | eps | ||
) |
Calculate the frame error (norm_e distance) and set the gradients for the output layer. The norm is set with the routine mlp_modif().
The weight vector wgt may be a NULL pointer.
Returns the frame error: sum(|t-o|^e).
SprNNFloatCalc mlp_train_err_ml | ( | SprMLP * | mlp, |
int | Ndx, | ||
SprNNFloatCalc | eps | ||
) |
Calculate the frame error (log likelihood) and set the gradients for the output layer. The gradient also incorporates a second order cost that forces the sum of the outputs to be close to 1.0.
SprNNFloatCalc mlp_train_err_ml1 | ( | SprMLP * | mlp, |
int | Ndx, | ||
SprNNFloatCalc | eps | ||
) |
Calculate the frame error (log error) and set the gradients for the output layer. Returns the log error of the frame: E = sum(o[i])-log(o[Ndx])-1
int mlp_update | ( | SprMLP * | mlp, |
int | final | ||
) |
Perform all routines to evaluate/train the MLP for the given input.
int mlp_update_WGDI | ( | SprMLP * | mlp | ) |
Update the adaptive learning rate (no update for the MLP-parameters). Returns 1 when enough data has been processed to estimate all parameters reliably.
Calculate and print statistics about the weights in the weighted training.
int spr_mlp_train_state_io | ( | const char * | fname, |
SprMLP * | mlp, | ||
int | save | ||
) |
Load/save the train status when using the weighted gradient learning scheme. Loading an empty file equals to resetting all information to their initial values.