{ "cells": [ { "cell_type": "markdown", "id": "d9509a51", "metadata": {}, "source": [ "# TMVAMulticlass\n", "This macro provides a simple example for the training and testing of the TMVA\n", "multiclass classification\n", "- Project : TMVA - a Root-integrated toolkit for multivariate data analysis\n", "- Package : TMVA\n", "- Root Macro: TMVAMulticlass\n", "\n", "\n", "\n", "**Author:** Andreas Hoecker \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:08 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "aec36c3a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:36.443230Z", "iopub.status.busy": "2026-05-19T20:08:36.443119Z", "iopub.status.idle": "2026-05-19T20:08:36.447407Z", "shell.execute_reply": "2026-05-19T20:08:36.446874Z" } }, "outputs": [], "source": [ "%%cpp -d\n", "#include \n", "#include \n", "#include \n", "#include \n", "\n", "#include \"TFile.h\"\n", "#include \"TTree.h\"\n", "#include \"TString.h\"\n", "#include \"TSystem.h\"\n", "#include \"TROOT.h\"\n", "\n", "\n", "#include \"TMVA/Tools.h\"\n", "#include \"TMVA/Factory.h\"\n", "#include \"TMVA/DataLoader.h\"\n", "#include \"TMVA/TMVAMultiClassGui.h\"\n", "\n", "\n", "using namespace TMVA;" ] }, { "cell_type": "markdown", "id": "1c58ac0b", "metadata": {}, "source": [ " Arguments are defined. " ] }, { "cell_type": "code", "execution_count": 2, "id": "7478d7e2", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:36.448713Z", "iopub.status.busy": "2026-05-19T20:08:36.448575Z", "iopub.status.idle": "2026-05-19T20:08:36.651054Z", "shell.execute_reply": "2026-05-19T20:08:36.650314Z" } }, "outputs": [], "source": [ "TString myMethodList = \"\";" ] }, { "cell_type": "markdown", "id": "bcef1974", "metadata": {}, "source": [ "This loads the library" ] }, { "cell_type": "code", "execution_count": 3, "id": "27d9664e", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:36.653181Z", "iopub.status.busy": "2026-05-19T20:08:36.653058Z", "iopub.status.idle": "2026-05-19T20:08:36.856223Z", "shell.execute_reply": "2026-05-19T20:08:36.855434Z" } }, "outputs": [], "source": [ "TMVA::Tools::Instance();" ] }, { "cell_type": "markdown", "id": "8edf22b9", "metadata": {}, "source": [ "to get access to the GUI and all tmva macros\n", "\n", "gROOT->ProcessLine(\"TMVA::TMVAMultiClassGui()\");" ] }, { "cell_type": "markdown", "id": "242893ae", "metadata": {}, "source": [ "---------------------------------------------------------------\n", "Default MVA methods to be trained + tested" ] }, { "cell_type": "code", "execution_count": 4, "id": "6c646f43", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:36.858090Z", "iopub.status.busy": "2026-05-19T20:08:36.857971Z", "iopub.status.idle": "2026-05-19T20:08:37.060901Z", "shell.execute_reply": "2026-05-19T20:08:37.060136Z" } }, "outputs": [], "source": [ "std::map Use;\n", "Use[\"MLP\"] = 1;\n", "Use[\"BDTG\"] = 1;\n", "#ifdef R__HAS_TMVAGPU\n", "Use[\"DL_CPU\"] = 1;\n", "Use[\"DL_GPU\"] = 1;\n", "#else\n", "Use[\"DL_CPU\"] = 1;\n", "Use[\"DL_GPU\"] = 0;\n", "#endif\n", "Use[\"FDA_GA\"] = 0;\n", "Use[\"PDEFoam\"] = 1;" ] }, { "cell_type": "markdown", "id": "181d97bf", "metadata": {}, "source": [ "---------------------------------------------------------------" ] }, { "cell_type": "code", "execution_count": 5, "id": "4a2f0332", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:37.062690Z", "iopub.status.busy": "2026-05-19T20:08:37.062546Z", "iopub.status.idle": "2026-05-19T20:08:37.265185Z", "shell.execute_reply": "2026-05-19T20:08:37.264527Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "==> Start TMVAMulticlass\n" ] } ], "source": [ "std::cout << std::endl;\n", "std::cout << \"==> Start TMVAMulticlass\" << std::endl;\n", "\n", "if (myMethodList != \"\") {\n", " for (std::map::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;\n", "\n", " std::vector mlist = TMVA::gTools().SplitString( myMethodList, ',' );\n", " for (UInt_t i=0; i::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << \" \";\n", " std::cout << std::endl;\n", " return;\n", " }\n", " Use[regMethod] = 1;\n", " }\n", "}" ] }, { "cell_type": "markdown", "id": "10c2f8b0", "metadata": {}, "source": [ "Create a new root output file." ] }, { "cell_type": "code", "execution_count": 6, "id": "1236d117", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:37.266719Z", "iopub.status.busy": "2026-05-19T20:08:37.266577Z", "iopub.status.idle": "2026-05-19T20:08:37.478538Z", "shell.execute_reply": "2026-05-19T20:08:37.477899Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- TMVAMulticlass: Using input file: /github/home/ROOT-CI/build/tutorials/machine_learning/data/tmva_multiclass_example.root\n", "DataSetInfo : [dataset] : Added class \"Signal\"\n", " : Add Tree TreeS of type Signal with 2000 events\n", "DataSetInfo : [dataset] : Added class \"bg0\"\n", " : Add Tree TreeB0 of type bg0 with 2000 events\n", "DataSetInfo : [dataset] : Added class \"bg1\"\n", " : Add Tree TreeB1 of type bg1 with 2000 events\n", "DataSetInfo : [dataset] : Added class \"bg2\"\n", " : Add Tree TreeB2 of type bg2 with 2000 events\n", " : Dataset[dataset] : Class index : 0 name : Signal\n", " : Dataset[dataset] : Class index : 1 name : bg0\n", " : Dataset[dataset] : Class index : 2 name : bg1\n", " : Dataset[dataset] : Class index : 3 name : bg2\n", "Factory : Booking method: \u001b[1mBDTG\u001b[0m\n", " : \n", " : the option NegWeightTreatment=InverseBoostNegWeights does not exist for BoostType=Grad\n", " : --> change to new default NegWeightTreatment=Pray\n", " : Rebuilding Dataset dataset\n", " : Building event vectors for type 2 Signal\n", " : Dataset[dataset] : create input formulas for tree TreeS\n", " : Building event vectors for type 2 bg0\n", " : Dataset[dataset] : create input formulas for tree TreeB0\n", " : Building event vectors for type 2 bg1\n", " : Dataset[dataset] : create input formulas for tree TreeB1\n", " : Building event vectors for type 2 bg2\n", " : Dataset[dataset] : create input formulas for tree TreeB2\n", "DataSetFactory : [dataset] : Number of events in input trees\n", " : \n", " : \n", " : \n", " : \n", " : Number of training and testing events\n", " : ---------------------------------------------------------------------------\n", " : Signal -- training events : 1000\n", " : Signal -- testing events : 1000\n", " : Signal -- training and testing events: 2000\n", " : bg0 -- training events : 1000\n", " : bg0 -- testing events : 1000\n", " : bg0 -- training and testing events: 2000\n", " : bg1 -- training events : 1000\n", " : bg1 -- testing events : 1000\n", " : bg1 -- training and testing events: 2000\n", " : bg2 -- training events : 1000\n", " : bg2 -- testing events : 1000\n", " : bg2 -- training and testing events: 2000\n", " : \n", "DataSetInfo : Correlation matrix (Signal):\n", " : ----------------------------------------\n", " : var1 var2 var3 var4\n", " : var1: +1.000 +0.385 +0.621 +0.838\n", " : var2: +0.385 +1.000 +0.698 +0.723\n", " : var3: +0.621 +0.698 +1.000 +0.849\n", " : var4: +0.838 +0.723 +0.849 +1.000\n", " : ----------------------------------------\n", "DataSetInfo : Correlation matrix (bg0):\n", " : ----------------------------------------\n", " : var1 var2 var3 var4\n", " : var1: +1.000 +0.413 +0.612 +0.833\n", " : var2: +0.413 +1.000 +0.728 +0.753\n", " : var3: +0.612 +0.728 +1.000 +0.855\n", " : var4: +0.833 +0.753 +0.855 +1.000\n", " : ----------------------------------------\n", "DataSetInfo : Correlation matrix (bg1):\n", " : ----------------------------------------\n", " : var1 var2 var3 var4\n", " : var1: +1.000 +0.423 +0.619 +0.846\n", " : var2: +0.423 +1.000 +0.705 +0.730\n", " : var3: +0.619 +0.705 +1.000 +0.855\n", " : var4: +0.846 +0.730 +0.855 +1.000\n", " : ----------------------------------------\n", "DataSetInfo : Correlation matrix (bg2):\n", " : ----------------------------------------\n", " : var1 var2 var3 var4\n", " : var1: +1.000 -0.658 +0.032 -0.004\n", " : var2: -0.658 +1.000 -0.000 +0.014\n", " : var3: +0.032 -0.000 +1.000 -0.048\n", " : var4: -0.004 +0.014 -0.048 +1.000\n", " : ----------------------------------------\n", "DataSetFactory : [dataset] : \n", " : \n", "Factory : Booking method: \u001b[1mMLP\u001b[0m\n", " : \n", "MLP : Building Network. \n", " : Initializing weights\n", "Factory : Booking method: \u001b[1mPDEFoam\u001b[0m\n", " : \n", "Factory : Booking method: \u001b[1mDL_CPU\u001b[0m\n", " : \n", " : Parsing option string: \n", " : ... \"!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:WeightInitialization=XAVIERUNIFORM:Architecture=GPU:Layout=TANH|100,TANH|50,TANH|10,LINEAR:TrainingStrategy=Optimizer=ADAM,LearningRate=1e-3,TestRepetitions=1,ConvergenceSteps=10,BatchSize=100,MaxEpochs=20\"\n", " : The following options are set:\n", " : - By User:\n", " : \n", " : - Default:\n", " : Boost_num: \"0\" [Number of times the classifier will be boosted]\n", " : Parsing option string: \n", " : ... \"!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:WeightInitialization=XAVIERUNIFORM:Architecture=GPU:Layout=TANH|100,TANH|50,TANH|10,LINEAR:TrainingStrategy=Optimizer=ADAM,LearningRate=1e-3,TestRepetitions=1,ConvergenceSteps=10,BatchSize=100,MaxEpochs=20\"\n", " : The following options are set:\n", " : - By User:\n", " : V: \"True\" [Verbose output (short form of \"VerbosityLevel\" below - overrides the latter one)]\n", " : VarTransform: \"N\" [List of variable transformations performed before training, e.g., \"D_Background,P_Signal,G,N_AllClasses\" for: \"Decorrelation, PCA-transformation, Gaussianisation, Normalisation, each for the given class of events ('AllClasses' denotes all events of all classes, if no class indication is given, 'All' is assumed)\"]\n", " : H: \"False\" [Print method-specific help message]\n", " : Layout: \"TANH|100,TANH|50,TANH|10,LINEAR\" [Layout of the network.]\n", " : ErrorStrategy: \"CROSSENTROPY\" [Loss function: Mean squared error (regression) or cross entropy (binary classification).]\n", " : WeightInitialization: \"XAVIERUNIFORM\" [Weight initialization strategy]\n", " : Architecture: \"GPU\" [Which architecture to perform the training on.]\n", " : TrainingStrategy: \"Optimizer=ADAM,LearningRate=1e-3,TestRepetitions=1,ConvergenceSteps=10,BatchSize=100,MaxEpochs=20\" [Defines the training strategies.]\n", " : - Default:\n", " : VerbosityLevel: \"Default\" [Verbosity level]\n", " : CreateMVAPdfs: \"False\" [Create PDFs for classifier outputs (signal and background)]\n", " : IgnoreNegWeightsInTraining: \"False\" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]\n", " : InputLayout: \"0|0|0\" [The Layout of the input]\n", " : BatchLayout: \"0|0|0\" [The Layout of the batch]\n", " : RandomSeed: \"0\" [Random seed used for weight initialization and batch shuffling]\n", " : ValidationSize: \"20%\" [Part of the training data to use for validation. Specify as 0.2 or 20% to use a fifth of the data set as validation set. Specify as 100 to use exactly 100 events. (Default: 20%)]\n", "DL_CPU : [dataset] : Create Transformation \"N\" with events from all classes.\n", " : \n", " : Transformation, Variable selection : \n", " : Input : variable 'var1' <---> Output : variable 'var1'\n", " : Input : variable 'var2' <---> Output : variable 'var2'\n", " : Input : variable 'var3' <---> Output : variable 'var3'\n", " : Input : variable 'var4' <---> Output : variable 'var4'\n", "\u001b[31m : CUDA backend not enabled. Please make sure you have CUDA installed and it was successfully detected by CMAKE by using -Dtmva-gpu=On \u001b[0m\n", " : Will now use instead the CPU architecture !\n", " : Will now use the CPU architecture with BLAS and IMT support !\n" ] } ], "source": [ "TString outfileName = \"TMVAMulticlass.root\";\n", "TFile* outputFile = TFile::Open( outfileName, \"RECREATE\" );\n", "\n", "TMVA::Factory *factory = new TMVA::Factory( \"TMVAMulticlass\", outputFile,\n", " \"!V:!Silent:Color:!DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType=multiclass\" );\n", "TMVA::DataLoader *dataloader=new TMVA::DataLoader(\"dataset\");\n", "\n", "dataloader->AddVariable( \"var1\", 'F' );\n", "dataloader->AddVariable( \"var2\", \"Variable 2\", \"\", 'F' );\n", "dataloader->AddVariable( \"var3\", \"Variable 3\", \"units\", 'F' );\n", "dataloader->AddVariable( \"var4\", \"Variable 4\", \"units\", 'F' );\n", "\n", "TFile *input(nullptr);\n", "TString fname = gROOT->GetTutorialDir() + \"/machine_learning/data/tmva_multiclass_example.root\";\n", "if (!gSystem->AccessPathName( fname )) {\n", " input = TFile::Open( fname ); // check if file in local directory exists\n", "}\n", "if (!input) {\n", " std::cout << \"ERROR: could not open data file\" << std::endl;\n", " exit(1);\n", "}\n", "std::cout << \"--- TMVAMulticlass: Using input file: \" << input->GetName() << std::endl;\n", "\n", "TTree *signalTree = (TTree*)input->Get(\"TreeS\");\n", "TTree *background0 = (TTree*)input->Get(\"TreeB0\");\n", "TTree *background1 = (TTree*)input->Get(\"TreeB1\");\n", "TTree *background2 = (TTree*)input->Get(\"TreeB2\");\n", "\n", "gROOT->cd( outfileName+TString(\":/\") );\n", "dataloader->AddTree (signalTree,\"Signal\");\n", "dataloader->AddTree (background0,\"bg0\");\n", "dataloader->AddTree (background1,\"bg1\");\n", "dataloader->AddTree (background2,\"bg2\");\n", "\n", "dataloader->PrepareTrainingAndTestTree( \"\", \"SplitMode=Random:NormMode=NumEvents:!V\" );\n", "\n", "if (Use[\"BDTG\"]) // gradient boosted decision trees\n", " factory->BookMethod( dataloader, TMVA::Types::kBDT, \"BDTG\", \"!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.10:UseBaggedBoost:BaggedSampleFraction=0.50:nCuts=20:MaxDepth=2\");\n", "if (Use[\"MLP\"]) // neural network\n", " factory->BookMethod( dataloader, TMVA::Types::kMLP, \"MLP\", \"!H:!V:NeuronType=tanh:NCycles=1000:HiddenLayers=N+5,5:TestRate=5:EstimatorType=MSE\");\n", "if (Use[\"FDA_GA\"]) // functional discriminant with GA minimizer\n", " factory->BookMethod( dataloader, TMVA::Types::kFDA, \"FDA_GA\", \"H:!V:Formula=(0)+(1)*x0+(2)*x1+(3)*x2+(4)*x3:ParRanges=(-1,1);(-10,10);(-10,10);(-10,10);(-10,10):FitMethod=GA:PopSize=300:Cycles=3:Steps=20:Trim=True:SaveBestGen=1\" );\n", "if (Use[\"PDEFoam\"]) // PDE-Foam approach\n", " factory->BookMethod( dataloader, TMVA::Types::kPDEFoam, \"PDEFoam\", \"!H:!V:TailCut=0.001:VolFrac=0.0666:nActiveCells=500:nSampl=2000:nBin=5:Nmin=100:Kernel=None:Compress=T\" );\n", "\n", "\n", "if (Use[\"DL_CPU\"]) {\n", " TString layoutString(\"Layout=TANH|100,TANH|50,TANH|10,LINEAR\");\n", " TString trainingStrategyString(\"TrainingStrategy=Optimizer=ADAM,LearningRate=1e-3,\"\n", " \"TestRepetitions=1,ConvergenceSteps=10,BatchSize=100,MaxEpochs=20\");\n", " TString nnOptions(\"!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:\"\n", " \"WeightInitialization=XAVIERUNIFORM:Architecture=GPU\");\n", " nnOptions.Append(\":\");\n", " nnOptions.Append(layoutString);\n", " nnOptions.Append(\":\");\n", " nnOptions.Append(trainingStrategyString);\n", " factory->BookMethod(dataloader, TMVA::Types::kDL, \"DL_CPU\", nnOptions);\n", "}\n", "if (Use[\"DL_GPU\"]) {\n", " TString layoutString(\"Layout=TANH|100,TANH|50,TANH|10,LINEAR\");\n", " TString trainingStrategyString(\"TrainingStrategy=Optimizer=ADAM,LearningRate=1e-3,\"\n", " \"TestRepetitions=1,ConvergenceSteps=10,BatchSize=100,MaxEpochs=20\");\n", " TString nnOptions(\"!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:\"\n", " \"WeightInitialization=XAVIERUNIFORM:Architecture=GPU\");\n", " nnOptions.Append(\":\");\n", " nnOptions.Append(layoutString);\n", " nnOptions.Append(\":\");\n", " nnOptions.Append(trainingStrategyString);\n", " factory->BookMethod(dataloader, TMVA::Types::kDL, \"DL_GPU\", nnOptions);\n", "}" ] }, { "cell_type": "markdown", "id": "d1ae1a98", "metadata": {}, "source": [ "Train MVAs using the set of training events" ] }, { "cell_type": "code", "execution_count": 7, "id": "53323f49", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:37.480087Z", "iopub.status.busy": "2026-05-19T20:08:37.479967Z", "iopub.status.idle": "2026-05-19T20:08:55.942549Z", "shell.execute_reply": "2026-05-19T20:08:55.941999Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Factory : \u001b[1mTrain all methods\u001b[0m\n", "Factory : [dataset] : Create Transformation \"I\" with events from all classes.\n", " : \n", " : Transformation, Variable selection : \n", " : Input : variable 'var1' <---> Output : variable 'var1'\n", " : Input : variable 'var2' <---> Output : variable 'var2'\n", " : Input : variable 'var3' <---> Output : variable 'var3'\n", " : Input : variable 'var4' <---> Output : variable 'var4'\n", "Factory : [dataset] : Create Transformation \"D\" with events from all classes.\n", " : \n", " : Transformation, Variable selection : \n", " : Input : variable 'var1' <---> Output : variable 'var1'\n", " : Input : variable 'var2' <---> Output : variable 'var2'\n", " : Input : variable 'var3' <---> Output : variable 'var3'\n", " : Input : variable 'var4' <---> Output : variable 'var4'\n", "Factory : [dataset] : Create Transformation \"P\" with events from all classes.\n", " : \n", " : Transformation, Variable selection : \n", " : Input : variable 'var1' <---> Output : variable 'var1'\n", " : Input : variable 'var2' <---> Output : variable 'var2'\n", " : Input : variable 'var3' <---> Output : variable 'var3'\n", " : Input : variable 'var4' <---> Output : variable 'var4'\n", "Factory : [dataset] : Create Transformation \"G\" with events from all classes.\n", " : \n", " : Transformation, Variable selection : \n", " : Input : variable 'var1' <---> Output : variable 'var1'\n", " : Input : variable 'var2' <---> Output : variable 'var2'\n", " : Input : variable 'var3' <---> Output : variable 'var3'\n", " : Input : variable 'var4' <---> Output : variable 'var4'\n", "Factory : [dataset] : Create Transformation \"D\" with events from all classes.\n", " : \n", " : Transformation, Variable selection : \n", " : Input : variable 'var1' <---> Output : variable 'var1'\n", " : Input : variable 'var2' <---> Output : variable 'var2'\n", " : Input : variable 'var3' <---> Output : variable 'var3'\n", " : Input : variable 'var4' <---> Output : variable 'var4'\n", "TFHandler_Factory : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.052185 1.0190 [ -4.0592 3.2645 ]\n", " : var2: 0.33312 1.0446 [ -3.6891 3.7877 ]\n", " : var3: 0.10463 1.1205 [ -3.6296 3.9200 ]\n", " : var4: -0.078123 1.2764 [ -4.8486 4.3625 ]\n", " : -----------------------------------------------------------\n", " : Preparing the Decorrelation transformation...\n", "TFHandler_Factory : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.089502 1.0000 [ -3.4349 2.7570 ]\n", " : var2: 0.38543 1.0000 [ -3.3765 3.1055 ]\n", " : var3: 0.052636 1.0000 [ -2.8007 3.1004 ]\n", " : var4: -0.20867 1.0000 [ -3.0012 2.5822 ]\n", " : -----------------------------------------------------------\n", " : Preparing the Principle Component (PCA) transformation...\n", "TFHandler_Factory : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1:-2.3297e-10 1.8127 [ -7.2691 6.3617 ]\n", " : var2:-3.1381e-10 0.89464 [ -2.7283 2.6323 ]\n", " : var3:-2.2463e-10 0.73955 [ -2.6363 2.4256 ]\n", " : var4:-9.8869e-11 0.61727 [ -1.7822 2.2327 ]\n", " : -----------------------------------------------------------\n", " : Preparing the Gaussian transformation...\n", " : Preparing the Decorrelation transformation...\n", "TFHandler_Factory : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.0071986 1.0000 [ -2.5427 5.8540 ]\n", " : var2: 0.0087421 1.0000 [ -2.8611 4.9796 ]\n", " : var3: 0.0090897 1.0000 [ -2.9572 5.6365 ]\n", " : var4: 0.0084612 1.0000 [ -3.0233 5.7479 ]\n", " : -----------------------------------------------------------\n", " : Ranking input variables (method unspecific)...\n", "Factory : Train method: BDTG for Multiclass classification\n", " : \n", " : Training 1000 Decision Trees ... patience please\n", " : Elapsed time for training with 4000 events: 2.85 sec \n", " : Dataset[dataset] : Create results for training\n", " : Dataset[dataset] : Multiclass evaluation of BDTG on training sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.661 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating xml weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_BDTG.weights.xml\u001b[0m\n", " : Creating standalone class: \u001b[0;36mdataset/weights/TMVAMulticlass_BDTG.class.C\u001b[0m\n", " : TMVAMulticlass.root:/dataset/Method_BDT/BDTG\n", "Factory : Training finished\n", " : \n", "Factory : Train method: MLP for Multiclass classification\n", " : \n", " : Training Network\n", " : \n", " : Elapsed time for training with 4000 events: 12.3 sec \n", " : Dataset[dataset] : Create results for training\n", " : Dataset[dataset] : Multiclass evaluation of MLP on training sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.00412 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating xml weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_MLP.weights.xml\u001b[0m\n", " : Creating standalone class: \u001b[0;36mdataset/weights/TMVAMulticlass_MLP.class.C\u001b[0m\n", " : Write special histos to file: TMVAMulticlass.root:/dataset/Method_MLP/MLP\n", "Factory : Training finished\n", " : \n", "Factory : Train method: PDEFoam for Multiclass classification\n", " : \n", " : Build up multiclass foam 0\n", " : Elapsed time: 0.344 sec \n", " : Build up multiclass foam 1\n", " : Elapsed time: 0.326 sec \n", " : Build up multiclass foam 2\n", " : Elapsed time: 0.321 sec \n", " : Build up multiclass foam 3\n", " : Elapsed time: 0.212 sec \n", " : Elapsed time for training with 4000 events: 1.28 sec \n", " : Dataset[dataset] : Create results for training\n", " : Dataset[dataset] : Multiclass evaluation of PDEFoam on training sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.0468 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating xml weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights.xml\u001b[0m\n", " : writing foam MultiClassFoam0 to file\n", " : writing foam MultiClassFoam1 to file\n", " : writing foam MultiClassFoam2 to file\n", " : writing foam MultiClassFoam3 to file\n", " : Foams written to file: \u001b[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights_foams.root\u001b[0m\n", " : Creating standalone class: \u001b[0;36mdataset/weights/TMVAMulticlass_PDEFoam.class.C\u001b[0m\n", "Factory : Training finished\n", " : \n", "Factory : Train method: DL_CPU for Multiclass classification\n", " : \n", "TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.12276 0.27828 [ -1.0000 1.0000 ]\n", " : var2: 0.075909 0.27943 [ -1.0000 1.0000 ]\n", " : var3: -0.010745 0.29684 [ -1.0000 1.0000 ]\n", " : var4: 0.035804 0.27714 [ -1.0000 1.0000 ]\n", " : -----------------------------------------------------------\n", " : Start of deep neural network training on CPU using MT, nthreads = 1\n", " : \n", "TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.12276 0.27828 [ -1.0000 1.0000 ]\n", " : var2: 0.075909 0.27943 [ -1.0000 1.0000 ]\n", " : var3: -0.010745 0.29684 [ -1.0000 1.0000 ]\n", " : var4: 0.035804 0.27714 [ -1.0000 1.0000 ]\n", " : -----------------------------------------------------------\n", " : ***** Deep Learning Network *****\n", "DEEP NEURAL NETWORK: Depth = 4 Input = ( 1, 1, 4 ) Batch size = 100 Loss function = C\n", "\tLayer 0\t DENSE Layer: \t ( Input = 4 , Width = 100 ) \tOutput = ( 1 , 100 , 100 ) \t Activation Function = Tanh\n", "\tLayer 1\t DENSE Layer: \t ( Input = 100 , Width = 50 ) \tOutput = ( 1 , 100 , 50 ) \t Activation Function = Tanh\n", "\tLayer 2\t DENSE Layer: \t ( Input = 50 , Width = 10 ) \tOutput = ( 1 , 100 , 10 ) \t Activation Function = Tanh\n", "\tLayer 3\t DENSE Layer: \t ( Input = 10 , Width = 4 ) \tOutput = ( 1 , 100 , 4 ) \t Activation Function = Identity\n", " : Using 3200 events for training and 800 for testing\n", " : Compute initial loss on the validation data \n", " : Training phase 1 of 1: Optimizer ADAM (beta1=0.9,beta2=0.999,eps=1e-07) Learning rate = 0.001 regularization 0 minimum error = 0.699785\n", " : --------------------------------------------------------------\n", " : Epoch | Train Err. Val. Err. t(s)/epoch t(s)/Loss nEvents/s Conv. Steps\n", " : --------------------------------------------------------------\n", " : Start epoch iteration ...\n", " : 1 Minimum Test error found - save the configuration \n", " : 1 | 0.621492 0.55779 0.0334356 0.0027201 104182 0\n", " : 2 Minimum Test error found - save the configuration \n", " : 2 | 0.519221 0.491219 0.034013 0.00273176 102298 0\n", " : 3 Minimum Test error found - save the configuration \n", " : 3 | 0.471866 0.459258 0.034269 0.00277055 101592 0\n", " : 4 Minimum Test error found - save the configuration \n", " : 4 | 0.444253 0.437548 0.0346174 0.00280934 100603 0\n", " : 5 Minimum Test error found - save the configuration \n", " : 5 | 0.4237 0.420033 0.0349008 0.00283844 99805.4 0\n", " : 6 Minimum Test error found - save the configuration \n", " : 6 | 0.407027 0.406436 0.0350977 0.00286866 99289.3 0\n", " : 7 Minimum Test error found - save the configuration \n", " : 7 | 0.393258 0.394275 0.0352841 0.0028848 98767.5 0\n", " : 8 Minimum Test error found - save the configuration \n", " : 8 | 0.38226 0.384905 0.0354689 0.0028974 98245.4 0\n", " : 9 Minimum Test error found - save the configuration \n", " : 9 | 0.373032 0.376361 0.0354952 0.0029093 98202 0\n", " : 10 Minimum Test error found - save the configuration \n", " : 10 | 0.365085 0.369758 0.0355656 0.00290594 97980.1 0\n", " : 11 Minimum Test error found - save the configuration \n", " : 11 | 0.35893 0.365344 0.0356422 0.00292651 97812.3 0\n", " : 12 Minimum Test error found - save the configuration \n", " : 12 | 0.352964 0.359273 0.0359219 0.00293308 97002.5 0\n", " : 13 Minimum Test error found - save the configuration \n", " : 13 | 0.34751 0.354326 0.0359144 0.00293378 97026.7 0\n", " : 14 Minimum Test error found - save the configuration \n", " : 14 | 0.342952 0.349942 0.0360027 0.00294467 96799.4 0\n", " : 15 Minimum Test error found - save the configuration \n", " : 15 | 0.338278 0.345851 0.0360157 0.0029447 96761.5 0\n", " : 16 Minimum Test error found - save the configuration \n", " : 16 | 0.333349 0.341335 0.0361052 0.00296317 96554.2 0\n", " : 17 Minimum Test error found - save the configuration \n", " : 17 | 0.32959 0.336888 0.0361969 0.00296644 96297.3 0\n", " : 18 Minimum Test error found - save the configuration \n", " : 18 | 0.326073 0.336071 0.0362725 0.00297923 96115.5 0\n", " : 19 Minimum Test error found - save the configuration \n", " : 19 | 0.321672 0.330016 0.0363434 0.00297917 95911.1 0\n", " : 20 Minimum Test error found - save the configuration \n", " : 20 | 0.317533 0.325716 0.0363502 0.00298697 95913.9 0\n", " : \n", " : Elapsed time for training with 4000 events: 0.722 sec \n", " : Dataset[dataset] : Create results for training\n", " : Dataset[dataset] : Multiclass evaluation of DL_CPU on training sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.0975 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating xml weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_DL_CPU.weights.xml\u001b[0m\n", " : Creating standalone class: \u001b[0;36mdataset/weights/TMVAMulticlass_DL_CPU.class.C\u001b[0m\n", "Factory : Training finished\n", " : \n", " : Ranking input variables (method specific)...\n", "BDTG : Ranking result (top variable is best ranked)\n", " : --------------------------------------\n", " : Rank : Variable : Variable Importance\n", " : --------------------------------------\n", " : 1 : var4 : 3.060e-01\n", " : 2 : var1 : 2.473e-01\n", " : 3 : var2 : 2.400e-01\n", " : 4 : var3 : 2.067e-01\n", " : --------------------------------------\n", "MLP : Ranking result (top variable is best ranked)\n", " : -----------------------------\n", " : Rank : Variable : Importance\n", " : -----------------------------\n", " : 1 : var4 : 5.440e+01\n", " : 2 : var1 : 2.568e+01\n", " : 3 : var2 : 2.223e+01\n", " : 4 : var3 : 7.204e+00\n", " : -----------------------------\n", "PDEFoam : Ranking result (top variable is best ranked)\n", " : --------------------------------------\n", " : Rank : Variable : Variable Importance\n", " : --------------------------------------\n", " : 1 : var4 : 2.756e-01\n", " : 2 : var1 : 2.691e-01\n", " : 3 : var2 : 2.402e-01\n", " : 4 : var3 : 2.151e-01\n", " : --------------------------------------\n", " : No variable ranking supplied by classifier: DL_CPU\n", "TH1.Print Name = TrainingHistory_DL_CPU_trainingError, Entries= 0, Total sum= 7.77004\n", "TH1.Print Name = TrainingHistory_DL_CPU_valError, Entries= 0, Total sum= 7.74234\n", "Factory : === Destroy and recreate all methods via weight files for testing ===\n", " : \n", " : Reading weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_BDTG.weights.xml\u001b[0m\n", " : Reading weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_MLP.weights.xml\u001b[0m\n", "MLP : Building Network. \n", " : Initializing weights\n", " : Reading weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights.xml\u001b[0m\n", " : Read foams from file: \u001b[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights_foams.root\u001b[0m\n", " : Reading weight file: \u001b[0;36mdataset/weights/TMVAMulticlass_DL_CPU.weights.xml\u001b[0m\n" ] } ], "source": [ "factory->TrainAllMethods();" ] }, { "cell_type": "markdown", "id": "7e169b66", "metadata": {}, "source": [ "Evaluate all MVAs using the set of test events" ] }, { "cell_type": "code", "execution_count": 8, "id": "289b8b98", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:55.944049Z", "iopub.status.busy": "2026-05-19T20:08:55.943929Z", "iopub.status.idle": "2026-05-19T20:08:56.730206Z", "shell.execute_reply": "2026-05-19T20:08:56.729636Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Factory : \u001b[1mTest all methods\u001b[0m\n", "Factory : Test method: BDTG for Multiclass classification performance\n", " : \n", " : Dataset[dataset] : Create results for testing\n", " : Dataset[dataset] : Multiclass evaluation of BDTG on testing sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.407 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "Factory : Test method: MLP for Multiclass classification performance\n", " : \n", " : Dataset[dataset] : Create results for testing\n", " : Dataset[dataset] : Multiclass evaluation of MLP on testing sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.00464 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "Factory : Test method: PDEFoam for Multiclass classification performance\n", " : \n", " : Dataset[dataset] : Create results for testing\n", " : Dataset[dataset] : Multiclass evaluation of PDEFoam on testing sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.0472 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "Factory : Test method: DL_CPU for Multiclass classification performance\n", " : \n", " : Dataset[dataset] : Create results for testing\n", " : Dataset[dataset] : Multiclass evaluation of DL_CPU on testing sample\n", " : Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.0977 sec \n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n" ] } ], "source": [ "factory->TestAllMethods();" ] }, { "cell_type": "markdown", "id": "67268a36", "metadata": {}, "source": [ "Evaluate and compare performance of all configured MVAs" ] }, { "cell_type": "code", "execution_count": 9, "id": "fc4efa26", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:56.731804Z", "iopub.status.busy": "2026-05-19T20:08:56.731550Z", "iopub.status.idle": "2026-05-19T20:08:57.022482Z", "shell.execute_reply": "2026-05-19T20:08:57.021871Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Factory : \u001b[1mEvaluate all methods\u001b[0m\n", " : Evaluate multiclass classification method: BDTG\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "TFHandler_BDTG : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.065615 1.0061 [ -4.0592 3.5808 ]\n", " : var2: 0.29707 1.0658 [ -3.6952 3.7877 ]\n", " : var3: 0.13183 1.1245 [ -4.5727 4.5640 ]\n", " : var4: -0.071010 1.2654 [ -4.8486 5.0412 ]\n", " : -----------------------------------------------------------\n", " : Evaluate multiclass classification method: MLP\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "TFHandler_MLP : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.065615 1.0061 [ -4.0592 3.5808 ]\n", " : var2: 0.29707 1.0658 [ -3.6952 3.7877 ]\n", " : var3: 0.13183 1.1245 [ -4.5727 4.5640 ]\n", " : var4: -0.071010 1.2654 [ -4.8486 5.0412 ]\n", " : -----------------------------------------------------------\n", " : Evaluate multiclass classification method: PDEFoam\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "TFHandler_PDEFoam : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.065615 1.0061 [ -4.0592 3.5808 ]\n", " : var2: 0.29707 1.0658 [ -3.6952 3.7877 ]\n", " : var3: 0.13183 1.1245 [ -4.5727 4.5640 ]\n", " : var4: -0.071010 1.2654 [ -4.8486 5.0412 ]\n", " : -----------------------------------------------------------\n", " : Evaluate multiclass classification method: DL_CPU\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", " : Creating multiclass response histograms...\n", " : Creating multiclass performance histograms...\n", "TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.12643 0.27476 [ -1.0000 1.0864 ]\n", " : var2: 0.066267 0.28510 [ -1.0016 1.0000 ]\n", " : var3: -0.0035395 0.29791 [ -1.2498 1.1706 ]\n", " : var4: 0.037349 0.27475 [ -1.0000 1.1474 ]\n", " : -----------------------------------------------------------\n", "TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]\n", " : -----------------------------------------------------------\n", " : var1: 0.12643 0.27476 [ -1.0000 1.0864 ]\n", " : var2: 0.066267 0.28510 [ -1.0016 1.0000 ]\n", " : var3: -0.0035395 0.29791 [ -1.2498 1.1706 ]\n", " : var4: 0.037349 0.27475 [ -1.0000 1.1474 ]\n", " : -----------------------------------------------------------\n", " : \n", " : 1-vs-rest performance metrics per class\n", " : -------------------------------------------------------------------------------------------------------\n", " : \n", " : Considers the listed class as signal and the other classes\n", " : as background, reporting the resulting binary performance.\n", " : A score of 0.820 (0.850) means 0.820 was acheived on the\n", " : test set and 0.850 on the training set.\n", " : \n", " : Dataset MVA Method ROC AUC Sig eff@B=0.01 Sig eff@B=0.10 Sig eff@B=0.30 \n", " : Name: / Class: test (train) test (train) test (train) test (train) \n", " : \n", " : dataset BDTG \n", " : ------------------------------\n", " : Signal 0.967 (0.980) 0.496 (0.616) 0.910 (0.953) 0.994 (0.997) \n", " : bg0 0.908 (0.927) 0.201 (0.331) 0.729 (0.777) 0.924 (0.944) \n", " : bg1 0.945 (0.955) 0.413 (0.429) 0.833 (0.860) 0.970 (0.973) \n", " : bg2 0.974 (0.984) 0.600 (0.677) 0.926 (0.973) 0.995 (0.998) \n", " : \n", " : dataset MLP \n", " : ------------------------------\n", " : Signal 0.975 (0.976) 0.591 (0.609) 0.931 (0.940) 0.997 (0.994) \n", " : bg0 0.930 (0.934) 0.279 (0.389) 0.781 (0.789) 0.960 (0.951) \n", " : bg1 0.963 (0.964) 0.494 (0.462) 0.889 (0.900) 0.990 (0.994) \n", " : bg2 0.971 (0.977) 0.653 (0.697) 0.901 (0.900) 0.994 (1.000) \n", " : \n", " : dataset PDEFoam \n", " : ------------------------------\n", " : Signal 0.924 (0.931) 0.274 (0.374) 0.760 (0.781) 0.950 (0.963) \n", " : bg0 0.843 (0.853) 0.113 (0.167) 0.596 (0.613) 0.824 (0.833) \n", " : bg1 0.899 (0.909) 0.287 (0.290) 0.682 (0.740) 0.914 (0.920) \n", " : bg2 0.971 (0.968) 0.488 (0.436) 0.934 (0.913) 0.996 (0.999) \n", " : \n", " : dataset DL_CPU \n", " : ------------------------------\n", " : Signal 0.951 (0.954) 0.283 (0.296) 0.873 (0.872) 0.987 (0.991) \n", " : bg0 0.915 (0.906) 0.250 (0.293) 0.736 (0.735) 0.939 (0.921) \n", " : bg1 0.942 (0.937) 0.315 (0.295) 0.822 (0.803) 0.975 (0.968) \n", " : bg2 0.883 (0.898) 0.395 (0.355) 0.669 (0.679) 0.856 (0.885) \n", " : \n", " : -------------------------------------------------------------------------------------------------------\n", " : \n", " : \n", " : Confusion matrices for all methods\n", " : -------------------------------------------------------------------------------------------------------\n", " : \n", " : Does a binary comparison between the two classes given by a \n", " : particular row-column combination. In each case, the class \n", " : given by the row is considered signal while the class given \n", " : by the column index is considered background.\n", " : \n", " : === Showing confusion matrix for method : BDTG \n", " : (Signal Efficiency for Background Efficiency 0.01%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.489 (0.430) 0.864 (0.764) 0.784 (0.472) \n", " : bg0 0.311 (0.181) - 0.207 (0.132) 0.694 (0.611) \n", " : bg1 0.830 (0.834) 0.288 (0.339) - 0.668 (0.511) \n", " : bg2 0.708 (0.593) 0.684 (0.593) 0.625 (0.600) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.10%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.901 (0.852) 0.996 (0.993) 0.956 (0.892) \n", " : bg0 0.810 (0.763) - 0.643 (0.601) 0.924 (0.904) \n", " : bg1 0.984 (0.984) 0.716 (0.677) - 0.898 (0.843) \n", " : bg2 0.983 (0.928) 0.982 (0.953) 0.948 (0.897) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.30%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.981 (0.960) 1.000 (0.999) 0.999 (0.998) \n", " : bg0 0.963 (0.927) - 0.852 (0.814) 0.990 (0.986) \n", " : bg1 0.999 (0.998) 0.915 (0.888) - 0.984 (0.984) \n", " : bg2 0.999 (0.996) 0.998 (0.995) 0.998 (0.993) - \n", " : \n", " : === Showing confusion matrix for method : MLP \n", " : (Signal Efficiency for Background Efficiency 0.01%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.456 (0.481) 0.936 (0.943) 0.645 (0.548) \n", " : bg0 0.421 (0.278) - 0.302 (0.229) 0.604 (0.477) \n", " : bg1 0.913 (0.925) 0.261 (0.400) - 0.566 (0.602) \n", " : bg2 0.675 (0.662) 0.710 (0.669) 0.696 (0.641) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.10%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.875 (0.891) 0.999 (1.000) 0.920 (0.894) \n", " : bg0 0.766 (0.755) - 0.696 (0.707) 0.909 (0.905) \n", " : bg1 0.997 (0.992) 0.780 (0.790) - 0.901 (0.867) \n", " : bg2 0.880 (0.890) 0.944 (0.933) 0.891 (0.886) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.30%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.974 (0.972) 1.000 (1.000) 0.995 (0.998) \n", " : bg0 0.954 (0.960) - 0.914 (0.914) 0.995 (0.992) \n", " : bg1 0.999 (0.999) 0.958 (0.944) - 0.998 (0.996) \n", " : bg2 0.999 (0.990) 1.000 (0.996) 0.999 (0.989) - \n", " : \n", " : === Showing confusion matrix for method : PDEFoam \n", " : (Signal Efficiency for Background Efficiency 0.01%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.273 (0.124) 0.423 (0.441) 0.405 (0.491) \n", " : bg0 0.156 (0.076) - 0.126 (0.077) 0.512 (0.496) \n", " : bg1 0.480 (0.405) 0.197 (0.220) - 0.410 (0.350) \n", " : bg2 0.462 (0.507) 0.462 (0.577) 0.401 (0.412) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.10%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.673 (0.666) 0.826 (0.851) 0.835 (0.796) \n", " : bg0 0.569 (0.562) - 0.528 (0.477) 0.814 (0.809) \n", " : bg1 0.825 (0.811) 0.539 (0.520) - 0.808 (0.784) \n", " : bg2 0.925 (0.934) 0.948 (0.969) 0.874 (0.876) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.30%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.908 (0.894) 0.973 (0.965) 0.972 (0.962) \n", " : bg0 0.781 (0.793) - 0.725 (0.740) 0.947 (0.931) \n", " : bg1 0.955 (0.949) 0.840 (0.835) - 0.935 (0.928) \n", " : bg2 0.999 (0.996) 0.999 (0.998) 0.999 (0.996) - \n", " : \n", " : === Showing confusion matrix for method : DL_CPU \n", " : (Signal Efficiency for Background Efficiency 0.01%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.455 (0.564) 0.845 (0.866) 0.174 (0.130) \n", " : bg0 0.337 (0.227) - 0.211 (0.259) 0.535 (0.342) \n", " : bg1 0.903 (0.954) 0.177 (0.257) - 0.289 (0.280) \n", " : bg2 0.434 (0.419) 0.315 (0.355) 0.383 (0.430) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.10%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.862 (0.882) 0.994 (0.991) 0.648 (0.545) \n", " : bg0 0.736 (0.738) - 0.640 (0.649) 0.803 (0.842) \n", " : bg1 0.988 (0.989) 0.750 (0.783) - 0.691 (0.690) \n", " : bg2 0.811 (0.786) 0.656 (0.638) 0.655 (0.655) - \n", " : \n", " : (Signal Efficiency for Background Efficiency 0.30%)\n", " : ---------------------------------------------------\n", " : Signal bg0 bg1 bg2 \n", " : test (train) test (train) test (train) test (train) \n", " : Signal - 0.974 (0.963) 1.000 (1.000) 0.984 (0.962) \n", " : bg0 0.933 (0.947) - 0.880 (0.906) 0.929 (0.944) \n", " : bg1 0.994 (0.997) 0.947 (0.954) - 0.905 (0.914) \n", " : bg2 0.928 (0.923) 0.895 (0.879) 0.797 (0.760) - \n", " : \n", " : -------------------------------------------------------------------------------------------------------\n", " : \n", "Dataset:dataset : Created tree 'TestTree' with 4000 events\n", " : \n", "Dataset:dataset : Created tree 'TrainTree' with 4000 events\n", " : \n", "Factory : \u001b[1mThank you for using TMVA!\u001b[0m\n", " : \u001b[1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html\u001b[0m\n" ] } ], "source": [ "factory->EvaluateAllMethods();" ] }, { "cell_type": "markdown", "id": "a40cf26e", "metadata": {}, "source": [ "--------------------------------------------------------------" ] }, { "cell_type": "markdown", "id": "dabd0104", "metadata": {}, "source": [ "Save the output" ] }, { "cell_type": "code", "execution_count": 10, "id": "77a66d32", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:57.024285Z", "iopub.status.busy": "2026-05-19T20:08:57.024163Z", "iopub.status.idle": "2026-05-19T20:08:57.227370Z", "shell.execute_reply": "2026-05-19T20:08:57.226685Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "==> Wrote root file: TMVAMulticlass.root\n", "==> TMVAMulticlass is done!\n" ] } ], "source": [ "outputFile->Close();\n", "\n", "std::cout << \"==> Wrote root file: \" << outputFile->GetName() << std::endl;\n", "std::cout << \"==> TMVAMulticlass is done!\" << std::endl;\n", "\n", "delete factory;\n", "delete dataloader;" ] }, { "cell_type": "markdown", "id": "3b8bd024", "metadata": {}, "source": [ "Launch the GUI for the root macros" ] }, { "cell_type": "code", "execution_count": 11, "id": "2e506046", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:08:57.228809Z", "iopub.status.busy": "2026-05-19T20:08:57.228691Z", "iopub.status.idle": "2026-05-19T20:08:57.431498Z", "shell.execute_reply": "2026-05-19T20:08:57.430787Z" } }, "outputs": [], "source": [ "if (!gROOT->IsBatch()) TMVAMultiClassGui( outfileName );" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }