91 for(i=0; i<max_nVar_;++i)
fVarn_1.xmin[i] = 0;
96 for(i=0; i<max_nNodes_;++i)
fDel_1.coef[i] = 0;
97 for(i=0; i<max_nLayers_*max_nNodes_;++i)
fDel_1.del[i] = 0;
98 for(i=0; i<max_nLayers_*max_nNodes_*max_nNodes_;++i)
fDel_1.delta[i] = 0;
99 for(i=0; i<max_nLayers_*max_nNodes_*max_nNodes_;++i)
fDel_1.delw[i] = 0;
100 for(i=0; i<max_nLayers_*max_nNodes_;++i)
fDel_1.delww[i] = 0;
104 for(i=0; i<max_nLayers_;++i)
fDel_1.temp[i] = 0;
106 for(i=0; i<max_nNodes_;++i)
fNeur_1.cut[i] = 0;
107 for(i=0; i<max_nLayers_*max_nNodes_;++i)
fNeur_1.deltaww[i] = 0;
108 for(i=0; i<max_nLayers_;++i)
fNeur_1.neuron[i] = 0;
109 for(i=0; i<max_nNodes_;++i)
fNeur_1.o[i] = 0;
110 for(i=0; i<max_nLayers_*max_nNodes_*max_nNodes_;++i)
fNeur_1.w[i] = 0;
111 for(i=0; i<max_nLayers_*max_nNodes_;++i)
fNeur_1.ww[i] = 0;
112 for(i=0; i<max_nLayers_*max_nNodes_;++i)
fNeur_1.x[i] = 0;
113 for(i=0; i<max_nLayers_*max_nNodes_;++i)
fNeur_1.y[i] = 0;
135 for(i=0; i<max_Events_;++i)
fVarn_1.mclass[i] = 0;
136 for(i=0; i<max_Events_;++i)
fVarn_1.nclass[i] = 0;
137 for(i=0; i<max_nVar_;++i)
fVarn_1.xmax[i] = 0;
158 if (*ntrain + *ntest > max_Events_) {
159 printf(
"*** CFMlpANN_f2c: Warning in Train_nn: number of training + testing" \
160 " events exceeds hardcoded maximum - reset to maximum allowed number");
161 *ntrain = *ntrain*(max_Events_/(*ntrain + *ntest));
162 *ntest = *ntest *(max_Events_/(*ntrain + *ntest));
164 if (*nvar2 > max_nVar_) {
165 printf(
"*** CFMlpANN_f2c: ERROR in Train_nn: number of variables" \
166 " exceeds hardcoded maximum ==> abort");
169 if (*nlayer > max_nLayers_) {
170 printf(
"*** CFMlpANN_f2c: Warning in Train_nn: number of layers" \
171 " exceeds hardcoded maximum - reset to maximum allowed number");
172 *nlayer = max_nLayers_;
174 if (*nodes > max_nNodes_) {
175 printf(
"*** CFMlpANN_f2c: Warning in Train_nn: number of nodes" \
176 " exceeds hardcoded maximum - reset to maximum allowed number");
177 *nodes = max_nNodes_;
187 Entree_new(nvar2, det, ntrain, ntest, nlayer, nodes, ncycle, (
Int_t)20);
214 Int_t rewrite, i__, j, ncoef;
215 Int_t ntemp, num, retrain;
227 for (i__ = 1; i__ <= max_nNodes_; ++i__) {
230 for (i__ = 1; i__ <= max_nLayers_; ++i__) {
234 if (
fParam_1.layerm > max_nLayers_) {
235 printf(
"Error: number of layers exceeds maximum: %i, %i ==> abort",
237 Arret(
"modification of mlpl3_param_lim.inc is needed ");
253 ULog() << kINFO <<
"Total number of events for training: " <<
fParam_1.nevl <<
Endl;
254 ULog() << kINFO <<
"Total number of training cycles : " <<
fParam_1.nblearn <<
Endl;
256 printf(
"Error: number of learning events exceeds maximum: %i, %i ==> abort",
258 Arret(
"modification of mlpl3_param_lim.inc is needed ");
261 printf(
"Error: number of testing events exceeds maximum: %i, %i ==> abort",
263 Arret(
"modification of mlpl3_param_lim.inc is needed ");
266 for (j = 1; j <= i__1; ++j) {
271 if (j ==
fParam_1.layerm && num != 2) {
277 for (j = 1; j <= i__1; ++j) {
278 ULog() << kINFO <<
"Number of layers for neuron(" << j <<
"): " <<
fNeur_1.neuron[j - 1] <<
Endl;
281 printf(
"Error: wrong number of classes at output layer: %i != 2 ==> abort\n",
286 for (j = 1; j <= i__1; ++j) {
290 for (j = 1; j <= i__1; ++j) {
297 printf(
"Big troubles !!! \n" );
298 Arret(
"new training or continued one !");
301 ULog() << kINFO <<
"New training will be performed" <<
Endl;
304 printf(
"%s: New training will be continued from a weight file\n",
fg_MethodName);
308 for (i__ = 1; i__ <= max_nNodes_; ++i__) {
313 for (i__ = 1; i__ <= max_nLayers_; ++i__) {
319 Arret(
" entree error code 1 : need to reported");
322 Arret(
"entree error code 2 : need to reported");
326 #define w_ref(a_1,a_2,a_3) fNeur_1.w[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 327 #define ww_ref(a_1,a_2) fNeur_1.ww[(a_2)*max_nLayers_ + a_1 - 7] 334 Int_t i__1, i__2, i__3;
339 for (layer = 2; layer <= i__1; ++layer) {
340 i__2 =
fNeur_1.neuron[layer - 2];
341 for (i__ = 1; i__ <= i__2; ++i__) {
342 i__3 =
fNeur_1.neuron[layer - 1];
343 for (j = 1; j <= i__3; ++j) {
344 w_ref(layer, j, i__) = (
Sen3a() * 2. - 1.) * .2;
354 #define xeev_ref(a_1,a_2) fVarn2_1(a_1,a_2) 355 #define w_ref(a_1,a_2,a_3) fNeur_1.w[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 356 #define x_ref(a_1,a_2) fNeur_1.x[(a_2)*max_nLayers_ + a_1 - 7] 357 #define y_ref(a_1,a_2) fNeur_1.y[(a_2)*max_nLayers_ + a_1 - 7] 358 #define ww_ref(a_1,a_2) fNeur_1.ww[(a_2)*max_nLayers_ + a_1 - 7] 365 Int_t i__1, i__2, i__3;
372 for (i__ = 1; i__ <= i__1; ++i__) {
376 for (layer = 1; layer <= i__1; ++layer) {
378 for (j = 1; j <= i__2; ++j) {
379 x_ref(layer + 1, j) = 0.;
380 i__3 =
fNeur_1.neuron[layer - 1];
381 for (i__ = 1; i__ <= i__3; ++i__) {
383 *
w_ref(layer + 1, j, i__) );
399 #define xeev_ref(a_1,a_2) fVarn2_1(a_1,a_2) 409 Int_t nocla[max_nNodes_], ikend;
414 for (k = 1; k <= i__1; ++k) {
418 for (i__ = 1; i__ <= i__1; ++i__) {
423 for (i__ = 1; i__ <= i__1; ++i__) {
425 xpg, &
fVarn_1.nclass[i__ - 1], &ikend);
433 for (j = 1; j <= i__2; ++j) {
438 for (k = 1; k <= i__2; ++k) {
439 if (
fVarn_1.nclass[i__ - 1] == k) {
445 for (k = 1; k <= i__2; ++k) {
457 for (k = 1; k <= i__2; ++k) {
459 for (l = 1; l <= i__1; ++
l) {
460 if (nocla[k - 1] != nocla[l - 1]) {
467 for (i__ = 1; i__ <= i__1; ++i__) {
469 for (l = 1; l <= i__2; ++
l) {
486 #define delw_ref(a_1,a_2,a_3) fDel_1.delw[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 487 #define w_ref(a_1,a_2,a_3) fNeur_1.w[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 488 #define x_ref(a_1,a_2) fNeur_1.x[(a_2)*max_nLayers_ + a_1 - 7] 489 #define y_ref(a_1,a_2) fNeur_1.y[(a_2)*max_nLayers_ + a_1 - 7] 490 #define delta_ref(a_1,a_2,a_3) fDel_1.delta[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 491 #define delww_ref(a_1,a_2) fDel_1.delww[(a_2)*max_nLayers_ + a_1 - 7] 492 #define ww_ref(a_1,a_2) fNeur_1.ww[(a_2)*max_nLayers_ + a_1 - 7] 493 #define del_ref(a_1,a_2) fDel_1.del[(a_2)*max_nLayers_ + a_1 - 7] 494 #define deltaww_ref(a_1,a_2) fNeur_1.deltaww[(a_2)*max_nLayers_ + a_1 - 7] 501 Int_t i__1, i__2, i__3;
508 for (i__ = 1; i__ <= i__1; ++i__) {
509 if (
fVarn_1.nclass[*ievent - 1] == i__) {
518 for (i__ = 1; i__ <= i__1; ++i__) {
520 df = (f + 1.) * (1. -
f) / (
fDel_1.temp[l - 1] * 2.);
525 for (j = 1; j <= i__2; ++j) {
531 for (l =
fParam_1.layerm - 1; l >= 2; --l) {
533 for (i__ = 1; i__ <= i__2; ++i__) {
536 for (k = 1; k <= i__1; ++k) {
540 df = (f + 1.) * (1. -
f) / (
fDel_1.temp[l - 1] * 2.);
544 for (j = 1; j <= i__1; ++j) {
551 for (l = 2; l <= i__1; ++
l) {
553 for (i__ = 1; i__ <= i__2; ++i__) {
558 for (j = 1; j <= i__3; ++j) {
577 #define w_ref(a_1,a_2,a_3) fNeur_1.w[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 578 #define ww_ref(a_1,a_2) fNeur_1.ww[(a_2)*max_nLayers_ + a_1 - 7] 586 if (*iii == *maxcycle) {
594 #define delta_ref(a_1,a_2,a_3) fDel_1.delta[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 595 #define deltaww_ref(a_1,a_2) fNeur_1.deltaww[(a_2)*max_nLayers_ + a_1 - 7] 602 Int_t i__1, i__2, i__3;
605 Int_t nevod, layer, ktest, i1, nrest;
611 Lecev2(&ktest, tout2, tin2);
613 printf(
" .... strange to be here (1) ... \n");
617 for (layer = 1; layer <= i__1; ++layer) {
619 for (j = 1; j <= i__2; ++j) {
621 i__3 =
fNeur_1.neuron[layer - 1];
622 for (i__ = 1; i__ <= i__3; ++i__) {
636 Int_t num = i__3/100;
638 for (i1 = 1; i1 <= i__3; ++i1) {
640 if ( ( num>0 && (i1-1)%num == 0) || (i1 == i__3) ) timer.
DrawProgressBar( i1-1 );
643 for (i__ = 1; i__ <= i__2; ++i__) {
704 if (
fParam_1.layerm > max_nLayers_) {
706 printf(
"Error: number of layers exceeds maximum: %i, %i ==> abort",
708 Arret(
"modification of mlpl3_param_lim.inc is needed ");
712 printf(
"Error: number of training events exceeds maximum: %i, %i ==> abort",
714 Arret(
"modification of mlpl3_param_lim.inc is needed ");
717 printf(
"Error: number of testing events exceeds maximum: %i, %i ==> abort",
719 Arret(
"modification of mlpl3_param_lim.inc is needed ");
723 printf(
"Error: wrong number of classes at ouput layer: %i != %i ==> abort\n",
725 Arret(
"problem needs to reported ");
729 printf(
"Error: number of variables exceeds maximum: %i, %i ==> abort",
731 Arret(
"modification of mlpl3_param_lim.inc is needed");
734 for (i__ = 1; i__ <= i__1; ++i__) {
735 if (
fNeur_1.neuron[i__ - 1] > max_nNodes_) {
737 printf(
"Error: number of neurons at layer exceeds maximum: %i, %i ==> abort",
742 printf(
" .... strange to be here (2) ... \n");
747 #define y_ref(a_1,a_2) fNeur_1.y[(a_2)*max_nLayers_ + a_1 - 7] 762 for (i__ = 1; i__ <= i__1; ++i__) {
765 for (j = 1; j <= i__2; ++j) {
766 if (
fVarn_1.nclass[i__ - 1] == j) {
774 c__ +=
fDel_1.coef[j - 1] * (d__1 * d__1);
784 #define w_ref(a_1,a_2,a_3) fNeur_1.w[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 785 #define ww_ref(a_1,a_2) fNeur_1.ww[(a_2)*max_nLayers_ + a_1 - 7] 794 Int_t jmax, k, layer, kk, nq, nr;
799 for (layer = 1; layer <= i__1; ++layer) {
800 nq =
fNeur_1.neuron[layer] / 10;
801 nr =
fNeur_1.neuron[layer] - nq * 10;
809 for (k = 1; k <= i__2; ++k) {
812 if (
fNeur_1.neuron[layer] < jmax) {
835 ret_val = aaa * (
Double_t) (*i__) + bbb;
839 #define y_ref(a_1,a_2) fNeur_1.y[(a_2)*max_nLayers_ + a_1 - 7] 856 Int_t nko[max_nNodes_], nok[max_nNodes_];
865 for (i__ = 1; i__ <= i__1; ++i__) {
872 for (i__ = 1; i__ <= i__1; ++i__) {
875 for (j = 1; j <= i__2; ++j) {
877 if (
fVarn_1.nclass[i__ - 1] == j) {
893 for (j = 1; j <= i__1; ++j) {
894 xmok[j - 1] /= (
Double_t) nok[j - 1];
895 xmko[j - 1] /= (
Double_t) nko[j - 1];
896 fNeur_1.cut[j - 1] = (xmok[j - 1] + xmko[j - 1]) / 2.;
917 static Int_t fg_i1 = 3823;
918 static Int_t fg_i2 = 4006;
919 static Int_t fg_i3 = 2903;
922 Int_t k3, l3, k2, l2, k1, l1;
927 k2 = fg_i2 * j3 + fg_i3 * j2 + l3;
929 k1 = fg_i1 * j3 + fg_i2 * j2 + fg_i3 * j1 + l2;
931 fg_i1 = k1 - l1 * m12;
932 fg_i2 = k2 - l2 * m12;
933 fg_i3 = k3 - l3 * m12;
946 if (*u /
fDel_1.temp[*i__ - 1] > 170.) {
947 *f = .99999999989999999;
949 else if (*u /
fDel_1.temp[*i__ - 1] < -170.) {
950 *f = -.99999999989999999;
954 *f = (1. - yy) / (yy + 1.);
960 #define y_ref(a_1,a_2) fNeur_1.y[(a_2)*max_nLayers_ + a_1 - 7] 975 for (i__ = 1; i__ <= i__1; ++i__) {
978 for (j = 1; j <= i__2; ++j) {
979 if (
fVarn_1.mclass[i__ - 1] == j) {
987 c__ +=
fDel_1.coef[j - 1] * (d__1 * d__1);
996 #define xx_ref(a_1,a_2) fVarn3_1(a_1,a_2) 1021 for (i__ = 1; i__ <= i__1; ++i__) {
1023 xpg, &
fVarn_1.mclass[i__ - 1], &ikend);
1030 for (j = 1; j <= i__2; ++j) {
1031 xx_ref(i__, j) = xpg[j - 1];
1036 for (i__ = 1; i__ <= i__1; ++i__) {
1038 for (l = 1; l <= i__2; ++
l) {
1055 #define w_ref(a_1,a_2,a_3) fNeur_1.w[((a_3)*max_nNodes_ + (a_2))*max_nLayers_ + a_1 - 187] 1056 #define x_ref(a_1,a_2) fNeur_1.x[(a_2)*max_nLayers_ + a_1 - 7] 1057 #define y_ref(a_1,a_2) fNeur_1.y[(a_2)*max_nLayers_ + a_1 - 7] 1058 #define ww_ref(a_1,a_2) fNeur_1.ww[(a_2)*max_nLayers_ + a_1 - 7] 1059 #define xx_ref(a_1,a_2) fVarn3_1(a_1,a_2) 1066 Int_t i__1, i__2, i__3;
1073 for (i__ = 1; i__ <= i__1; ++i__) {
1077 for (layer = 1; layer <= i__1; ++layer) {
1079 for (j = 1; j <= i__2; ++j) {
1080 x_ref(layer + 1, j) = 0.;
1081 i__3 =
fNeur_1.neuron[layer - 1];
1082 for (i__ = 1; i__ <= i__3; ++i__) {
1084 *
w_ref(layer + 1, j, i__);
void Foncf(Int_t *i__, Double_t *u, Double_t *f)
#define w_ref(a_1, a_2, a_3)
MsgLogger & Endl(MsgLogger &ml)
struct TMVA::MethodCFMlpANN_Utils::@180 fVarn_1
static const Int_t fg_max_nVar_
Double_t Fdecroi(Int_t *i__)
[smart comments to be added]
#define del_ref(a_1, a_2)
void Entree_new(Int_t *, char *, Int_t *ntrain, Int_t *ntest, Int_t *numlayer, Int_t *nodes, Int_t *numcycle, Int_t)
void Wini()
[smart comments to be added]
virtual Int_t DataInterface(Double_t *, Double_t *, Int_t *, Int_t *, Int_t *, Int_t *, Double_t *, Int_t *, Int_t *)=0
struct TMVA::MethodCFMlpANN_Utils::@183 fCost_1
void En_avant(Int_t *ievent)
[smart comments to be added]
void TestNN()
[smart comments to be added]
void Cout(Int_t *, Double_t *xxx)
[smart comments to be added]
struct TMVA::MethodCFMlpANN_Utils::@182 fDel_1
void Out(Int_t *iii, Int_t *maxcycle)
void En_arriere(Int_t *ievent)
[smart comments to be added]
#define xeev_ref(a_1, a_2)
void Cout2(Int_t *, Double_t *yyy)
[smart comments to be added]
void GraphNN(Int_t *ilearn, Double_t *, Double_t *, char *, Int_t)
[smart comments to be added]
void Train_nn(Double_t *tin2, Double_t *tout2, Int_t *ntrain, Int_t *ntest, Int_t *nvar2, Int_t *nlayer, Int_t *nodes, Int_t *ncycle)
void Inl()
[smart comments to be added]
#define delta_ref(a_1, a_2, a_3)
void Leclearn(Int_t *ktest, Double_t *tout2, Double_t *tin2)
[smart comments to be added]
MethodCFMlpANN_Utils()
default constructor
void En_avant2(Int_t *ievent)
[smart comments to be added]
void Create(Int_t nevt, Int_t nvar)
void Lecev2(Int_t *ktest, Double_t *tout2, Double_t *tin2)
[smart comments to be added]
static const Int_t fg_max_nNodes_
Implementation of Clermond-Ferrand artificial neural network.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
struct TMVA::MethodCFMlpANN_Utils::@181 fNeur_1
void Innit(char *det, Double_t *tout2, Double_t *tin2, Int_t)
void Arret(const char *mot)
class TMVA::MethodCFMlpANN_Utils::VARn2 fVarn3_1
struct TMVA::MethodCFMlpANN_Utils::@179 fParam_1
double f2(const double *x)
class TMVA::MethodCFMlpANN_Utils::VARn2 fVarn2_1
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
#define delw_ref(a_1, a_2, a_3)
Double_t Sen3a(void)
[smart comments to be added]
virtual ~MethodCFMlpANN_Utils()
Destructor.
void CollectVar(Int_t *nvar, Int_t *class__, Double_t *xpg)
[smart comments to be added]
Timing information for training and evaluation of MVA methods.
#define deltaww_ref(a_1, a_2)
#define delww_ref(a_1, a_2)
static const char *const fg_MethodName