Hi, I try TMVAClassification with two Prepare…:
- sprintf(Stringa,“nTrain_Signal=%d:nTrain_Background=%d:nTest_Signal=0:nTest_Background=0:SplitMode=Random:NormMode=NumEvents:!V”, nTrainSVar, nTrainBVar);
dataloader->PrepareTrainingAndTestTree( mycuts, mycutb, Stringa);
- dataloader->PrepareTrainingAndTestTree( mycutb, nTrainSVar, nTrainBVar, 0, 0, “SplitMode=Random:NormMode=NumEvents:!V”);
And I got different results, is it normal ?
That looks like it should be expected. You are using two different cut setups. In 1) you place a cut on both signal and background while in 2) you only cut on background.
So do I understand correctly then that your variables
mycutb are both equal to
"" (or equivalently
Other than that difference the two calls are equivalent. In fact, in 2) and internal option string in constructed that is exactly the one in 1). In this case, no, different behaviour is not expected.
Exact but I find differences : this is the problem …tmva3.pdf (839.6 KB)
If I understand your presentation correctly you find differences in the output of 3 classifiers (consistent over both runs), namely DNN_CPU, DNN_GPU and TMlpANN.
It might be the case (can’t remember the details from the top of my head) that these methods have inherent randomness (I think e.g. the DNN uses “hogwild” parallelisation i.e. the gradients is updated non-deterministically). Could you verify that you get identical output when you run either option 1) or 2) two times in a row?
When using the DNN you will not get the same results, because of different weight initialisation and different batch ordering when training.
If you want reproducible result, this is possible In the coming release 6.16 when using the new MethodDL,
TMVA::Types::kDL , by typing TCpu<Double_t>::SetRandomSeed(seed)
I would like to share my experience with randomness in TMVA training output (using TMlpANN algorithm), Lorenzo pointed out.
What I found interesting was to run a handful of training and then compute for each event the distribution of the classifiers normalized by the cut value of each training.
In that case, normalized classifiers above(below) 1 are cut(not cut) or vice versa depending which side is cut…
One realizes that a given event can be cut for some trainings and not cut for others due to this random initialization of the weights.
By doing so, I think one is able to study the robustness of the TMVA algorithm, which is particularly interesting for noisy data.