diff --git a/Utils/XSM/MLP/Generate/Generate_XSM.cxx b/Utils/XSM/MLP/Generate/Generate_XSM.cxx index 72c1b525d5e7773b77bf57b205a79698bbc1e487..f241ca401c0780dbd29a2ae037330cdc5b0b678f 100644 --- a/Utils/XSM/MLP/Generate/Generate_XSM.cxx +++ b/Utils/XSM/MLP/Generate/Generate_XSM.cxx @@ -97,10 +97,14 @@ int main(int argc, char ** argv){ } ProgressBar(1,1); - FillMapName(); - DumpInputNeuron("_tmp/include_Train_XS/TrainingInput.root"); - Generate_tmva_factory_input(); + + cout << "Proportion of data to be used for training ? [0-100]" <<endl; + double ProportionOfTraining = 0 ; + cin >> ProportionOfTraining ; + DumpInputNeuron("_tmp/include_Train_XS/TrainingInput.root"); + Generate_tmva_factory_input(ProportionOfTraining); + CreateInfoFile(); cout << "â•─────────────────────────────────────────────────────────────────────╮" << endl; @@ -446,14 +450,18 @@ void FillMapName() } //-------------------------------------------------------------------------------------------------- -void Generate_tmva_factory_input() +void Generate_tmva_factory_input(double ProportionOfTraining) { + ofstream InputNetwork("_tmp/include_Train_XS/InputVariables.cxx"); for(map<ZAI,string>::iterator it = fMapName.begin() ; it != fMapName.end() ; it++ ) InputNetwork <<"factory->AddVariable( \"" << it->second << "\" , \"" << it->second << "\", \"IsotopicFraction\", 'F' );"<<endl; - InputNetwork <<"factory->AddVariable( \"Time\" , \"Time\" , \"seconds\", 'F' );"<<endl; - InputNetwork.close(); + InputNetwork <<"factory->AddVariable( \"Time\" , \"Time\" , \"seconds\", 'F' );"<<endl<<endl; + + ProportionOfTraining /=100; + InputNetwork <<"double PropTraining = "<< ProportionOfTraining << endl; + InputNetwork.close(); } //-------------------------------------------------------------------------------------------------- diff --git a/Utils/XSM/MLP/Generate/Train_XS.cxx b/Utils/XSM/MLP/Generate/Train_XS.cxx index ff19949aa8b65ed777282b527277bebc49181593..f54c9d10718d347a5f19b20a57dc11b3e4151071 100644 --- a/Utils/XSM/MLP/Generate/Train_XS.cxx +++ b/Utils/XSM/MLP/Generate/Train_XS.cxx @@ -106,9 +106,15 @@ void Train_XS_Time(int INDICE) // Apply additional cuts on the signal and background samples (can be different) TCut mycut = ""; // for example: TCut mycut = "abs(var1)<0.5 && abs(var2-0.5)<1"; + Long64_t NEvents = regTree->GetEntries(); + Long64_t NTraining = PropTraining * NEvents ; + Long64_t NTesting = NEvents - NTraining ; + + std::stringstream Samples_Parameters ; + Samples_Parameters << "nTrain_Regression=" << NTraining <<":"<< "nTest_Regression=" << NTesting <<":SplitMode=Random:NormMode=NumEvents:!V"; + // tell the factory to use all remaining events in the trees after training for testing: - factory->PrepareTrainingAndTestTree( mycut, - "nTrain_Regression=0:nTest_Regression=0:SplitMode=Random:NormMode=NumEvents:!V" ); + factory->PrepareTrainingAndTestTree( mycut, Samples_Parameter.str() ); // If no numbers of events are given, half of the events in the tree are used // for training, and the other half for testing: @@ -122,7 +128,7 @@ void Train_XS_Time(int INDICE) // "...:CutRangeMin[2]=-1:CutRangeMax[2]=1"...", where [2] is the third input variable std::stringstream Name; - Name<< OUTPUT[INDICE]; + Name << OUTPUT[INDICE]; // Neural network (MLP) factory->BookMethod( TMVA::Types::kMLP, Name.str().c_str(), "!H:!V:VarTransform=Norm:NeuronType=tanh:NCycles=20000:HiddenLayers=N,N:TestRate=6:TrainingMethod=BFGS:Sampling=0.3:SamplingEpoch=0.8:ConvergenceImprove=1e-6:ConvergenceTests=15:!UseRegulator" ); diff --git a/Utils/XSM/MLP/Generate/include/Generate_XSM.hxx b/Utils/XSM/MLP/Generate/include/Generate_XSM.hxx index 5057cd3b1a00114b40c6e06483fdd0a90fb453ae..200b25cf91f85b580d886d3449c61386ea6c8b40 100644 --- a/Utils/XSM/MLP/Generate/include/Generate_XSM.hxx +++ b/Utils/XSM/MLP/Generate/include/Generate_XSM.hxx @@ -68,7 +68,7 @@ void Run_Sequential(); /* PRINT INFO */ void PrintFinalSteps(); -void Generate_tmva_factory_input(); +void Generate_tmva_factory_input(double ProportionOfTraining); /* SCRIPT GENERATION */ void GenerateScript_Parallel(int threads); diff --git a/Utils/cgui/html/__init__.pyc b/Utils/cgui/html/__init__.pyc index 21f5311380d76192cd164204a4940c1be178f634..8159a1886485e300be9e536568a2eb68fc16252f 100644 Binary files a/Utils/cgui/html/__init__.pyc and b/Utils/cgui/html/__init__.pyc differ diff --git a/Utils/cgui/html/backend.pyc b/Utils/cgui/html/backend.pyc index fc3f0a6847ee4f86cddf8c19843ba954d21b93c5..0e6798a87b752db8e18843a730a73842305229db 100644 Binary files a/Utils/cgui/html/backend.pyc and b/Utils/cgui/html/backend.pyc differ diff --git a/Utils/cgui/html/htmlHelper.pyc b/Utils/cgui/html/htmlHelper.pyc index b5e515edb14b87b70e5f90f020ce9ed8d7b275ec..2510b5a4e48791376c96bd1d9146d525373eba5b 100644 Binary files a/Utils/cgui/html/htmlHelper.pyc and b/Utils/cgui/html/htmlHelper.pyc differ diff --git a/Utils/cgui/html/model.pyc b/Utils/cgui/html/model.pyc index 88f5e87b3412035d3f5fa06275934bd57de88310..a60ed5e549f50a46c2a4ff8312be46450f579b37 100644 Binary files a/Utils/cgui/html/model.pyc and b/Utils/cgui/html/model.pyc differ