CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
mlp_gen.h
Go to the documentation of this file.
1 #ifndef __private_mlp_gen_h
2 #define __private_mlp_gen_h
3 
4 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
5 # define MLP_HIDDEN __attribute__((visibility("hidden")))
6 #endif
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 typedef double dbl;
13 typedef double type_pat;
14 
15 /* definition du reseau */
16 extern struct net_
17 {
19  dbl ***Weights;
20  dbl **vWeights;
21  dbl **Deriv1, **Inn, **Outn, **Delta;
22  int **T_func;
23  int Rdwt, Debug;
25 #define NET net_
26 
27 /* apprentissage */
28 extern struct learn_
29 {
32  dbl eta, epsilon, delta;
33  dbl ***Odw;
34  dbl ***DeDw, ***ODeDw;
36 #define LEARN learn_
37 
38 extern struct pat_
39 {
40  int Npat[2], Iponde, Nin, Nout;
41  type_pat ***Rin, ***Rans, **Pond;
42  type_pat **vRin;
43  dbl Ponds[10];
45 #define PAT pat_
46 
47 extern struct divers_
48 {
49  int Dbin;
50  int Ihess;
51  int Norm, Stat;
52  char Outf;
54 #define DIVERS divers_
55 
56 extern struct stat_
57 {
58  dbl *mean,*sigma;
60 #define STAT stat_
61 
62 extern int MessLang MLP_HIDDEN;
63 extern int OutputWeights MLP_HIDDEN;
64 extern int ExamplesMemory MLP_HIDDEN;
65 extern int WeightsMemory MLP_HIDDEN;
66 extern int PatMemory[2] MLP_HIDDEN;
67 extern int BFGSMemory MLP_HIDDEN;
68 extern int JacobianMemory MLP_HIDDEN;
69 extern int LearnMemory MLP_HIDDEN;
70 extern int NetMemory MLP_HIDDEN;
71 extern float MLPfitVersion MLP_HIDDEN;
72 extern dbl LastAlpha MLP_HIDDEN;
73 extern int NLineSearchFail MLP_HIDDEN;
74 
75 extern dbl ***dir MLP_HIDDEN;
76 extern dbl *delta MLP_HIDDEN;
77 extern dbl **BFGSH MLP_HIDDEN;
78 extern dbl *Gamma MLP_HIDDEN;
79 extern dbl **JacobianMatrix MLP_HIDDEN;
80 extern int *ExamplesIndex MLP_HIDDEN;
81 extern dbl **Hessian MLP_HIDDEN;
82 
83 extern void MLP_Out(type_pat *rrin, dbl *rrout) MLP_HIDDEN;
84 extern void MLP_Out2(type_pat *rrin) MLP_HIDDEN;
85 extern void MLP_Out_T(type_pat *rrin) MLP_HIDDEN;
86 extern dbl MLP_Test(int ifile, int regul) MLP_HIDDEN;
87 extern dbl MLP_Epoch(int iepoch, dbl *alpmin, int *ntest) MLP_HIDDEN;
88 extern int MLP_Train(int *ipat,dbl *err) MLP_HIDDEN;
89 extern dbl MLP_Stochastic() MLP_HIDDEN;
90 
91 extern int StochStep() MLP_HIDDEN;
92 
93 extern dbl DeDwNorm() MLP_HIDDEN;
94 extern dbl DeDwProd() MLP_HIDDEN;
95 extern void DeDwZero() MLP_HIDDEN;
96 extern void DeDwSaveZero() MLP_HIDDEN;
97 extern void DeDwScale(int Nexamples) MLP_HIDDEN;
98 extern void DeDwSave() MLP_HIDDEN;
99 extern int DeDwSum(type_pat *ans, dbl *out, int ipat) MLP_HIDDEN;
100 
101 extern int SetTransFunc(int layer, int neuron, int func) MLP_HIDDEN;
102 extern void SetDefaultFuncs() MLP_HIDDEN;
103 
104 extern void SteepestDir() MLP_HIDDEN;
105 extern void CGDir(dbl beta) MLP_HIDDEN;
106 extern dbl DerivDir() MLP_HIDDEN;
107 extern void GetGammaDelta() MLP_HIDDEN;
108 extern void BFGSdir(int Nweights) MLP_HIDDEN;
109 extern void InitBFGSH(int Nweights) MLP_HIDDEN;
110 extern int GetBFGSH(int Nweights) MLP_HIDDEN;
111 
112 extern int LineSearch(dbl *alpmin, int *Ntest, dbl Err0) MLP_HIDDEN;
113 extern int DecreaseSearch(dbl *alpmin, int *Ntest, dbl Err0) MLP_HIDDEN;
114 extern void MLP_ResLin() MLP_HIDDEN;
115 extern void MLP_Line(dbl ***w0, dbl alpha) MLP_HIDDEN;
116 extern int LineSearchHyb(dbl *alpmin, int *Ntest) MLP_HIDDEN;
117 extern void MLP_LineHyb(dbl ***w0, dbl alpha) MLP_HIDDEN;
118 extern int StochStepHyb() MLP_HIDDEN;
119 extern int FixedStep(dbl alpha) MLP_HIDDEN;
120 
121 extern void EtaDecay() MLP_HIDDEN;
122 extern int ShuffleExamples(int n, int *index) MLP_HIDDEN;
123 extern double MLP_Rand(dbl min, dbl max) MLP_HIDDEN;
124 extern void InitWeights() MLP_HIDDEN;
125 extern int NormalizeInputs() MLP_HIDDEN;
126 extern int MLP_StatInputs(int Nexamples, int Ninputs, type_pat **inputs,
127  dbl *mean, dbl *sigma, dbl *minimum, dbl *maximum) MLP_HIDDEN;
128 extern int MLP_PrintInputStat() MLP_HIDDEN;
129 
130 extern int LoadWeights(char *filename, int *iepoch) MLP_HIDDEN;
131 extern int SaveWeights(char *filename, int iepoch) MLP_HIDDEN;
132 
133 extern void SetLambda(double Wmax) MLP_HIDDEN;
134 extern void PrintWeights() MLP_HIDDEN;
135 extern int ReadPatterns(char *filename, int ifile,
136  int *inet, int *ilearn, int *iexamples) MLP_HIDDEN;
137 extern int CountLexemes(char *string) MLP_HIDDEN;
138 extern void getnLexemes(int n, char *s, char **ss) MLP_HIDDEN;
139 extern void getLexemes(char *s,char **ss) MLP_HIDDEN;
140 extern int LearnAlloc() MLP_HIDDEN;
141 extern void LearnFree() MLP_HIDDEN;
142 extern int MLP_PrFFun(char *filename) MLP_HIDDEN;
143 extern int MLP_PrCFun(char *filename) MLP_HIDDEN;
144 extern int AllocPatterns(int ifile, int npat, int nin, int nout, int iadd) MLP_HIDDEN;
145 extern int FreePatterns(int ifile) MLP_HIDDEN;
146 extern void AllocWeights() MLP_HIDDEN;
147 extern void FreeWeights() MLP_HIDDEN;
148 extern int AllocNetwork(int Nlayer, int *Neurons) MLP_HIDDEN;
149 extern void FreeNetwork() MLP_HIDDEN;
150 extern int GetNetStructure(char *s, int *Nlayer, int *Nneur) MLP_HIDDEN;
151 extern int MLP_SetNet(int *nl, int *nn) MLP_HIDDEN;
152 
153 extern void MLP_MM2rows(dbl* c, type_pat* a, dbl* b,
154  int Ni, int Nj, int Nk, int NaOffs, int NbOffs) MLP_HIDDEN;
155 extern void MLP_MatrixVector(dbl *M, type_pat *v, dbl *r, int n,
156  int m) MLP_HIDDEN;
157 extern void MLP_MatrixVectorBias(dbl *M, dbl *v, dbl *r, int n,
158  int m) MLP_HIDDEN;
159 
160 #ifdef __cplusplus
161 } // extern "C"
162 #endif
163 
164 #endif // __private_mlp_gen_h
const double beta
dbl * delta
Definition: mlp_gen.cc:36
dbl MLP_Epoch(int iepoch, dbl *alpmin, int *Ntest)
Definition: mlp_gen.cc:706
dbl *** ODeDw
Definition: mlp_gen.h:34
int MessLang
Definition: mlp_gen.cc:22
float alpha
Definition: AMPTWrapper.h:95
dbl * mean
Definition: mlp_gen.h:58
Definition: mlp_gen.h:56
void getnLexemes(int n, char *s, char **ss)
Definition: mlp_gen.cc:2601
int JacobianMemory
Definition: mlp_gen.cc:28
dbl ** Outn
Definition: mlp_gen.h:21
Definition: mlp_gen.h:28
void LearnFree()
Definition: mlp_gen.cc:2640
dbl * sigma
Definition: mlp_gen.h:58
int Npat[2]
Definition: mlp_gen.h:40
int Iponde
Definition: mlp_gen.h:40
dbl DeDwProd()
Definition: mlp_gen.cc:1020
int ReadPatterns(char *filename, int ifile, int *inet, int *ilearn, int *iexamples)
Definition: mlp_gen.cc:2229
int * Nneur
Definition: mlp_gen.h:18
void CGDir(dbl beta)
Definition: mlp_gen.cc:1266
int FixedStep(dbl alpha)
Definition: mlp_gen.cc:1704
void DeDwSaveZero()
Definition: mlp_gen.cc:1097
int DecreaseSearch(dbl *alpmin, int *Ntest, dbl Err0)
Definition: mlp_gen.cc:1616
void InitWeights()
Definition: mlp_gen.cc:2147
Definition: mlp_gen.h:38
type_pat ** vRin
Definition: mlp_gen.h:42
int OutputWeights
Definition: mlp_gen.cc:23
int * ExamplesIndex
Definition: mlp_gen.cc:40
dbl ** vWeights
Definition: mlp_gen.h:20
int SaveWeights(char *filename, int iepoch)
Definition: mlp_gen.cc:2972
int NLineSearchFail
Definition: mlp_gen.cc:33
void MLP_Out(type_pat *rrin, dbl *rrout)
Definition: mlp_gen.cc:62
void AllocWeights() MLP_HIDDEN
int Nout
Definition: mlp_gen.h:40
int MLP_SetNet(int *nl, int *nn)
Definition: mlp_gen.cc:3639
int LearnMemory
Definition: mlp_gen.cc:29
int Nlayer
Definition: mlp_gen.h:18
type_pat ** Pond
Definition: mlp_gen.h:41
void EtaDecay()
Definition: mlp_gen.cc:2086
dbl ** BFGSH
Definition: mlp_gen.cc:37
int MLP_PrCFun(char *filename)
Definition: mlp_gen.cc:2878
int nin
float MLPfitVersion
Definition: mlp_gen.cc:31
char Outf
Definition: mlp_gen.h:52
dbl Ponds[10]
Definition: mlp_gen.h:43
int MLP_StatInputs(int Nexamples, int Ninputs, type_pat **inputs, dbl *mean, dbl *sigma, dbl *minimum, dbl *maximum)
Definition: mlp_gen.cc:3275
int Nweights
Definition: mlp_gen.h:18
void SetLambda(double Wmax)
Definition: mlp_gen.cc:1949
int Norm
Definition: mlp_gen.h:51
void SteepestDir()
Definition: mlp_gen.cc:1244
dbl epsilon
Definition: mlp_gen.h:32
type_pat *** Rans
Definition: mlp_gen.h:41
int GetBFGSH(int Nweights)
Definition: mlp_gen.cc:1418
int BFGSMemory
Definition: mlp_gen.cc:27
dbl *** DeDw
Definition: mlp_gen.h:34
const T & max(const T &a, const T &b)
int GetNetStructure(char *s, int *Nlayer, int *Nneur)
Definition: mlp_gen.cc:3592
void PrintWeights()
Definition: mlp_gen.cc:2168
void MLP_Out_T(type_pat *rrin)
Definition: mlp_gen.cc:113
int StochStep()
Definition: mlp_gen.cc:965
int LearnAlloc()
Definition: mlp_gen.cc:2685
dbl *** Odw
Definition: mlp_gen.h:33
dbl MLP_Stochastic()
Definition: mlp_gen.cc:518
double type_pat
Definition: mlp_gen.h:13
int MLP_Train(int *ipat, dbl *err)
Definition: mlp_gen.cc:895
int ShuffleExamples(int n, int *index)
Definition: mlp_gen.cc:2102
dbl Lambda
Definition: mlp_gen.h:31
dbl delta
Definition: mlp_gen.h:32
double MLP_Rand(dbl mini, dbl maxi)
Definition: mlp_gen.cc:2131
dbl DeDwNorm()
Definition: mlp_gen.cc:998
int DeDwSum(type_pat *ans, dbl *out, int ipat)
Definition: mlp_gen.cc:1123
dbl LastAlpha
Definition: mlp_gen.cc:32
int CountLexemes(char *s)
Definition: mlp_gen.cc:2585
struct net_ net_ MLP_HIDDEN
Definition: mlp_gen.cc:16
int Nin
Definition: mlp_gen.h:40
int NetMemory
Definition: mlp_gen.cc:30
int Debug
Definition: mlp_gen.h:23
int LoadWeights(char *filename, int *iepoch)
Definition: mlp_gen.cc:3022
void MLP_LineHyb(dbl ***w0, dbl alpha)
Definition: mlp_gen.cc:1923
Definition: mlp_gen.h:16
int AllocPatterns(int ifile, int npat, int nin, int nout, int iadd)
Definition: mlp_gen.cc:3077
dbl ** JacobianMatrix
Definition: mlp_gen.cc:39
void FreeWeights() MLP_HIDDEN
int SetTransFunc(int layer, int neuron, int func)
Definition: mlp_gen.cc:1200
tuple out
Definition: dbtoconf.py:99
int Meth
Definition: mlp_gen.h:30
int StochStepHyb()
Definition: mlp_gen.cc:926
void InitBFGSH(int Nweights)
Definition: mlp_gen.cc:1388
void GetGammaDelta()
Definition: mlp_gen.cc:1313
int PatMemory[2]
Definition: mlp_gen.cc:26
dbl ** Delta
Definition: mlp_gen.h:21
void MLP_ResLin()
Definition: mlp_gen.cc:1971
void MLP_MM2rows(dbl *c, type_pat *a, dbl *b, int Ni, int Nj, int Nk, int NaOffs, int NbOffs)
Definition: mlp_gen.cc:3817
dbl Norm
Definition: mlp_gen.h:31
void MLP_MatrixVector(dbl *M, type_pat *v, dbl *r, int n, int m)
Definition: mlp_gen.cc:3748
void DeDwScale(int Nexamples)
Definition: mlp_gen.cc:1060
void MLP_Line(dbl ***w0, dbl alpha)
Definition: mlp_gen.cc:1757
void MLP_MatrixVectorBias(dbl *M, dbl *v, dbl *r, int n, int m)
Definition: mlp_gen.cc:3682
void getLexemes(char *s, char **ss)
Definition: mlp_gen.cc:2615
double b
Definition: hdecay.h:120
void FreeNetwork()
Definition: mlp_gen.cc:3531
int NormalizeInputs()
Definition: mlp_gen.cc:3378
int ExamplesMemory
Definition: mlp_gen.cc:24
int LineSearch(dbl *alpmin, int *Ntest, dbl Err0)
Definition: mlp_gen.cc:1478
void DeDwSave()
Definition: mlp_gen.cc:1078
int nout
void BFGSdir(int Nweights)
Definition: mlp_gen.cc:1340
double a
Definition: hdecay.h:121
int Stat
Definition: mlp_gen.h:51
tuple filename
Definition: lut2db_cfg.py:20
int Dbin
Definition: mlp_gen.h:49
dbl * Gamma
Definition: mlp_gen.cc:38
double dbl
Definition: mlp_gen.h:12
type_pat *** Rin
Definition: mlp_gen.h:41
int WeightsMemory
Definition: mlp_gen.cc:25
dbl *** Weights
Definition: mlp_gen.h:19
int MLP_PrintInputStat()
Definition: mlp_gen.cc:3332
dbl ** Inn
Definition: mlp_gen.h:21
int Nreset
Definition: mlp_gen.h:30
dbl *** dir
Definition: mlp_gen.cc:35
void MLP_Out2(type_pat *rrin)
Definition: mlp_gen.cc:184
void SetDefaultFuncs()
Definition: mlp_gen.cc:1223
dbl Decay
Definition: mlp_gen.h:31
int Ihess
Definition: mlp_gen.h:50
dbl Alambda
Definition: mlp_gen.h:31
int FreePatterns(int ifile)
Definition: mlp_gen.cc:3232
dbl eta
Definition: mlp_gen.h:32
dbl MLP_Test(int ifile, int regul)
Definition: mlp_gen.cc:446
int MLP_PrFFun(char *filename)
Definition: mlp_gen.cc:2769
void DeDwZero()
Definition: mlp_gen.cc:1041
int AllocNetwork(int Nlayer, int *Neurons)
Definition: mlp_gen.cc:3449
int Rdwt
Definition: mlp_gen.h:23
int Nepoch
Definition: mlp_gen.h:30
dbl ** Hessian
Definition: mlp_gen.cc:41
int LineSearchHyb(dbl *alpmin, int *Ntest)
Definition: mlp_gen.cc:1781
dbl Tau
Definition: mlp_gen.h:31
dbl ** Deriv1
Definition: mlp_gen.h:21
dbl DerivDir()
Definition: mlp_gen.cc:1288
int ** T_func
Definition: mlp_gen.h:22