1/*****************************************************************************
2  FILE           : $Source: /projects/higgs1/SNNS/CVS/SNNS/tools/sources/ic_snns.ph,v $
3  SHORTNAME      : ic_snns
4  SNNS VERSION   : 4.2
5
6  PURPOSE        : Intermediate Code (IC) functions for the SNNS batch
7                   interpreter:
8                   function calls to the SNNS-Kernel function interface
9
10  NOTES          : Abbreviations: ST: symbol table
11                                  IC: intermediate code
12
13  AUTHOR         : Jens Wieland
14  DATE           :
15
16  CHANGED BY     :
17  RCS VERSION    : $Revision: 1.13 $
18  LAST CHANGE    : $Date: 1998/04/22 16:48:08 $
19
20    Copyright (c) 1990-1995  SNNS Group, IPVR, Univ. Stuttgart, FRG
21    Copyright (c) 1996-1998  SNNS Group, WSI, Univ. Tuebingen, FRG
22
23******************************************************************************/
24
25#ifndef _IC_SNNS_DEFINED_
26#define _IC_SNNS_DEFINED_
27
28
29/* begin global definition section */
30
31void setInitFunc(arglist_type *arglist);
32void setLearnFunc(arglist_type *arglist);
33void setUpdateFunc(arglist_type *arglist);
34void setPruningFunc(arglist_type *arglist);
35void setRemapFunc(arglist_type *arglist);
36void setSubPattern(arglist_type *arglist);
37void setShuffle(arglist_type *arglist);
38void setSubShuffle(arglist_type *arglist);
39void setClassDistrib(arglist_type *arglist);
40void setParallelMode(arglist_type *arglist);
41void setCascadeParams(arglist_type *arglist);
42
43void initNet(arglist_type *arglist);
44void resetNet(arglist_type *arglist);
45void loadNet(arglist_type *arglist);
46void saveNet(arglist_type *arglist);
47void saveResult(arglist_type *arglist);
48void trainNet(arglist_type *arglist);
49void testNet(arglist_type *arglist);
50void pruneNet(arglist_type *arglist);
51void pruneTrainNet(arglist_type *arglist);
52void pruneNetNow(arglist_type *arglist);
53void delCandUnits(arglist_type *arglist);
54void setActFunc(arglist_type *arglist);
55
56void loadPattern(arglist_type *arglist);
57void setPattern(arglist_type *arglist);
58void delPattern(arglist_type *arglist);
59
60void setSeed(arglist_type *arglist);
61void jogWeights(arglist_type *arglist);
62void jogCorrWeights(arglist_type *arglist);
63
64/* end global definition section */
65
66
67/* begin private definition section */
68
69/*****************************************************************************
70  variables for storing parameters for SNNS-Kernel calls:
71******************************************************************************/
72
73static int
74    noOfInitParams = 0,        /* number of init parameters */
75    noOfLearnInP = 1,          /* number of learn parameters */
76    noOfUpdateParam = 0,       /* number of update parameters */
77    noOfRemapParam = 0;        /* number of pattern remap parameters */
78
79static int
80    spIsize[MAX_NO_OF_VAR_DIM],/* parameters for subpattern definition */
81    spIstep[MAX_NO_OF_VAR_DIM],
82    spOsize[MAX_NO_OF_VAR_DIM],
83    spOstep[MAX_NO_OF_VAR_DIM];
84
85static float
86    init_param_array[NO_OF_INIT_PARAMS],
87                               /* parameters for the init function */
88    learn_param_array[NO_OF_LEARN_PARAMS],
89                               /* parameters for the learning function */
90    update_param_array[NO_OF_UPDATE_PARAMS],
91                               /* parameters for the update function */
92    remap_param_array[NO_OF_REMAP_PARAMS];
93                               /* parameters for the remap function */
94static unsigned int *distrib_array = NULL;     /* class distribution values */
95
96static char
97    init_fct[FUNCTION_NAME_MAX_LEN],     /* init function name */
98    learn_fct[FUNCTION_NAME_MAX_LEN],    /* learn function name */
99    update_fct[FUNCTION_NAME_MAX_LEN],   /* update function name */
100    remap_fct[FUNCTION_NAME_MAX_LEN],    /* remap function name */
101    pruning_fct[FUNCTION_NAME_MAX_LEN],  /* pruning function name */
102    sublearn_fct[FUNCTION_NAME_MAX_LEN]; /* subord. learn. func. name */
103
104static Bool_type
105    init_net_flag = FALSE,     /* init_param_array init'ed or not */
106    init_learn_flag = FALSE,   /* learn_param_array init'ed or not */
107    init_update_flag = FALSE,  /* update_param_array init'ed or not */
108    init_remap_flag = FALSE,   /* remap_param_array init'ed or not */
109    init_subPat_flag = FALSE;  /* subPattern arrays init'ed or not */
110
111static char
112    *netname;                  /* SNNS name of the current network */
113
114
115/*****************************************************************************
116  pruning parameters
117
118  NOTE: prune_f.h supplies its internal variables instead of the
119        initialization #defines (probably the hell knows why)
120	so initialization is performed in setPruningFunc()
121******************************************************************************/
122static float
123    max_error_incr,
124    accepted_error,
125    min_error_to_stop,
126    init_matrix_value;
127
128static int
129    first_train_cyc,
130    retrain_cyc;
131
132static Bool_type
133    recreate,
134    input_pruning,
135    hidden_pruning;
136
137
138/*****************************************************************************
139  the pattern table:
140  table to associate pattern file names with SNNS-kernel pattern numbers:
141  an array of ST pointers indexed by SNNS patset numbers
142******************************************************************************/
143static St_ptr_type
144    pat_tab[NO_OF_PAT_SETS];
145
146static int
147    pat_sets_loaded = 0,       /* number of patternsets in memory */
148    curr_patSet = 0;           /* current pattern set */
149
150
151void enter_patName(St_ptr_type name);
152int lookup_patName(St_ptr_type pat);
153St_ptr_type lookup_patNumber(int pat);
154void del_patName(int pat_no);
155void print_parameters(const float *array, int number);
156void defSubpattern(void);
157float trainFFNet(int cycles);
158
159/*char *tempnam(const char *dir, const char *pfx);*/
160
161/* end private definition section */
162
163#endif
164