I am using TMVA.Factory() to train/test/evaluate a DNN in Python. I was wondering how to clear the histograms stored in the associated Results object created by factory.
More specifically, I get issues when iterating over the TrainAllMethods(), TestAllMethods() and EvaluateAllMethods(). In the second iteration, when I try running EvaluateAllMethods(), I get the following error:
FATAL: Alias MVA_S already exists in results storage
and when I try to run TMVA.Results.Delete(), I get the error:
unbound method TMVA::Results::Delete must be called with a TMVA::Results instance as first argument
but I am unable to find where the Results class is instantiated by Factory. I essentially want to use the function defined here for the results produced by Factory training/testing done in python.
I can reproduce this problem running again the Training/Test/Evaluation using the same method and same dataset. I will investigate it, but I would like to understand it better what is your use case to run again the training/testing workflow ?
Hi,
I have investigate this and the solution for having a second iteration of Train/Test/Evaluate is the following:
you need to create a new TMVA::Factory instance, but you can use the previously existing data loader. This is needed to have a new ROOT output file for the new training/test results
book again your TMVA method
delete the existing Results() if you are re-using the DataLoader
For deleting the Results class you should do as following:
auto data = dataloader->GetDataSetInfo().GetDataSet();
data->DeleteAllResults(TMVA::Types::kTraining, TMVA::Types::kClassification);
data->DeleteAllResults(TMVA::Types::kTesting, TMVA::Types::kClassification);