This weeks included a lot of debugging, making a new pytonic interface for TMVA, making tutorial notebooks and writing documentation.

These weeks first I worked on interactive training mode, this needed a lot of debugging. First there was a problem related to pyroot and GIL, this was fixed by Enric. The bigger problem which took a lot of time was that the output streams in TMVA are atomic type, which caused a crash if in python the main thread was free. The reason of this was that jupyter use tornado, which IO loop will restart on main thread periodically and will flush the output. But the output stream is an atomic type, which is not consistent with this flushing. This caused a crash. To solve the problem, I made a loop in main thread, which refreshes the plot and keep the main thread busy so there won’t be conflict with atomic output stream.

Also made some wrapper function for TMVA basic functions (these functions are changed to the wrapper function when we activate jsmva). The new wrapper functions provide a new, user friendly interface, where instead of using long option string, we can pass the settings to functions by named variables.

List of changed functions:

1) Factory constructor:

Old version:

   factory = TMVA.Factory( "TMVAClassification", outputFile,
   "!V:Color:DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType=Classification")
   

New version:

   factory = TMVA.Factory(JobName="TMVAClassification", TargetFile=outputFile,
  V=False, Color=True, DrawProgressBar=True, Transformations=["I", "D", "P", "G", "D"], AnalysisType="Classification")
   

2) DataLoader::PrepareTrainingAndTestTree: new version

loader.PrepareTrainingAndTestTree(SigCut=mycuts, BkgCut=mycutb,
nTrain_Signal=0, nTrain_Background=0, SplitMode="Random", NormMode="NumEvents", V=False)

3) Factory::BookMethod: new version

factory.BookMethod( DataLoader=loader, Method=TMVA.Types.kMLP, MethodTitle="MLP", 
H=False, V=False, NeuronType="tanh", VarTransform="N", NCycles=600, HiddenLayers="N+5", TestRate=5, UseRegulator=False )

4) Factory::CrossValidation: new version

factory.CrossValidate(DataLoader=loader, Method=TMVA.Types.kBDT, MethodTitle="BDT", V=False, NTrees=2, MinNodeSize="2.5%", MaxDepth=1, BoostType="AdaBoost", AdaBoostBeta=0.5, UseBaggedBoost=False, BaggedSampleFraction=0.5, SeparationType="GiniIndex", nCuts=2, optParams=False)

5) Factory::EvaluateImportance: new version

factory.EvaluateImportance(DataLoader=loader,VIType=0, Method=TMVA.Types.kBDT, MethodTitle="BDT", V=False,NTrees=5, MinNodeSize="2.5%",MaxDepth=2, BoostType="AdaBoost", AdaBoostBeta=0.5, UseBaggedBoost=True, BaggedSampleFraction=0.5, SeparationType="GiniIndex", nCuts=20 )

I also documented the python code, it’s available here.

Also made tutorial notebooks ( on binder).