Hello roottalkers,
I have a simple question about using the mlp
(MultiLayerPercepteron). (Searching the roottalk archives
I confirm that was not asked before.)
I have sucessfully used the template example mlpHiggs in
the ROOT tutorials to obtain and save my own mlp in C++ file:
…
mlp->Train(ntrain, “text,graph,update=10”);
mlp->Export(“p2e_mpl”,“C++”);
…
Now, I want to use this saved function p2e_mlp in the different
root program (and , eventually, in a different, compiled
C++ program …)
I am a C++ novice, so you can save me some time in
pointing my mistake (though I should be able, eventually,
to figure it myself ;8-).
So, now I have a root program like
…
#include "p2e_mlp.C
…
void dataPEN(){
Double_t params[7];
…
// calculate params
…
params[0] = int1;
params[1] = int2;
params[2] = int3;
params[3] = int4;
params[4] = int5;
params[5] = tf_degr;
params[6] = npeaks;
if ( p2e_mlp::value(0,params) > 0.5 ) {
h111->Draw();
…
}
…
}
But that is apparently the wrong syntax, or something is not
decleared right … I try several other posibilities like
if ( p2e_mlp(0,params) > 0.5 ) or
if ( p2e_mlp->value(0,params) > 0.5 )
but that also does not work, the error message is, of course,
…
CINT/ROOT C/C++ Interpreter version 5.16.5, November 30 2005
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
Processing dataPEN.C…
run 60730 1
Error: Function value(0,params) is not defined in current scope dataPEN.C:316:
Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered *
So, what is a correct syntax for using the saved/exported
mlp file in a separate C++/root program?
Thanks in advance, Emil
P.S. My function p2e_mlp is saved in file p2e_mlp.C
double p2e_mlp::value(int index,double in0,double in1,double in2,double in3,double in4,double in5) {
input0 = (in0 - 0)/1;
input1 = (in1 - 0)/1;
input2 = (in2 - 0)/1;
input3 = (in3 - 0)/1;
input4 = (in4 - 0)/1;
input5 = (in5 - 0)/1;
switch(index) {
case 0:
return ((neuron0xb64e328()*1)+0);
default:
return 0.;
}
}