CMS 3D CMS Logo

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 {
30  int Nepoch, Meth, Nreset;
31  dbl Tau,Norm,Decay,Lambda,Alambda;
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
int FreePatterns(int ifile) MLP_HIDDEN
Definition: mlp_gen.cc:3232
dbl * delta
Definition: mlp_gen.cc:36
dbl *** ODeDw
Definition: mlp_gen.h:34
int DeDwSum(type_pat *ans, dbl *out, int ipat) MLP_HIDDEN
Definition: mlp_gen.cc:1123
int MessLang
Definition: mlp_gen.cc:22
float alpha
Definition: AMPTWrapper.h:95
Definition: mlp_gen.h:56
int JacobianMemory
Definition: mlp_gen.cc:28
int CountLexemes(char *string) MLP_HIDDEN
Definition: mlp_gen.cc:2585
dbl ** Outn
Definition: mlp_gen.h:21
Definition: mlp_gen.h:28
void MLP_Out_T(type_pat *rrin) MLP_HIDDEN
Definition: mlp_gen.cc:113
void SetLambda(double Wmax) MLP_HIDDEN
Definition: mlp_gen.cc:1949
int SetTransFunc(int layer, int neuron, int func) MLP_HIDDEN
Definition: mlp_gen.cc:1200
dbl * sigma
Definition: mlp_gen.h:58
int MLP_PrintInputStat() MLP_HIDDEN
Definition: mlp_gen.cc:3332
int * Nneur
Definition: mlp_gen.h:18
int FixedStep(dbl alpha) MLP_HIDDEN
Definition: mlp_gen.cc:1704
dbl DeDwProd() MLP_HIDDEN
Definition: mlp_gen.cc:1020
int ReadPatterns(char *filename, int ifile, int *inet, int *ilearn, int *iexamples) MLP_HIDDEN
Definition: mlp_gen.cc:2229
void MLP_Line(dbl ***w0, dbl alpha) MLP_HIDDEN
Definition: mlp_gen.cc:1757
void SteepestDir() MLP_HIDDEN
Definition: mlp_gen.cc:1244
Definition: mlp_gen.h:38
type_pat ** vRin
Definition: mlp_gen.h:42
void DeDwSave() MLP_HIDDEN
Definition: mlp_gen.cc:1078
int MLP_Train(int *ipat, dbl *err) MLP_HIDDEN
Definition: mlp_gen.cc:895
int OutputWeights
Definition: mlp_gen.cc:23
void DeDwScale(int Nexamples) MLP_HIDDEN
Definition: mlp_gen.cc:1060
int GetNetStructure(char *s, int *Nlayer, int *Nneur) MLP_HIDDEN
Definition: mlp_gen.cc:3592
int * ExamplesIndex
Definition: mlp_gen.cc:40
int StochStepHyb() MLP_HIDDEN
Definition: mlp_gen.cc:926
dbl ** vWeights
Definition: mlp_gen.h:20
int NLineSearchFail
Definition: mlp_gen.cc:33
dbl MLP_Test(int ifile, int regul) MLP_HIDDEN
Definition: mlp_gen.cc:446
void AllocWeights() MLP_HIDDEN
int MLP_SetNet(int *nl, int *nn) MLP_HIDDEN
Definition: mlp_gen.cc:3639
int LineSearchHyb(dbl *alpmin, int *Ntest) MLP_HIDDEN
Definition: mlp_gen.cc:1781
int LearnMemory
Definition: mlp_gen.cc:29
int Nlayer
Definition: mlp_gen.h:18
dbl ** BFGSH
Definition: mlp_gen.cc:37
void FreeNetwork() MLP_HIDDEN
Definition: mlp_gen.cc:3531
int nin
float MLPfitVersion
Definition: mlp_gen.cc:31
char Outf
Definition: mlp_gen.h:52
void MLP_ResLin() MLP_HIDDEN
Definition: mlp_gen.cc:1971
int DecreaseSearch(dbl *alpmin, int *Ntest, dbl Err0) MLP_HIDDEN
Definition: mlp_gen.cc:1616
dbl DerivDir() MLP_HIDDEN
Definition: mlp_gen.cc:1288
void InitWeights() MLP_HIDDEN
Definition: mlp_gen.cc:2147
int Nweights
Definition: mlp_gen.h:18
void EtaDecay() MLP_HIDDEN
Definition: mlp_gen.cc:2086
void CGDir(dbl beta) MLP_HIDDEN
Definition: mlp_gen.cc:1266
int BFGSMemory
Definition: mlp_gen.cc:27
void SetDefaultFuncs() MLP_HIDDEN
Definition: mlp_gen.cc:1223
dbl *** Odw
Definition: mlp_gen.h:33
void MLP_Out2(type_pat *rrin) MLP_HIDDEN
Definition: mlp_gen.cc:184
void MLP_MM2rows(dbl *c, type_pat *a, dbl *b, int Ni, int Nj, int Nk, int NaOffs, int NbOffs) MLP_HIDDEN
Definition: mlp_gen.cc:3817
void Decay(List_t &output, Particle &p, ParticleAllocator &allocator, DatabasePDG *database)
double type_pat
Definition: mlp_gen.h:13
void MLP_Out(type_pat *rrin, dbl *rrout) MLP_HIDDEN
Definition: mlp_gen.cc:62
void DeDwZero() MLP_HIDDEN
Definition: mlp_gen.cc:1041
int LoadWeights(char *filename, int *iepoch) MLP_HIDDEN
Definition: mlp_gen.cc:3022
dbl LastAlpha
Definition: mlp_gen.cc:32
int StochStep() MLP_HIDDEN
Definition: mlp_gen.cc:965
int NetMemory
Definition: mlp_gen.cc:30
int Debug
Definition: mlp_gen.h:23
T min(T a, T b)
Definition: MathUtil.h:58
Definition: mlp_gen.h:16
dbl ** JacobianMatrix
Definition: mlp_gen.cc:39
void getnLexemes(int n, char *s, char **ss) MLP_HIDDEN
Definition: mlp_gen.cc:2601
int SaveWeights(char *filename, int iepoch) MLP_HIDDEN
Definition: mlp_gen.cc:2972
void FreeWeights() MLP_HIDDEN
int AllocPatterns(int ifile, int npat, int nin, int nout, int iadd) MLP_HIDDEN
Definition: mlp_gen.cc:3077
struct net_ MLP_HIDDEN
Definition: mlp_gen.h:62
int MLP_PrFFun(char *filename) MLP_HIDDEN
Definition: mlp_gen.cc:2769
int ShuffleExamples(int n, int *index) MLP_HIDDEN
Definition: mlp_gen.cc:2102
int AllocNetwork(int Nlayer, int *Neurons) MLP_HIDDEN
Definition: mlp_gen.cc:3449
int PatMemory[2]
Definition: mlp_gen.cc:26
void MLP_MatrixVector(dbl *M, type_pat *v, dbl *r, int n, int m) MLP_HIDDEN
Definition: mlp_gen.cc:3748
dbl ** Delta
Definition: mlp_gen.h:21
void getLexemes(char *s, char **ss) MLP_HIDDEN
Definition: mlp_gen.cc:2615
void InitBFGSH(int Nweights) MLP_HIDDEN
Definition: mlp_gen.cc:1388
void PrintWeights() MLP_HIDDEN
Definition: mlp_gen.cc:2168
void LearnFree() MLP_HIDDEN
Definition: mlp_gen.cc:2640
double b
Definition: hdecay.h:120
void DeDwSaveZero() MLP_HIDDEN
Definition: mlp_gen.cc:1097
int ExamplesMemory
Definition: mlp_gen.cc:24
dbl MLP_Epoch(int iepoch, dbl *alpmin, int *ntest) MLP_HIDDEN
Definition: mlp_gen.cc:706
int nout
double a
Definition: hdecay.h:121
void MLP_LineHyb(dbl ***w0, dbl alpha) MLP_HIDDEN
Definition: mlp_gen.cc:1923
void GetGammaDelta() MLP_HIDDEN
Definition: mlp_gen.cc:1313
int Stat
Definition: mlp_gen.h:51
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
dbl MLP_Stochastic() MLP_HIDDEN
Definition: mlp_gen.cc:518
dbl ** Inn
Definition: mlp_gen.h:21
int Nreset
Definition: mlp_gen.h:30
void MLP_MatrixVectorBias(dbl *M, dbl *v, dbl *r, int n, int m) MLP_HIDDEN
Definition: mlp_gen.cc:3682
dbl *** dir
Definition: mlp_gen.cc:35
int LearnAlloc() MLP_HIDDEN
Definition: mlp_gen.cc:2685
int Ihess
Definition: mlp_gen.h:50
int LineSearch(dbl *alpmin, int *Ntest, dbl Err0) MLP_HIDDEN
Definition: mlp_gen.cc:1478
dbl eta
Definition: mlp_gen.h:32
void BFGSdir(int Nweights) MLP_HIDDEN
Definition: mlp_gen.cc:1340
double MLP_Rand(dbl min, dbl max) MLP_HIDDEN
Definition: mlp_gen.cc:2131
int Rdwt
Definition: mlp_gen.h:23
int GetBFGSH(int Nweights) MLP_HIDDEN
Definition: mlp_gen.cc:1418
int MLP_PrCFun(char *filename) MLP_HIDDEN
Definition: mlp_gen.cc:2878
dbl ** Hessian
Definition: mlp_gen.cc:41
int NormalizeInputs() MLP_HIDDEN
Definition: mlp_gen.cc:3378
dbl Tau
Definition: mlp_gen.h:31
dbl ** Deriv1
Definition: mlp_gen.h:21
int MLP_StatInputs(int Nexamples, int Ninputs, type_pat **inputs, dbl *mean, dbl *sigma, dbl *minimum, dbl *maximum) MLP_HIDDEN
Definition: mlp_gen.cc:3275
dbl DeDwNorm() MLP_HIDDEN
Definition: mlp_gen.cc:998
int ** T_func
Definition: mlp_gen.h:22