root icon indicating copy to clipboard operation
root copied to clipboard

[TMVA][ROOT Storage] Root Storage of BDT

Open sanjibansg opened this issue 3 years ago • 7 comments

This Pull request introduces the Root Storage for BDT.
Initially developed by @guitargeek(https://github.com/guitargeek/tmva-to-xgboost/) this PR implements the data structure for storing the model configuration & weights, Parse function for translating a TMVA BDT .xml file, and a mapping interface for generating inference code.

Progress

  • [x] Data structure for storing model configuration and weights
  • [x] Serialization of the class for writing/reading to .root files
  • [x] Parse() function for translating a TMVA BDT .xml file
  • [ ] Mapping Interface to TMVA Tree Inference for generating inference code

Checklist:

  • [x] tested changes for Parse()

sanjibansg avatar Aug 20 '21 12:08 sanjibansg

Can one of the admins verify this patch?

phsft-bot avatar Aug 20 '21 12:08 phsft-bot

DeepCode's analysis on #b8067c found:

  • :warning: 1 warning :point_down:

Top issues

Description Example fixes
Missing check is_open on std::ifstream before calling seekg on it. Occurrences: :wrench: Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot

👉 The DeepCode service and API will be deprecated in August, 2021. Here is the information how to migrate. Thank you for using DeepCode 🙏 ❤️ !

If you are using our plugins, you might be interested in their successors: Snyk's JetBrains plugin and Snyk's VS Code plugin.

ghost avatar Aug 20 '21 12:08 ghost

@phsft-bot build

lmoneta avatar Aug 23 '21 09:08 lmoneta

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14 How to customize builds

phsft-bot avatar Aug 23 '21 09:08 phsft-bot

Build failed on ROOT-ubuntu16/nortcxxmod. Running on sft-ubuntu-1604-1.cern.ch:/build/workspace/root-pullrequests-build See console output.

Errors:

  • [2021-08-23T09:51:46.668Z] FAILED: cd /mnt/build/workspace/root-pullrequests-build/build/tmva/tmva && /usr/bin/cmake -E env LD_LIBRARY_PATH=/mnt/build/workspace/root-pullrequests-build/build/lib: ROOTIGNOREPREFIX=1 /mnt/build/workspace/root-pullrequests-build/build/bin/rootcling -rootbuild -v2 -f G__TMVA.cxx -s /mnt/build/workspace/root-pullrequests-build/build/lib/libTMVA.so -m libTreePlayer_rdict.pcm -m libTree_rdict.pcm -m libHist_rdict.pcm -m libMatrix_rdict.pcm -m libMinuit_rdict.pcm -m libMLP_rdict.pcm -m libMathCore_rdict.pcm -m libCore_rdict.pcm -m libRIO_rdict.pcm -m libXMLIO_rdict.pcm -m libROOTDataFrame_rdict.pcm -m libROOTVecOps_rdict.pcm -m libImt_rdict.pcm -excludePath /mnt/build/workspace/root-pullrequests-build/root -excludePath /mnt/build/workspace/root-pullrequests-build/build/ginclude -excludePath /mnt/build/workspace/root-pullrequests-build/build/externals -excludePath /mnt/build/workspace/root-pullrequests-build/build/builtins -rml libTMVA.so -rmf /mnt/build/workspace/root-pullrequests-build/build/lib/libTMVA.rootmap -writeEmptyRootPCM -DVECCORE_ENABLE_VC -I/mnt/build/workspace/root-pullrequests-build/build/include -I/usr/include -I/mnt/build/workspace/root-pullrequests-build/root/tmva/tmva/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/unix/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clingutils/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/textinput/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/thread/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/zip/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/rint/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/meta/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/gui/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/cont/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/inc -I/mnt/build/workspace/root-pullrequests-build/build/ginclude -I/mnt/build/workspace/root-pullrequests-build/root/tree/treeplayer/inc -I/mnt/build/workspace/root-pullrequests-build/root/hist/hist/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/imt/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/multiproc/inc -I/mnt/build/workspace/root-pullrequests-build/build/externals//mnt/build/workspace/root-pullrequests-build/install/include -I/mnt/build/workspace/root-pullrequests-build/root/math/matrix/inc -I/mnt/build/workspace/root-pullrequests-build/root/tree/tree/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/minuit/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mlp/inc -I/mnt/build/workspace/root-pullrequests-build/root/io/io/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/res -I/mnt/build/workspace/root-pullrequests-build/root/builtins -I/mnt/build/workspace/root-pullrequests-build/root/io/xml/inc -I/mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/vecops/inc -I/usr/include -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/gpad/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/graf/inc -I/mnt/build/workspace/root-pullrequests-build/root/net/net/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf3d/g3d/inc TMVA/BDTEventWrapper.h TMVA/BinarySearchTree.h TMVA/BinarySearchTreeNode.h TMVA/BinaryTree.h TMVA/CCPruner.h TMVA/CCTreeWrapper.h TMVA/Classification.h TMVA/ClassifierFactory.h TMVA/ClassInfo.h TMVA/Config.h TMVA/Configurable.h TMVA/ConvergenceTest.h TMVA/CostComplexityPruneTool.h TMVA/CrossEntropy.h TMVA/CrossValidation.h TMVA/CvSplit.h TMVA/DataInputHandler.h TMVA/DataLoader.h TMVA/DataSetFactory.h TMVA/DataSet.h TMVA/DataSetInfo.h TMVA/DataSetManager.h TMVA/DecisionTree.h TMVA/DecisionTreeNode.h TMVA/Envelope.h TMVA/Event.h TMVA/ExpectedErrorPruneTool.h TMVA/Executor.h TMVA/Factory.h TMVA/FitterBase.h TMVA/GeneticAlgorithm.h TMVA/GeneticFitter.h TMVA/GeneticGenes.h TMVA/GeneticPopulation.h TMVA/GeneticRange.h TMVA/GiniIndex.h TMVA/GiniIndexWithLaplace.h TMVA/HyperParameterOptimisation.h TMVA/IFitterTarget.h TMVA/IMethod.h TMVA/Interval.h TMVA/IPruneTool.h TMVA/KDEKernel.h TMVA/LDA.h TMVA/LogInterval.h TMVA/LossFunction.h TMVA/MCFitter.h TMVA/MethodANNBase.h TMVA/MethodBase.h TMVA/MethodBayesClassifier.h TMVA/MethodBDT.h TMVA/MethodBoost.h TMVA/MethodCategory.h TMVA/MethodCFMlpANN_def.h TMVA/MethodCFMlpANN.h TMVA/MethodCFMlpANN_Utils.h TMVA/MethodCompositeBase.h TMVA/MethodCrossValidation.h TMVA/MethodCuts.h TMVA/MethodDL.h TMVA/MethodDNN.h TMVA/MethodDT.h TMVA/MethodFDA.h TMVA/MethodFisher.h TMVA/MethodHMatrix.h TMVA/MethodKNN.h TMVA/MethodLD.h TMVA/MethodLikelihood.h TMVA/MethodMLP.h TMVA/MethodPDEFoam.h TMVA/MethodPDERS.h TMVA/MethodRuleFit.h TMVA/MethodSVM.h TMVA/MethodTMlpANN.h TMVA/MinuitFitter.h TMVA/MinuitWrapper.h TMVA/MisClassificationError.h TMVA/ModulekNN.h TMVA/Monitoring.h TMVA/MsgLogger.h TMVA/NeuralNet.h TMVA/Node.h TMVA/NodekNN.h TMVA/OptimizeConfigParameters.h TMVA/Option.h TMVA/OptionMap.h TMVA/Pattern.h TMVA/PDEFoamCell.h TMVA/PDEFoamDecisionTreeDensity.h TMVA/PDEFoamDecisionTree.h TMVA/PDEFoamDensityBase.h TMVA/PDEFoamDiscriminantDensity.h TMVA/PDEFoamDiscriminant.h TMVA/PDEFoamEventDensity.h TMVA/PDEFoamEvent.h TMVA/PDEFoam.h TMVA/PDEFoamKernelBase.h TMVA/PDEFoamKernelGauss.h TMVA/PDEFoamKernelLinN.h TMVA/PDEFoamKernelTrivial.h TMVA/PDEFoamMultiTarget.h TMVA/PDEFoamTargetDensity.h TMVA/PDEFoamTarget.h TMVA/PDEFoamVect.h TMVA/PDF.h TMVA/QuickMVAProbEstimator.h TMVA/Ranking.h TMVA/Reader.h TMVA/RegressionVariance.h TMVA/ResultsClassification.h TMVA/Results.h TMVA/ResultsMulticlass.h TMVA/ResultsRegression.h TMVA/ROCCalc.h TMVA/ROCCurve.h TMVA/RootFinder.h TMVA/RuleCut.h TMVA/RuleEnsemble.h TMVA/RuleFitAPI.h TMVA/RuleFit.h TMVA/RuleFitParams.h TMVA/Rule.h TMVA/SdivSqrtSplusB.h TMVA/SeparationBase.h TMVA/SimulatedAnnealingFitter.h TMVA/SimulatedAnnealing.h TMVA/SVEvent.h TMVA/SVKernelFunction.h TMVA/SVKernelMatrix.h TMVA/SVWorkingSet.h TMVA/TActivationChooser.h TMVA/TActivation.h TMVA/TActivationIdentity.h TMVA/TActivationRadial.h TMVA/TActivationReLU.h TMVA/TActivationSigmoid.h TMVA/TActivationTanh.h TMVA/Timer.h TMVA/TNeuron.h TMVA/TNeuronInputAbs.h TMVA/TNeuronInputChooser.h TMVA/TNeuronInput.h TMVA/TNeuronInputSqSum.h TMVA/TNeuronInputSum.h TMVA/Tools.h TMVA/TrainingHistory.h TMVA/TransformationHandler.h TMVA/TSpline1.h TMVA/TSpline2.h TMVA/TSynapse.h TMVA/Types.h TMVA/VariableDecorrTransform.h TMVA/VariableGaussTransform.h TMVA/VariableIdentityTransform.h TMVA/VariableImportance.h TMVA/VariableInfo.h TMVA/VariableNormalizeTransform.h TMVA/VariablePCATransform.h TMVA/VariableRearrangeTransform.h TMVA/VariableTransformBase.h TMVA/VariableTransform.h TMVA/VarTransformHandler.h TMVA/Version.h TMVA/Volume.h TMVA/TreeInference/PythonHelpers.hxx TMVA/TreeInference/BranchlessTree.hxx TMVA/TreeInference/Forest.hxx TMVA/TreeInference/Objectives.hxx TMVA/RootStorageBDT.h TMVA/RTensor.hxx TMVA/RTensorUtils.hxx TMVA/RStandardScaler.hxx TMVA/RReader.hxx TMVA/RInferenceUtils.hxx TMVA/RBDT.hxx /mnt/build/workspace/root-pullrequests-build/root/tmva/tmva/inc/LinkDef.h
  • [2021-08-23T09:51:46.668Z] /mnt/build/workspace/root-pullrequests-build/build/include/TMVA/RootStorageBDT.h:31:10: fatal error: 'optional' file not found

phsft-bot avatar Aug 23 '21 09:08 phsft-bot

Build failed on ROOT-debian10-i386/cxx14. Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build See console output.

Errors:

  • [2021-08-23T09:46:31.322Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-08-23T10:05:35.292Z] collect2: error: ld returned 1 exit status

phsft-bot avatar Aug 23 '21 10:08 phsft-bot

Removed review request because this is a dormant draft PR.

guitargeek avatar Sep 14 '22 09:09 guitargeek

Since the differences to my original repo are minimal, I think we don't lose much by closing this PR in order to clean up the list of open PRs a little bit.

I don't think there is much of a usecase either: the TMVA xml format for BDTs is becoming increasingly rare, and in any case it can already be evaluated with ROOT. Also, I don't really see why ROOT needs yet another intermediate BDT representation. Is the existing TMVA BDT evaluator that reads the XML files not good enough? Before introducing new data classes and increasing the maintenance burden even more, why not bring the existing classes up to speed (although I think the usecase is not strong enough to actually to this).

guitargeek avatar Apr 09 '24 00:04 guitargeek