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:709
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:2599
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:2638
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:1023
int ReadPatterns(char *filename, int ifile, int *inet, int *ilearn, int *iexamples)
Definition: mlp_gen.cc:2227
int * Nneur
Definition: mlp_gen.h:18
void CGDir(dbl beta)
Definition: mlp_gen.cc:1269
int FixedStep(dbl alpha)
Definition: mlp_gen.cc:1702
void DeDwSaveZero()
Definition: mlp_gen.cc:1100
int DecreaseSearch(dbl *alpmin, int *Ntest, dbl Err0)
Definition: mlp_gen.cc:1614
void InitWeights()
Definition: mlp_gen.cc:2145
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:2970
#define min(a, b)
Definition: mlp_lapack.h:161
int NLineSearchFail
Definition: mlp_gen.cc:33
void MLP_Out(type_pat *rrin, dbl *rrout)
Definition: mlp_gen.cc:63
void AllocWeights() MLP_HIDDEN
int Nout
Definition: mlp_gen.h:40
int MLP_SetNet(int *nl, int *nn)
Definition: mlp_gen.cc:3635
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:2084
dbl ** BFGSH
Definition: mlp_gen.cc:37
int MLP_PrCFun(char *filename)
Definition: mlp_gen.cc:2876
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:3273
int Nweights
Definition: mlp_gen.h:18
void SetLambda(double Wmax)
Definition: mlp_gen.cc:1947
int Norm
Definition: mlp_gen.h:51
void SteepestDir()
Definition: mlp_gen.cc:1247
dbl epsilon
Definition: mlp_gen.h:32
type_pat *** Rans
Definition: mlp_gen.h:41
int GetBFGSH(int Nweights)
Definition: mlp_gen.cc:1421
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:3588
void PrintWeights()
Definition: mlp_gen.cc:2166
void MLP_Out_T(type_pat *rrin)
Definition: mlp_gen.cc:115
int StochStep()
Definition: mlp_gen.cc:968
int LearnAlloc()
Definition: mlp_gen.cc:2683
dbl *** Odw
Definition: mlp_gen.h:33
dbl MLP_Stochastic()
Definition: mlp_gen.cc:521
double type_pat
Definition: mlp_gen.h:13
int MLP_Train(int *ipat, dbl *err)
Definition: mlp_gen.cc:898
int ShuffleExamples(int n, int *index)
Definition: mlp_gen.cc:2100
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:2129
dbl DeDwNorm()
Definition: mlp_gen.cc:1001
int DeDwSum(type_pat *ans, dbl *out, int ipat)
Definition: mlp_gen.cc:1126
dbl LastAlpha
Definition: mlp_gen.cc:32
int CountLexemes(char *s)
Definition: mlp_gen.cc:2583
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:3020
void MLP_LineHyb(dbl ***w0, dbl alpha)
Definition: mlp_gen.cc:1921
Definition: mlp_gen.h:16
int AllocPatterns(int ifile, int npat, int nin, int nout, int iadd)
Definition: mlp_gen.cc:3075
dbl ** JacobianMatrix
Definition: mlp_gen.cc:39
void FreeWeights() MLP_HIDDEN
int SetTransFunc(int layer, int neuron, int func)
Definition: mlp_gen.cc:1203
tuple out
Definition: dbtoconf.py:99
int Meth
Definition: mlp_gen.h:30
int StochStepHyb()
Definition: mlp_gen.cc:929
void InitBFGSH(int Nweights)
Definition: mlp_gen.cc:1391
void GetGammaDelta()
Definition: mlp_gen.cc:1316
int PatMemory[2]
Definition: mlp_gen.cc:26
dbl ** Delta
Definition: mlp_gen.h:21
void MLP_ResLin()
Definition: mlp_gen.cc:1969
void MLP_MM2rows(dbl *c, type_pat *a, dbl *b, int Ni, int Nj, int Nk, int NaOffs, int NbOffs)
Definition: mlp_gen.cc:3813
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:3744
void DeDwScale(int Nexamples)
Definition: mlp_gen.cc:1063
void MLP_Line(dbl ***w0, dbl alpha)
Definition: mlp_gen.cc:1755
void MLP_MatrixVectorBias(dbl *M, dbl *v, dbl *r, int n, int m)
Definition: mlp_gen.cc:3678
void getLexemes(char *s, char **ss)
Definition: mlp_gen.cc:2613
double b
Definition: hdecay.h:120
void FreeNetwork()
Definition: mlp_gen.cc:3527
int NormalizeInputs()
Definition: mlp_gen.cc:3376
int ExamplesMemory
Definition: mlp_gen.cc:24
int LineSearch(dbl *alpmin, int *Ntest, dbl Err0)
Definition: mlp_gen.cc:1476
void DeDwSave()
Definition: mlp_gen.cc:1081
int nout
void BFGSdir(int Nweights)
Definition: mlp_gen.cc:1343
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:3330
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:186
void SetDefaultFuncs()
Definition: mlp_gen.cc:1226
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:3230
dbl eta
Definition: mlp_gen.h:32
dbl MLP_Test(int ifile, int regul)
Definition: mlp_gen.cc:449
int MLP_PrFFun(char *filename)
Definition: mlp_gen.cc:2767
void DeDwZero()
Definition: mlp_gen.cc:1044
int AllocNetwork(int Nlayer, int *Neurons)
Definition: mlp_gen.cc:3445
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:1779
dbl Tau
Definition: mlp_gen.h:31
dbl ** Deriv1
Definition: mlp_gen.h:21
dbl DerivDir()
Definition: mlp_gen.cc:1291
int ** T_func
Definition: mlp_gen.h:22