Logo ROOT  
Reference Guide
TMVAMulticlass.C File Reference

Detailed Description

View in nbviewer Open in SWAN This macro provides a simple example for the training and testing of the TMVA multiclass classification

  • Project : TMVA - a Root-integrated toolkit for multivariate data analysis
  • Package : TMVA
  • Root Macro: TMVAMulticlass
==> Start TMVAMulticlass
--- TMVAMulticlass: Using input file: ./files/tmva_multiclass_example.root
DataSetInfo : [dataset] : Added class "Signal"
: Add Tree TreeS of type Signal with 2000 events
DataSetInfo : [dataset] : Added class "bg0"
: Add Tree TreeB0 of type bg0 with 2000 events
DataSetInfo : [dataset] : Added class "bg1"
: Add Tree TreeB1 of type bg1 with 2000 events
DataSetInfo : [dataset] : Added class "bg2"
: Add Tree TreeB2 of type bg2 with 2000 events
: Dataset[dataset] : Class index : 0 name : Signal
: Dataset[dataset] : Class index : 1 name : bg0
: Dataset[dataset] : Class index : 2 name : bg1
: Dataset[dataset] : Class index : 3 name : bg2
Factory : Booking method: ␛[1mBDTG␛[0m
:
: the option NegWeightTreatment=InverseBoostNegWeights does not exist for BoostType=Grad
: --> change to new default NegWeightTreatment=Pray
: Rebuilding Dataset dataset
: Building event vectors for type 2 Signal
: Dataset[dataset] : create input formulas for tree TreeS
: Building event vectors for type 2 bg0
: Dataset[dataset] : create input formulas for tree TreeB0
: Building event vectors for type 2 bg1
: Dataset[dataset] : create input formulas for tree TreeB1
: Building event vectors for type 2 bg2
: Dataset[dataset] : create input formulas for tree TreeB2
DataSetFactory : [dataset] : Number of events in input trees
:
:
:
:
: Number of training and testing events
: ---------------------------------------------------------------------------
: Signal -- training events : 1000
: Signal -- testing events : 1000
: Signal -- training and testing events: 2000
: bg0 -- training events : 1000
: bg0 -- testing events : 1000
: bg0 -- training and testing events: 2000
: bg1 -- training events : 1000
: bg1 -- testing events : 1000
: bg1 -- training and testing events: 2000
: bg2 -- training events : 1000
: bg2 -- testing events : 1000
: bg2 -- training and testing events: 2000
:
DataSetInfo : Correlation matrix (Signal):
: ----------------------------------------
: var1 var2 var3 var4
: var1: +1.000 +0.397 +0.623 +0.832
: var2: +0.397 +1.000 +0.716 +0.737
: var3: +0.623 +0.716 +1.000 +0.859
: var4: +0.832 +0.737 +0.859 +1.000
: ----------------------------------------
DataSetInfo : Correlation matrix (bg0):
: ----------------------------------------
: var1 var2 var3 var4
: var1: +1.000 +0.365 +0.592 +0.811
: var2: +0.365 +1.000 +0.708 +0.740
: var3: +0.592 +0.708 +1.000 +0.859
: var4: +0.811 +0.740 +0.859 +1.000
: ----------------------------------------
DataSetInfo : Correlation matrix (bg1):
: ----------------------------------------
: var1 var2 var3 var4
: var1: +1.000 +0.407 +0.610 +0.834
: var2: +0.407 +1.000 +0.710 +0.741
: var3: +0.610 +0.710 +1.000 +0.851
: var4: +0.834 +0.741 +0.851 +1.000
: ----------------------------------------
DataSetInfo : Correlation matrix (bg2):
: ----------------------------------------
: var1 var2 var3 var4
: var1: +1.000 -0.647 -0.016 -0.013
: var2: -0.647 +1.000 +0.015 +0.002
: var3: -0.016 +0.015 +1.000 -0.024
: var4: -0.013 +0.002 -0.024 +1.000
: ----------------------------------------
DataSetFactory : [dataset] :
:
Factory : Booking method: ␛[1mMLP␛[0m
:
MLP : Building Network.
: Initializing weights
Factory : Booking method: ␛[1mPDEFoam␛[0m
:
Factory : Booking method: ␛[1mDL_CPU␛[0m
:
: Parsing option string:
: ... "!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"
: The following options are set:
: - By User:
: <none>
: - Default:
: Boost_num: "0" [Number of times the classifier will be boosted]
: Parsing option string:
: ... "!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"
: The following options are set:
: - By User:
: V: "True" [Verbose output (short form of "VerbosityLevel" below - overrides the latter one)]
: 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)"]
: H: "False" [Print method-specific help message]
: Layout: "TANH|100,TANH|50,TANH|10,LINEAR" [Layout of the network.]
: ErrorStrategy: "CROSSENTROPY" [Loss function: Mean squared error (regression) or cross entropy (binary classification).]
: WeightInitialization: "XAVIERUNIFORM" [Weight initialization strategy]
: Architecture: "GPU" [Which architecture to perform the training on.]
: TrainingStrategy: "Optimizer=ADAM,LearningRate=1e-3,TestRepetitions=1,ConvergenceSteps=10,BatchSize=100" [Defines the training strategies.]
: - Default:
: VerbosityLevel: "Default" [Verbosity level]
: CreateMVAPdfs: "False" [Create PDFs for classifier outputs (signal and background)]
: IgnoreNegWeightsInTraining: "False" [Events with negative weights are ignored in the training (but are included for testing and performance evaluation)]
: InputLayout: "0|0|0" [The Layout of the input]
: BatchLayout: "0|0|0" [The Layout of the batch]
: RandomSeed: "0" [Random seed used for weight initialization and batch shuffling]
: 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%)]
DL_CPU : [dataset] : Create Transformation "N" with events from all classes.
:
: Transformation, Variable selection :
: Input : variable 'var1' <---> Output : variable 'var1'
: Input : variable 'var2' <---> Output : variable 'var2'
: Input : variable 'var3' <---> Output : variable 'var3'
: Input : variable 'var4' <---> Output : variable 'var4'
␛[31m<ERROR> : CUDA backend not enabled. Please make sure you have CUDA installed and it was successfully detected by CMAKE by using -Dtmva-gpu=On ␛[0m
: Will now use instead the CPU architecture !
: Will now use the CPU architecture with BLAS and IMT support !
Factory : ␛[1mTrain all methods␛[0m
Factory : [dataset] : Create Transformation "I" with events from all classes.
:
: Transformation, Variable selection :
: Input : variable 'var1' <---> Output : variable 'var1'
: Input : variable 'var2' <---> Output : variable 'var2'
: Input : variable 'var3' <---> Output : variable 'var3'
: Input : variable 'var4' <---> Output : variable 'var4'
Factory : [dataset] : Create Transformation "D" with events from all classes.
:
: Transformation, Variable selection :
: Input : variable 'var1' <---> Output : variable 'var1'
: Input : variable 'var2' <---> Output : variable 'var2'
: Input : variable 'var3' <---> Output : variable 'var3'
: Input : variable 'var4' <---> Output : variable 'var4'
Factory : [dataset] : Create Transformation "P" with events from all classes.
:
: Transformation, Variable selection :
: Input : variable 'var1' <---> Output : variable 'var1'
: Input : variable 'var2' <---> Output : variable 'var2'
: Input : variable 'var3' <---> Output : variable 'var3'
: Input : variable 'var4' <---> Output : variable 'var4'
Factory : [dataset] : Create Transformation "G" with events from all classes.
:
: Transformation, Variable selection :
: Input : variable 'var1' <---> Output : variable 'var1'
: Input : variable 'var2' <---> Output : variable 'var2'
: Input : variable 'var3' <---> Output : variable 'var3'
: Input : variable 'var4' <---> Output : variable 'var4'
Factory : [dataset] : Create Transformation "D" with events from all classes.
:
: Transformation, Variable selection :
: Input : variable 'var1' <---> Output : variable 'var1'
: Input : variable 'var2' <---> Output : variable 'var2'
: Input : variable 'var3' <---> Output : variable 'var3'
: Input : variable 'var4' <---> Output : variable 'var4'
TFHandler_Factory : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.047647 1.0025 [ -3.6592 3.2645 ]
: var2: 0.32647 1.0646 [ -3.6891 3.7877 ]
: var3: 0.11493 1.1230 [ -4.5727 4.5640 ]
: var4: -0.076531 1.2652 [ -4.8486 5.0412 ]
: -----------------------------------------------------------
: Preparing the Decorrelation transformation...
TFHandler_Factory : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.082544 1.0000 [ -3.6274 3.1017 ]
: var2: 0.36715 1.0000 [ -3.3020 3.4950 ]
: var3: 0.066865 1.0000 [ -2.9882 3.3086 ]
: var4: -0.20593 1.0000 [ -3.3088 2.8423 ]
: -----------------------------------------------------------
: Preparing the Principle Component (PCA) transformation...
TFHandler_Factory : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 5.7502e-10 1.8064 [ -8.0344 7.8312 ]
: var2:-1.6078e-11 0.90130 [ -2.6765 2.7523 ]
: var3: 3.0841e-10 0.73386 [ -2.6572 2.2255 ]
: var4:-2.6886e-10 0.62168 [ -1.7384 2.2297 ]
: -----------------------------------------------------------
: Preparing the Gaussian transformation...
: Preparing the Decorrelation transformation...
TFHandler_Factory : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.013510 1.0000 [ -2.6520 6.2074 ]
: var2: 0.0096839 1.0000 [ -2.8402 6.3073 ]
: var3: 0.010397 1.0000 [ -3.0251 5.8860 ]
: var4: 0.0053980 1.0000 [ -3.0998 5.7078 ]
: -----------------------------------------------------------
: Ranking input variables (method unspecific)...
Factory : Train method: BDTG for Multiclass classification
:
: Training 1000 Decision Trees ... patience please
: Elapsed time for training with 4000 events: 5.52 sec
: Dataset[dataset] : Create results for training
: Dataset[dataset] : Multiclass evaluation of BDTG on training sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 2.03 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating xml weight file: ␛[0;36mdataset/weights/TMVAMulticlass_BDTG.weights.xml␛[0m
: Creating standalone class: ␛[0;36mdataset/weights/TMVAMulticlass_BDTG.class.C␛[0m
: TMVAMulticlass.root:/dataset/Method_BDT/BDTG
Factory : Training finished
:
Factory : Train method: MLP for Multiclass classification
:
: Training Network
:
: Elapsed time for training with 4000 events: 24.2 sec
: Dataset[dataset] : Create results for training
: Dataset[dataset] : Multiclass evaluation of MLP on training sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.0194 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating xml weight file: ␛[0;36mdataset/weights/TMVAMulticlass_MLP.weights.xml␛[0m
: Creating standalone class: ␛[0;36mdataset/weights/TMVAMulticlass_MLP.class.C␛[0m
: Write special histos to file: TMVAMulticlass.root:/dataset/Method_MLP/MLP
Factory : Training finished
:
Factory : Train method: PDEFoam for Multiclass classification
:
: Build up multiclass foam 0
: Elapsed time: 0.661 sec
: Build up multiclass foam 1
: Elapsed time: 0.668 sec
: Build up multiclass foam 2
: Elapsed time: 0.669 sec
: Build up multiclass foam 3
: Elapsed time: 0.471 sec
: Elapsed time for training with 4000 events: 2.64 sec
: Dataset[dataset] : Create results for training
: Dataset[dataset] : Multiclass evaluation of PDEFoam on training sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.135 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating xml weight file: ␛[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights.xml␛[0m
: writing foam MultiClassFoam0 to file
: writing foam MultiClassFoam1 to file
: writing foam MultiClassFoam2 to file
: writing foam MultiClassFoam3 to file
: Foams written to file: ␛[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights_foams.root␛[0m
: Creating standalone class: ␛[0;36mdataset/weights/TMVAMulticlass_PDEFoam.class.C␛[0m
Factory : Training finished
:
Factory : Train method: DL_CPU for Multiclass classification
:
TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.070769 0.28960 [ -1.0000 1.0000 ]
: var2: 0.074130 0.28477 [ -1.0000 1.0000 ]
: var3: 0.026106 0.24582 [ -1.0000 1.0000 ]
: var4: -0.034951 0.25587 [ -1.0000 1.0000 ]
: -----------------------------------------------------------
: Start of deep neural network training on CPU using MT, nthreads = 1
:
TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.070769 0.28960 [ -1.0000 1.0000 ]
: var2: 0.074130 0.28477 [ -1.0000 1.0000 ]
: var3: 0.026106 0.24582 [ -1.0000 1.0000 ]
: var4: -0.034951 0.25587 [ -1.0000 1.0000 ]
: -----------------------------------------------------------
: ***** Deep Learning Network *****
DEEP NEURAL NETWORK: Depth = 4 Input = ( 1, 1, 4 ) Batch size = 100 Loss function = C
Layer 0 DENSE Layer: ( Input = 4 , Width = 100 ) Output = ( 1 , 100 , 100 ) Activation Function = Tanh
Layer 1 DENSE Layer: ( Input = 100 , Width = 50 ) Output = ( 1 , 100 , 50 ) Activation Function = Tanh
Layer 2 DENSE Layer: ( Input = 50 , Width = 10 ) Output = ( 1 , 100 , 10 ) Activation Function = Tanh
Layer 3 DENSE Layer: ( Input = 10 , Width = 4 ) Output = ( 1 , 100 , 4 ) Activation Function = Identity
: Using 3200 events for training and 800 for testing
: Compute initial loss on the validation data
: 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.711143
: --------------------------------------------------------------
: Epoch | Train Err. Val. Err. t(s)/epoch t(s)/Loss nEvents/s Conv. Steps
: --------------------------------------------------------------
: Start epoch iteration ...
: 1 Minimum Test error found - save the configuration
: 1 | 0.631827 0.572221 0.0766672 0.00665819 45708.4 0
: 2 Minimum Test error found - save the configuration
: 2 | 0.528043 0.494828 0.0775998 0.0066691 45114.5 0
: 3 Minimum Test error found - save the configuration
: 3 | 0.478101 0.461932 0.0803773 0.00678563 43483.2 0
: 4 Minimum Test error found - save the configuration
: 4 | 0.449222 0.436269 0.0788323 0.00679176 44419.4 0
: 5 Minimum Test error found - save the configuration
: 5 | 0.426224 0.413324 0.079242 0.00681021 44179.5 0
: 6 Minimum Test error found - save the configuration
: 6 | 0.404969 0.392095 0.0795082 0.00685313 44043.7 0
: 7 Minimum Test error found - save the configuration
: 7 | 0.388264 0.377193 0.079734 0.00686287 43913.1 0
: 8 Minimum Test error found - save the configuration
: 8 | 0.375233 0.365206 0.0799235 0.00689423 43818 0
: 9 Minimum Test error found - save the configuration
: 9 | 0.365602 0.356639 0.0801257 0.00692902 43717.8 0
: 10 Minimum Test error found - save the configuration
: 10 | 0.357365 0.348663 0.0802399 0.00693867 43655.5 0
: 11 Minimum Test error found - save the configuration
: 11 | 0.351242 0.340916 0.080402 0.0069396 43559.7 0
: 12 Minimum Test error found - save the configuration
: 12 | 0.345095 0.335458 0.0805354 0.00696747 43497.2 0
: 13 Minimum Test error found - save the configuration
: 13 | 0.339372 0.328602 0.0806598 0.00697706 43429.4 0
: 14 Minimum Test error found - save the configuration
: 14 | 0.334507 0.327482 0.0807928 0.00702018 43376.5 0
: 15 Minimum Test error found - save the configuration
: 15 | 0.330576 0.320886 0.0808575 0.00699057 43321.1 0
: 16 Minimum Test error found - save the configuration
: 16 | 0.325811 0.314644 0.0809934 0.00700859 43252.1 0
: 17 Minimum Test error found - save the configuration
: 17 | 0.32223 0.311278 0.0810654 0.00702455 43219.4 0
: 18 Minimum Test error found - save the configuration
: 18 | 0.318639 0.308429 0.0811773 0.00703002 43157.3 0
: 19 Minimum Test error found - save the configuration
: 19 | 0.314425 0.304445 0.081311 0.00704911 43090.8 0
: 20 Minimum Test error found - save the configuration
: 20 | 0.311087 0.301996 0.0813664 0.0070623 43066.3 0
: 21 Minimum Test error found - save the configuration
: 21 | 0.307013 0.297069 0.0814216 0.00704696 43025.4 0
: 22 Minimum Test error found - save the configuration
: 22 | 0.304609 0.294215 0.0815614 0.00708129 42964.5 0
: 23 | 0.302117 0.298506 0.0815251 0.006988 42931.7 1
: 24 Minimum Test error found - save the configuration
: 24 | 0.301356 0.288268 0.0817135 0.00708804 42880.8 0
: 25 | 0.296598 0.288777 0.0817307 0.0070051 42823.3 1
: 26 Minimum Test error found - save the configuration
: 26 | 0.293932 0.287421 0.081951 0.0071057 42754.8 0
: 27 Minimum Test error found - save the configuration
: 27 | 0.292938 0.282373 0.0819787 0.00711299 42743.2 0
: 28 | 0.290119 0.28366 0.0818857 0.00700589 42735.2 1
: 29 Minimum Test error found - save the configuration
: 29 | 0.28878 0.278197 0.082008 0.00712623 42734 0
: 30 Minimum Test error found - save the configuration
: 30 | 0.285652 0.276259 0.0820184 0.00711267 42720.3 0
: 31 Minimum Test error found - save the configuration
: 31 | 0.283405 0.276207 0.0820461 0.00713005 42714.5 0
: 32 Minimum Test error found - save the configuration
: 32 | 0.281915 0.275361 0.0821152 0.0071397 42680.6 0
: 33 | 0.281065 0.277474 0.0820132 0.00705381 42689.8 1
: 34 Minimum Test error found - save the configuration
: 34 | 0.277109 0.266428 0.082173 0.00714057 42648.2 0
: 35 | 0.276646 0.269768 0.0821984 0.00706969 42593.6 1
: 36 | 0.275299 0.270967 0.0821513 0.00705473 42611.8 2
: 37 Minimum Test error found - save the configuration
: 37 | 0.273281 0.263842 0.0823705 0.00717379 42555 0
: 38 Minimum Test error found - save the configuration
: 38 | 0.270998 0.26144 0.0826278 0.00719932 42424.3 0
: 39 | 0.270093 0.262936 0.0823619 0.00707512 42504.2 1
: 40 | 0.26949 0.262854 0.0823519 0.00708725 42516.6 2
: 41 Minimum Test error found - save the configuration
: 41 | 0.267075 0.260097 0.0826061 0.00720406 42439.2 0
: 42 Minimum Test error found - save the configuration
: 42 | 0.266635 0.259785 0.0824756 0.00716187 42488.9 0
: 43 Minimum Test error found - save the configuration
: 43 | 0.265604 0.257638 0.0825006 0.00717767 42483.7 0
: 44 Minimum Test error found - save the configuration
: 44 | 0.26397 0.254991 0.0825503 0.00718263 42458.5 0
: 45 | 0.261986 0.25578 0.0824684 0.00708897 42451.9 1
: 46 | 0.261214 0.255714 0.0825912 0.00709914 42388.5 2
: 47 | 0.25981 0.255989 0.0825771 0.00710336 42398.9 3
: 48 | 0.25901 0.256731 0.0825302 0.00708834 42416.7 4
: 49 Minimum Test error found - save the configuration
: 49 | 0.25685 0.25165 0.0826316 0.0071953 42419.9 0
: 50 Minimum Test error found - save the configuration
: 50 | 0.255134 0.251391 0.0827689 0.00722216 42357.9 0
: 51 Minimum Test error found - save the configuration
: 51 | 0.254297 0.248572 0.082766 0.00719728 42345.6 0
: 52 Minimum Test error found - save the configuration
: 52 | 0.252429 0.247145 0.0827325 0.0072015 42366.7 0
: 53 | 0.251365 0.251912 0.0828015 0.00711876 42281.7 1
: 54 Minimum Test error found - save the configuration
: 54 | 0.249662 0.245729 0.0828573 0.00719542 42293.4 0
: 55 | 0.248165 0.246379 0.0828541 0.00711826 42252.1 1
: 56 Minimum Test error found - save the configuration
: 56 | 0.247453 0.245635 0.0829914 0.00726111 42255.2 0
: 57 Minimum Test error found - save the configuration
: 57 | 0.245297 0.244064 0.0829133 0.00722664 42279.6 0
: 58 | 0.244237 0.248382 0.0828385 0.00712372 42263.9 1
: 59 Minimum Test error found - save the configuration
: 59 | 0.243607 0.237505 0.082976 0.00725465 42260.2 0
: 60 | 0.242526 0.241601 0.0830325 0.00713999 42164.9 1
: 61 | 0.240237 0.241928 0.0830371 0.00714755 42166.5 2
: 62 Minimum Test error found - save the configuration
: 62 | 0.239272 0.236165 0.0832544 0.00730302 42132.2 0
: 63 | 0.240192 0.236763 0.0830426 0.00713801 42158.2 1
: 64 | 0.236916 0.237632 0.0830976 0.00715548 42137.3 2
: 65 | 0.237569 0.244243 0.083115 0.00715415 42127 3
: 66 Minimum Test error found - save the configuration
: 66 | 0.235972 0.23521 0.0831886 0.00725806 42143.8 0
: 67 | 0.233996 0.23737 0.0830713 0.00714524 42146.2 1
: 68 Minimum Test error found - save the configuration
: 68 | 0.233062 0.233906 0.0832104 0.00724605 42125 0
: 69 | 0.232851 0.234474 0.0831296 0.00715592 42119.9 1
: 70 Minimum Test error found - save the configuration
: 70 | 0.232197 0.233337 0.083226 0.0072526 42120 0
: 71 | 0.231734 0.238934 0.0832159 0.00719604 42094.3 1
: 72 Minimum Test error found - save the configuration
: 72 | 0.230513 0.231391 0.083256 0.00725781 42106.2 0
: 73 | 0.228343 0.232715 0.0831965 0.00715866 42084.3 1
: 74 Minimum Test error found - save the configuration
: 74 | 0.229768 0.231071 0.0833847 0.00727542 42044.8 0
: 75 | 0.227936 0.232398 0.0832164 0.00716719 42078 1
: 76 Minimum Test error found - save the configuration
: 76 | 0.226412 0.230428 0.0834126 0.00727181 42027.4 0
: 77 | 0.228109 0.234247 0.0832778 0.0071745 42048.1 1
: 78 Minimum Test error found - save the configuration
: 78 | 0.225783 0.229075 0.0834509 0.0072845 42013.3 0
: 79 Minimum Test error found - save the configuration
: 79 | 0.22532 0.228016 0.0835487 0.00730333 41969.8 0
: 80 | 0.224061 0.229392 0.0833514 0.00718047 42010.8 1
: 81 Minimum Test error found - save the configuration
: 81 | 0.224043 0.227649 0.083511 0.0072812 41978.4 0
: 82 | 0.222686 0.231289 0.0834708 0.00717883 41944.1 1
: 83 | 0.224939 0.229132 0.0834559 0.0071929 41960.1 2
: 84 | 0.222775 0.228577 0.0834316 0.00718364 41968.3 3
: 85 | 0.221327 0.229826 0.0834183 0.00719368 41981.2 4
: 86 Minimum Test error found - save the configuration
: 86 | 0.220409 0.227194 0.0836863 0.00728666 41885 0
: 87 Minimum Test error found - save the configuration
: 87 | 0.219447 0.22604 0.0835991 0.00727756 41927.9 0
: 88 | 0.219545 0.229492 0.0835381 0.00718858 41912.5 1
: 89 Minimum Test error found - save the configuration
: 89 | 0.220017 0.225209 0.0835736 0.00732959 41970.5 0
: 90 Minimum Test error found - save the configuration
: 90 | 0.220026 0.222587 0.0835718 0.00730899 41960.1 0
: 91 | 0.219132 0.224179 0.0834586 0.00720194 41963.6 1
: 92 | 0.219303 0.226079 0.0834315 0.00719856 41976.6 2
: 93 | 0.218088 0.228128 0.0834488 0.00718894 41961.8 3
: 94 | 0.218777 0.22361 0.0834734 0.00722197 41966.4 4
: 95 | 0.216823 0.23263 0.0835282 0.0072033 41926 5
: 96 Minimum Test error found - save the configuration
: 96 | 0.216383 0.220074 0.0836743 0.00729279 41895 0
: 97 | 0.215959 0.221387 0.0835498 0.00718912 41906.4 1
: 98 | 0.215973 0.221474 0.0836276 0.00720247 41871 2
: 99 | 0.217395 0.226723 0.0835107 0.00720301 41935.5 3
: 100 | 0.217265 0.22541 0.0835592 0.00720273 41908.7 4
: 101 | 0.216444 0.225323 0.0835799 0.00719839 41895 5
: 102 | 0.216584 0.220874 0.0835833 0.00720725 41898 6
: 103 | 0.214433 0.222329 0.0835747 0.00720325 41900.5 7
: 104 | 0.216453 0.227594 0.0835733 0.00720089 41899.9 8
: 105 | 0.213477 0.221327 0.0835221 0.00719705 41926 9
: 106 | 0.214566 0.228854 0.0835687 0.00720228 41903.2 10
: 107 | 0.214149 0.222337 0.0836269 0.00719992 41870 11
:
: Elapsed time for training with 4000 events: 8.84 sec
: Dataset[dataset] : Create results for training
: Dataset[dataset] : Multiclass evaluation of DL_CPU on training sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.118 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating xml weight file: ␛[0;36mdataset/weights/TMVAMulticlass_DL_CPU.weights.xml␛[0m
: Creating standalone class: ␛[0;36mdataset/weights/TMVAMulticlass_DL_CPU.class.C␛[0m
Factory : Training finished
:
: Ranking input variables (method specific)...
BDTG : Ranking result (top variable is best ranked)
: --------------------------------------
: Rank : Variable : Variable Importance
: --------------------------------------
: 1 : var4 : 3.117e-01
: 2 : var1 : 2.504e-01
: 3 : var2 : 2.430e-01
: 4 : var3 : 1.949e-01
: --------------------------------------
MLP : Ranking result (top variable is best ranked)
: -----------------------------
: Rank : Variable : Importance
: -----------------------------
: 1 : var4 : 6.076e+01
: 2 : var2 : 4.824e+01
: 3 : var1 : 2.116e+01
: 4 : var3 : 1.692e+01
: -----------------------------
PDEFoam : Ranking result (top variable is best ranked)
: --------------------------------------
: Rank : Variable : Variable Importance
: --------------------------------------
: 1 : var4 : 2.991e-01
: 2 : var1 : 2.930e-01
: 3 : var3 : 2.365e-01
: 4 : var2 : 1.714e-01
: --------------------------------------
: No variable ranking supplied by classifier: DL_CPU
TH1.Print Name = TrainingHistory_DL_CPU_trainingError, Entries= 0, Total sum= 29.0532
TH1.Print Name = TrainingHistory_DL_CPU_valError, Entries= 0, Total sum= 28.7752
Factory : === Destroy and recreate all methods via weight files for testing ===
:
: Reading weight file: ␛[0;36mdataset/weights/TMVAMulticlass_BDTG.weights.xml␛[0m
: Reading weight file: ␛[0;36mdataset/weights/TMVAMulticlass_MLP.weights.xml␛[0m
MLP : Building Network.
: Initializing weights
: Reading weight file: ␛[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights.xml␛[0m
: Read foams from file: ␛[0;36mdataset/weights/TMVAMulticlass_PDEFoam.weights_foams.root␛[0m
: Reading weight file: ␛[0;36mdataset/weights/TMVAMulticlass_DL_CPU.weights.xml␛[0m
Factory : ␛[1mTest all methods␛[0m
Factory : Test method: BDTG for Multiclass classification performance
:
: Dataset[dataset] : Create results for testing
: Dataset[dataset] : Multiclass evaluation of BDTG on testing sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 1.01 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
Factory : Test method: MLP for Multiclass classification performance
:
: Dataset[dataset] : Create results for testing
: Dataset[dataset] : Multiclass evaluation of MLP on testing sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.0187 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
Factory : Test method: PDEFoam for Multiclass classification performance
:
: Dataset[dataset] : Create results for testing
: Dataset[dataset] : Multiclass evaluation of PDEFoam on testing sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.136 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
Factory : Test method: DL_CPU for Multiclass classification performance
:
: Dataset[dataset] : Create results for testing
: Dataset[dataset] : Multiclass evaluation of DL_CPU on testing sample
: Dataset[dataset] : Elapsed time for evaluation of 4000 events: 0.12 sec
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
Factory : ␛[1mEvaluate all methods␛[0m
: Evaluate multiclass classification method: BDTG
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
TFHandler_BDTG : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.070153 1.0224 [ -4.0592 3.5808 ]
: var2: 0.30372 1.0460 [ -3.6952 3.7877 ]
: var3: 0.12152 1.1222 [ -3.6800 3.9200 ]
: var4: -0.072602 1.2766 [ -4.8486 4.2221 ]
: -----------------------------------------------------------
: Evaluate multiclass classification method: MLP
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
TFHandler_MLP : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.070153 1.0224 [ -4.0592 3.5808 ]
: var2: 0.30372 1.0460 [ -3.6952 3.7877 ]
: var3: 0.12152 1.1222 [ -3.6800 3.9200 ]
: var4: -0.072602 1.2766 [ -4.8486 4.2221 ]
: -----------------------------------------------------------
: Evaluate multiclass classification method: PDEFoam
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
TFHandler_PDEFoam : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.070153 1.0224 [ -4.0592 3.5808 ]
: var2: 0.30372 1.0460 [ -3.6952 3.7877 ]
: var3: 0.12152 1.1222 [ -3.6800 3.9200 ]
: var4: -0.072602 1.2766 [ -4.8486 4.2221 ]
: -----------------------------------------------------------
: Evaluate multiclass classification method: DL_CPU
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
: Creating multiclass response histograms...
: Creating multiclass performance histograms...
TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.077270 0.29534 [ -1.1155 1.0914 ]
: var2: 0.068045 0.27981 [ -1.0016 1.0000 ]
: var3: 0.027548 0.24565 [ -0.80459 0.85902 ]
: var4: -0.034157 0.25816 [ -1.0000 0.83435 ]
: -----------------------------------------------------------
TFHandler_DL_CPU : Variable Mean RMS [ Min Max ]
: -----------------------------------------------------------
: var1: 0.077270 0.29534 [ -1.1155 1.0914 ]
: var2: 0.068045 0.27981 [ -1.0016 1.0000 ]
: var3: 0.027548 0.24565 [ -0.80459 0.85902 ]
: var4: -0.034157 0.25816 [ -1.0000 0.83435 ]
: -----------------------------------------------------------
:
: 1-vs-rest performance metrics per class
: -------------------------------------------------------------------------------------------------------
:
: Considers the listed class as signal and the other classes
: as background, reporting the resulting binary performance.
: A score of 0.820 (0.850) means 0.820 was acheived on the
: test set and 0.850 on the training set.
:
: Dataset MVA Method ROC AUC Sig eff@B=0.01 Sig eff@B=0.10 Sig eff@B=0.30
: Name: / Class: test (train) test (train) test (train) test (train)
:
: dataset BDTG
: ------------------------------
: Signal 0.968 (0.978) 0.508 (0.605) 0.914 (0.945) 0.990 (0.996)
: bg0 0.910 (0.931) 0.256 (0.288) 0.737 (0.791) 0.922 (0.956)
: bg1 0.947 (0.954) 0.437 (0.511) 0.833 (0.856) 0.971 (0.971)
: bg2 0.978 (0.982) 0.585 (0.678) 0.951 (0.956) 0.999 (0.996)
:
: dataset MLP
: ------------------------------
: Signal 0.970 (0.975) 0.596 (0.632) 0.933 (0.938) 0.988 (0.993)
: bg0 0.929 (0.934) 0.303 (0.298) 0.787 (0.793) 0.949 (0.961)
: bg1 0.962 (0.967) 0.467 (0.553) 0.881 (0.906) 0.985 (0.992)
: bg2 0.975 (0.979) 0.629 (0.699) 0.929 (0.940) 0.998 (0.998)
:
: dataset PDEFoam
: ------------------------------
: Signal 0.916 (0.928) 0.294 (0.382) 0.744 (0.782) 0.932 (0.952)
: bg0 0.837 (0.848) 0.109 (0.147) 0.519 (0.543) 0.833 (0.851)
: bg1 0.890 (0.902) 0.190 (0.226) 0.606 (0.646) 0.923 (0.929)
: bg2 0.967 (0.972) 0.510 (0.527) 0.900 (0.926) 0.993 (0.998)
:
: dataset DL_CPU
: ------------------------------
: Signal 0.974 (0.975) 0.569 (0.647) 0.940 (0.939) 0.993 (0.994)
: bg0 0.925 (0.930) 0.313 (0.301) 0.780 (0.776) 0.940 (0.955)
: bg1 0.962 (0.964) 0.492 (0.513) 0.890 (0.890) 0.984 (0.987)
: bg2 0.977 (0.976) 0.663 (0.675) 0.916 (0.913) 0.999 (0.998)
:
: -------------------------------------------------------------------------------------------------------
:
:
: Confusion matrices for all methods
: -------------------------------------------------------------------------------------------------------
:
: Does a binary comparison between the two classes given by a
: particular row-column combination. In each case, the class
: given by the row is considered signal while the class given
: by the column index is considered background.
:
: === Showing confusion matrix for method : BDTG
: (Signal Efficiency for Background Efficiency 0.01%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.497 (0.373) 0.710 (0.693) 0.680 (0.574)
: bg0 0.271 (0.184) - 0.239 (0.145) 0.705 (0.667)
: bg1 0.855 (0.766) 0.369 (0.222) - 0.587 (0.578)
: bg2 0.714 (0.585) 0.705 (0.581) 0.648 (0.601) -
:
: (Signal Efficiency for Background Efficiency 0.10%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.911 (0.853) 0.991 (0.981) 0.945 (0.913)
: bg0 0.833 (0.774) - 0.654 (0.582) 0.930 (0.901)
: bg1 0.971 (0.980) 0.716 (0.681) - 0.871 (0.862)
: bg2 0.976 (0.951) 0.971 (0.973) 0.936 (0.941) -
:
: (Signal Efficiency for Background Efficiency 0.30%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.978 (0.957) 0.999 (1.000) 0.998 (0.997)
: bg0 0.965 (0.926) - 0.874 (0.835) 0.991 (0.976)
: bg1 1.000 (0.999) 0.916 (0.894) - 0.988 (0.985)
: bg2 0.999 (0.999) 0.997 (0.999) 0.996 (0.997) -
:
: === Showing confusion matrix for method : MLP
: (Signal Efficiency for Background Efficiency 0.01%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.465 (0.490) 0.974 (0.953) 0.632 (0.498)
: bg0 0.320 (0.269) - 0.224 (0.250) 0.655 (0.627)
: bg1 0.943 (0.920) 0.341 (0.275) - 0.632 (0.687)
: bg2 0.665 (0.642) 0.697 (0.680) 0.706 (0.598) -
:
: (Signal Efficiency for Background Efficiency 0.10%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.865 (0.854) 0.996 (0.994) 0.908 (0.907)
: bg0 0.784 (0.776) - 0.666 (0.655) 0.919 (0.895)
: bg1 0.998 (0.998) 0.791 (0.785) - 0.912 (0.902)
: bg2 0.943 (0.903) 0.946 (0.939) 0.924 (0.928) -
:
: (Signal Efficiency for Background Efficiency 0.30%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.978 (0.964) 0.997 (0.997) 0.993 (0.986)
: bg0 0.952 (0.924) - 0.936 (0.928) 0.992 (0.990)
: bg1 1.000 (1.000) 0.945 (0.936) - 0.998 (0.995)
: bg2 0.994 (0.985) 0.998 (0.998) 0.998 (0.998) -
:
: === Showing confusion matrix for method : PDEFoam
: (Signal Efficiency for Background Efficiency 0.01%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.289 (0.233) 0.467 (0.436) 0.421 (0.332)
: bg0 0.100 (0.045) - 0.132 (0.116) 0.540 (0.313)
: bg1 0.209 (0.434) 0.153 (0.092) - 0.347 (0.323)
: bg2 0.560 (0.552) 0.445 (0.424) 0.501 (0.506) -
:
: (Signal Efficiency for Background Efficiency 0.10%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.665 (0.640) 0.854 (0.822) 0.807 (0.790)
: bg0 0.538 (0.520) - 0.415 (0.374) 0.843 (0.833)
: bg1 0.885 (0.886) 0.542 (0.491) - 0.728 (0.646)
: bg2 0.928 (0.890) 0.956 (0.959) 0.847 (0.895) -
:
: (Signal Efficiency for Background Efficiency 0.30%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.898 (0.878) 0.971 (0.950) 0.982 (0.975)
: bg0 0.828 (0.810) - 0.696 (0.676) 0.954 (0.951)
: bg1 0.951 (0.966) 0.803 (0.745) - 0.958 (0.966)
: bg2 0.998 (0.991) 0.998 (0.996) 0.998 (0.993) -
:
: === Showing confusion matrix for method : DL_CPU
: (Signal Efficiency for Background Efficiency 0.01%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.452 (0.388) 0.922 (0.926) 0.690 (0.645)
: bg0 0.309 (0.381) - 0.209 (0.218) 0.574 (0.542)
: bg1 0.913 (0.893) 0.310 (0.284) - 0.565 (0.648)
: bg2 0.658 (0.653) 0.677 (0.670) 0.667 (0.660) -
:
: (Signal Efficiency for Background Efficiency 0.10%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.880 (0.886) 0.989 (0.992) 0.918 (0.911)
: bg0 0.776 (0.766) - 0.694 (0.710) 0.868 (0.849)
: bg1 0.985 (0.984) 0.798 (0.797) - 0.856 (0.890)
: bg2 0.926 (0.901) 0.918 (0.922) 0.902 (0.921) -
:
: (Signal Efficiency for Background Efficiency 0.30%)
: ---------------------------------------------------
: Signal bg0 bg1 bg2
: test (train) test (train) test (train) test (train)
: Signal - 0.974 (0.977) 0.999 (0.999) 0.997 (0.996)
: bg0 0.950 (0.929) - 0.913 (0.906) 0.985 (0.977)
: bg1 0.999 (0.996) 0.954 (0.952) - 0.998 (0.993)
: bg2 0.998 (0.997) 0.999 (0.999) 0.999 (0.999) -
:
: -------------------------------------------------------------------------------------------------------
:
Dataset:dataset : Created tree 'TestTree' with 4000 events
:
Dataset:dataset : Created tree 'TrainTree' with 4000 events
:
Factory : ␛[1mThank you for using TMVA!␛[0m
: ␛[1mFor citation information, please visit: http://tmva.sf.net/citeTMVA.html␛[0m
==> Wrote root file: TMVAMulticlass.root
==> TMVAMulticlass is done!
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TMVA/Tools.h"
#include "TMVA/Factory.h"
using namespace TMVA;
void TMVAMulticlass( TString myMethodList = "" )
{
// This loads the library
// to get access to the GUI and all tmva macros
//
// TString tmva_dir(TString(gRootDir) + "/tmva");
// if(gSystem->Getenv("TMVASYS"))
// tmva_dir = TString(gSystem->Getenv("TMVASYS"));
// gROOT->SetMacroPath(tmva_dir + "/test/:" + gROOT->GetMacroPath() );
// gROOT->ProcessLine(".L TMVAMultiClassGui.C");
//---------------------------------------------------------------
// Default MVA methods to be trained + tested
std::map<std::string,int> Use;
Use["MLP"] = 1;
Use["BDTG"] = 1;
#ifdef R__HAS_TMVAGPU
Use["DL_CPU"] = 1;
Use["DL_GPU"] = 1;
#else
Use["DL_CPU"] = 1;
Use["DL_GPU"] = 0;
#endif
Use["FDA_GA"] = 0;
Use["PDEFoam"] = 1;
//---------------------------------------------------------------
std::cout << std::endl;
std::cout << "==> Start TMVAMulticlass" << std::endl;
if (myMethodList != "") {
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
std::vector<TString> mlist = TMVA::gTools().SplitString( myMethodList, ',' );
for (UInt_t i=0; i<mlist.size(); i++) {
std::string regMethod(mlist[i]);
if (Use.find(regMethod) == Use.end()) {
std::cout << "Method \"" << regMethod << "\" not known in TMVA under this name. Choose among the following:" << std::endl;
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << " ";
std::cout << std::endl;
return;
}
Use[regMethod] = 1;
}
}
// Create a new root output file.
TString outfileName = "TMVAMulticlass.root";
TFile* outputFile = TFile::Open( outfileName, "RECREATE" );
TMVA::Factory *factory = new TMVA::Factory( "TMVAMulticlass", outputFile,
"!V:!Silent:Color:DrawProgressBar:Transformations=I;D;P;G,D:AnalysisType=multiclass" );
TMVA::DataLoader *dataloader=new TMVA::DataLoader("dataset");
dataloader->AddVariable( "var1", 'F' );
dataloader->AddVariable( "var2", "Variable 2", "", 'F' );
dataloader->AddVariable( "var3", "Variable 3", "units", 'F' );
dataloader->AddVariable( "var4", "Variable 4", "units", 'F' );
TFile *input(0);
TString fname = "./tmva_example_multiclass.root";
if (!gSystem->AccessPathName( fname )) {
input = TFile::Open( fname ); // check if file in local directory exists
}
else {
input = TFile::Open("http://root.cern.ch/files/tmva_multiclass_example.root", "CACHEREAD");
}
if (!input) {
std::cout << "ERROR: could not open data file" << std::endl;
exit(1);
}
std::cout << "--- TMVAMulticlass: Using input file: " << input->GetName() << std::endl;
TTree *signalTree = (TTree*)input->Get("TreeS");
TTree *background0 = (TTree*)input->Get("TreeB0");
TTree *background1 = (TTree*)input->Get("TreeB1");
TTree *background2 = (TTree*)input->Get("TreeB2");
gROOT->cd( outfileName+TString(":/") );
dataloader->AddTree (signalTree,"Signal");
dataloader->AddTree (background0,"bg0");
dataloader->AddTree (background1,"bg1");
dataloader->AddTree (background2,"bg2");
dataloader->PrepareTrainingAndTestTree( "", "SplitMode=Random:NormMode=NumEvents:!V" );
if (Use["BDTG"]) // gradient boosted decision trees
factory->BookMethod( dataloader, TMVA::Types::kBDT, "BDTG", "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.10:UseBaggedBoost:BaggedSampleFraction=0.50:nCuts=20:MaxDepth=2");
if (Use["MLP"]) // neural network
factory->BookMethod( dataloader, TMVA::Types::kMLP, "MLP", "!H:!V:NeuronType=tanh:NCycles=1000:HiddenLayers=N+5,5:TestRate=5:EstimatorType=MSE");
if (Use["FDA_GA"]) // functional discriminant with GA minimizer
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" );
if (Use["PDEFoam"]) // PDE-Foam approach
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" );
if (Use["DL_CPU"]) {
TString layoutString("Layout=TANH|100,TANH|50,TANH|10,LINEAR");
TString trainingStrategyString("TrainingStrategy=Optimizer=ADAM,LearningRate=1e-3,"
"TestRepetitions=1,ConvergenceSteps=10,BatchSize=100");
TString nnOptions("!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:"
"WeightInitialization=XAVIERUNIFORM:Architecture=GPU");
nnOptions.Append(":");
nnOptions.Append(layoutString);
nnOptions.Append(":");
nnOptions.Append(trainingStrategyString);
factory->BookMethod(dataloader, TMVA::Types::kDL, "DL_CPU", nnOptions);
}
if (Use["DL_GPU"]) {
TString layoutString("Layout=TANH|100,TANH|50,TANH|10,LINEAR");
TString trainingStrategyString("TrainingStrategy=Optimizer=ADAM,LearningRate=1e-3,"
"TestRepetitions=1,ConvergenceSteps=10,BatchSize=100");
TString nnOptions("!H:V:ErrorStrategy=CROSSENTROPY:VarTransform=N:"
"WeightInitialization=XAVIERUNIFORM:Architecture=GPU");
nnOptions.Append(":");
nnOptions.Append(layoutString);
nnOptions.Append(":");
nnOptions.Append(trainingStrategyString);
factory->BookMethod(dataloader, TMVA::Types::kDL, "DL_GPU", nnOptions);
}
// Train MVAs using the set of training events
factory->TrainAllMethods();
// Evaluate all MVAs using the set of test events
factory->TestAllMethods();
// Evaluate and compare performance of all configured MVAs
factory->EvaluateAllMethods();
// --------------------------------------------------------------
// Save the output
outputFile->Close();
std::cout << "==> Wrote root file: " << outputFile->GetName() << std::endl;
std::cout << "==> TMVAMulticlass is done!" << std::endl;
delete factory;
delete dataloader;
// Launch the GUI for the root macros
if (!gROOT->IsBatch()) TMVAMultiClassGui( outfileName );
}
int main( int argc, char** argv )
{
// Select methods (don't look at this code - not of interest)
TString methodList;
for (int i=1; i<argc; i++) {
TString regMethod(argv[i]);
if(regMethod=="-b" || regMethod=="--batch") continue;
if (!methodList.IsNull()) methodList += TString(",");
methodList += regMethod;
}
TMVAMulticlass(methodList);
return 0;
}
unsigned int UInt_t
Definition: CPyCppyy.h:44
#define gROOT
Definition: TROOT.h:404
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition: TFile.h:324
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:4011
void Close(Option_t *option="") override
Close a file.
Definition: TFile.cxx:889
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
Definition: DataLoader.cxx:632
void AddTree(TTree *tree, const TString &className, Double_t weight=1.0, const TCut &cut="", Types::ETreeType tt=Types::kMaxTreeType)
Definition: DataLoader.cxx:351
void AddVariable(const TString &expression, const TString &title, const TString &unit, char type='F', Double_t min=0, Double_t max=0)
user inserts discriminating variable in data set info
Definition: DataLoader.cxx:485
This is the main MVA steering class.
Definition: Factory.h:80
void TrainAllMethods()
Iterates through all booked methods and calls training.
Definition: Factory.cxx:1114
MethodBase * BookMethod(DataLoader *loader, TString theMethodName, TString methodTitle, TString theOption="")
Book a classifier or regression method.
Definition: Factory.cxx:352
void TestAllMethods()
Evaluates all booked methods on the testing data and adds the output to the Results in the corresponi...
Definition: Factory.cxx:1271
void EvaluateAllMethods(void)
Iterates over all MVAs that have been booked, and calls their evaluation methods.
Definition: Factory.cxx:1376
static Tools & Instance()
Definition: Tools.cxx:75
std::vector< TString > SplitString(const TString &theOpt, const char separator) const
splits the option string at 'separator' and fills the list 'splitV' with the primitive strings
Definition: Tools.cxx:1211
@ kFDA
Definition: Types.h:94
@ kBDT
Definition: Types.h:88
@ kPDEFoam
Definition: Types.h:96
@ kMLP
Definition: Types.h:92
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Basic string class.
Definition: TString.h:136
Bool_t IsNull() const
Definition: TString.h:407
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1296
A TTree represents a columnar dataset.
Definition: TTree.h:79
int main()
create variable transformations
Tools & gTools()
void TMVAMultiClassGui(const char *fName="TMVAMulticlass.root", TString dataset="")
Author
Andreas Hoecker

Definition in file TMVAMulticlass.C.