91
1 1 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010 P. Speckmayer ― Multivariate Data Analysis with TMVA Multivariate Data Analysis with TMVA Peter Speckmayer ( * ) (CERN) LCD Seminar, CERN, April 14, 2010 ( * ) On behalf of the present core developer team: A. Hoecker, P. Speckmayer, J. Stelzer, J. Therhaag, E. v. Toerne, H. Voss And the contributors: Tancredi Carli (CERN, Switzerland), Asen Christov (Universität Freiburg, Germany), Krzysztof Danielowski (IFJ and AGH/UJ, Krakow, Poland), Dominik Dannheim (CERN, Switzerland), Sophie Henrot-Versille (LAL Orsay, France), Matthew Jachowski (Stanford University, USA), Kamil Kraszewski (IFJ and AGH/UJ, Krakow, Poland), Attila Krasznahorkay Jr. (CERN, Switzerland, and Manchester U., UK), Maciej Kruk (IFJ and AGH/UJ, Krakow, Poland), Yair Mahalalel (Tel Aviv University, Israel), Rustem Ospanov (University of Texas, USA), Xavier Prudent (LAPP Annecy, France), Arnaud Robert (LPNHE Paris, France), Doug Schouten (S. Fraser University, Canada), Fredrik Tegenfeldt (Iowa University, USA, until Aug 2007), Jan Therhaag (Universität Bonn, Germany), Alexander Voigt (CERN, Switzerland), Kai Voss (University of Victoria, Canada), Marcin Wolter (IFJ PAN Krakow, Poland), Andrzej Zemla (IFJ PAN Krakow, Poland). On the web: http://tmva.sf.net / (home), https://twiki.cern.ch/twiki/bin/view/TMVA/WebHome (tutorial)

11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

Embed Size (px)

Citation preview

Page 1: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

1 1 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010 P. Speckmayer ― Multivariate Data Analysis with TMVA

Multivariate Data Analysis with TMVA

Peter Speckmayer (*) (CERN)

LCD Seminar, CERN, April 14, 2010

(*) On behalf of the present core developer team: A. Hoecker, P. Speckmayer, J. Stelzer, J. Therhaag, E. v. Toerne, H. Voss

And the contributors: Tancredi Carli (CERN, Switzerland), Asen Christov (Universität Freiburg, Germany), Krzysztof Danielowski (IFJ and AGH/UJ, Krakow, Poland), Dominik Dannheim (CERN, Switzerland), Sophie Henrot-Versille (LAL Orsay, France), Matthew Jachowski (Stanford University, USA), Kamil Kraszewski (IFJ and AGH/UJ, Krakow, Poland), Attila Krasznahorkay Jr. (CERN, Switzerland, and Manchester U., UK), Maciej Kruk (IFJ and AGH/UJ, Krakow, Poland), Yair Mahalalel (Tel Aviv University, Israel), Rustem Ospanov (University of Texas, USA), Xavier Prudent (LAPP Annecy, France), Arnaud Robert (LPNHE Paris, France), Doug Schouten (S. Fraser University, Canada), Fredrik Tegenfeldt (Iowa University, USA, until Aug 2007), Jan Therhaag (Universität Bonn, Germany), Alexander Voigt (CERN, Switzerland), Kai Voss (University of Victoria, Canada), Marcin Wolter (IFJ PAN Krakow, Poland), Andrzej Zemla (IFJ PAN Krakow, Poland).

On the web: http://tmva.sf.net/ (home), https://twiki.cern.ch/twiki/bin/view/TMVA/WebHome (tutorial)

Page 2: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

2 2 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 2 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Outline

Introduction: the reasons why we need “sophisticated” data analysis algorithms the classification/(regression) problem what is Multivariate Data Analysis and Machine Learning a little bit of statistics

Classifiers in TMVA Cuts Kernel Methods and Likelihood Estimators Linear Fisher Discriminant Neural Networks Support Vector Machines BoostedDecision Trees General boosting Category classifier

TMVA Using TMVA Toy examples

Page 3: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

3 3 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 3 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Literature / Software packages

... a short/biased selection

Literature T.Hastie, R.Tibshirani, J.Friedman, “The Elements of Statistical Learning”, Springer 2001

C.M.Bishop, “Pattern Recognition and Machine Learning”, Springer 2006

Software packages for Mulitvariate Data Analysis/Classification individual classifier software

e.g. “JETNET” C.Peterson, T. Rognvaldsson, L.Loennblad

attempts to provide “all inclusive” packages StatPatternRecognition: I.Narsky, arXiv: physics/0507143

http://www.hep.caltech.edu/~narsky/spr.html

TMVA: Höcker,Speckmayer,Stelzer,Therhaag, v.Toerne,Voss, arXiv: physics/0703039 http:// tmva.sf.net or every ROOT distribution (not necessarily the latest TMVA version though)

WEKA: http://www.cs.waikato.ac.nz/ml/weka/

Huge data analysis library available in “R”: http://www.r-project.org/

Conferences: PHYSTAT, ACAT, CHEP…

Page 4: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

4 4 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 4 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Event Classification in High-Energy Physics (HEP)

Most HEP analyses require discrimination of signal from background:

Event level (Higgs searches, …) Cone level (Tau-vs-jet reconstruction, …)Track level (particle identification, …) Lifetime and flavour tagging (b-tagging, …)Parameter estimation (CP violation in B system, …)etc.

The multivariate input information used for this has various sources

Kinematic variables (masses, momenta, decay angles, …) Event properties (jet/lepton multiplicity, sum of charges, …)Event shape (sphericity, Fox-Wolfram moments, …)Detector response (silicon hits, dE/dx, Cherenkov angle, shower profiles, muon hits, …)etc.

Traditionally few powerful input variables were combined; new methods

allow to use up to 100 and more variables w/o loss of classification powere.g. MiniBooNE: NIMA 543 (2005), or D0 single top: Phys.Rev. D78, 012005 (2008)

Page 5: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

5 5 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 5 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Regression

Energy deposit in a the calorimeter, distance between overlapping photons, …

Entry location of the particle in the calorimeter or on a silicon pad, …

How to estimate a “functional behaviour” from a set of measurements?

x

f(x)

x

f(x)

x

f(x)

Seems trivial? human eye has good pattern recognition

What if we have many input variables?

Linear function ? Nonlinear ?Constant ?

Page 6: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

6 6 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 6 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Regression model functional behaviour

x

f(x)

Assume for example “D”-variables that somehow characterize the shower in your calorimeter. Monte Carlo or testbeam

data sample with measured cluster observables + known particle energy= calibration function (energy == surface in D+1 dimensional space)

1-D example 2-D example

better known: (linear) regression fit a known analytic function e.g. the above 2-D example reasonable function would be: f(x) = ax2+by2+c

what if we don’t have a reasonable “model” ? need something more general: e.g. piecewise defined splines, kernel estimators, decision trees to approximate f(x)

xy

f(x,y)

events generated according: underlying distribution

Page 7: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

7 7 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 7 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

A linear boundary? A nonlinear one?

Event Classification

We have found discriminating input variables x1, x2, …

What decision boundary should we use to select events of type H1?

Rectangular cuts?

H1

H0

x1

x2 H1

H0

x1

x2 H1

H0

x1

x2

How can we decide this in an optimal way ? Let the machine learn it !

Suppose data sample with two types of events: H0, H1

Low variance (stable), high bias methods High variance, small bias methods

Page 8: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

8 8 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 8 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

y(x)

Multivariate Classification

8

multiple input variables

… to one classifier output*

separate into classes

position of the cut depends on the type of study

choose a cut value on the classifier y

RN R {C1,C2}

*Cut classifier is an exception: Direct mapping from RN {Signal,Background}

Page 9: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

9 9 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 9 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

y(x)

Multivariate Classification

9

multiple input variables

… to one classifier output*

separate into classes

position of the cut depends on the type of study

choose a cut value on the classifier y

RN R {C1,C2}

*Cut classifier is an exception: Direct mapping from RN {Signal,Background}

• Distributions of y(x): PDFS(y) and PDFB(y)

• y(x) = const: surface defining the decision boundary.

• Overlap of PDFS(y) and PDFB(y) affects separation power, purity

Page 10: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

10 10 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 10 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Event Classification

P(Class=C|x) (or simply P(C|x)) : probability that the event class is of type C, giventhe measured

observables x = {x1,….,xD} y(x)

Prior probability to observe an event of “class C”, i.e., the relative abundance of “signal” versus “background”

Overall probability density to observe the actual measurement y(x), i.e.,

Probability density distribution according to the measurements x and the given mapping function

Posterior probability

P(y)

)P()P(y)yP

CCCClass(

Classes

CC(C

)P()P(yy)P

Page 11: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

11 11 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 11 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Bayes Optimal Classification

P(y | C)P(C)P(Class = C | y) =

P(y)+Minimum error in misclassification if C chosen such that it has maximum P(C|y)

to select S(ignal) over B(ackground), place decision on:

P(S | y) P(y | S) P(S)c

P(B | y) P(y | B) P(B)

Likelihood ratio as discriminating

function y(x)

Prior odds ratio of choosing a signal event(relative probability of signal vs. bkg)

“c” determines efficiency and purity

x={x1,….,xD}: measured observablesy = y(x)

[ Or any monotonic function of P(S|y) / P(B|y) ]

Posterior odds ratio

Page 12: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

12 12 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 12 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Trying to select signal events:(i.e. try to disprove the null-hypothesis stating it were “only” a background event)

Type-2 error: (false negative)fail to identify an event from Class C as such(reject a hypothesis although it would have been true)(fail to reject the null-hypothesis/accept null hypothesis although it is false)

loss of efficiency (in selecting signal events)

Decide to treat an event as “Signal” or “Background”

Signal Back-ground

Signal Type-2 error

Back-ground

Type-1 error

accept as:truly is:

Significance α: Type-1 error rate:(=p-value): α = background selection “efficiency”

miss rate β: Type-2 error rate:Power: 1- β = signal selection efficiency

“A”: region of the outcome of the test where you accept the event as signal:

should be small

should be small

Type-1 error: (false positive)classify event as Class C even though it is not(accept a hypothesis although it is not true)(reject the null-hypothesis although it would have been the correct one)

loss of purity (in the selection of signal events)

Any Decision Involves a Risk

A

dxBxP )|(

A

dxSxP!

)|(

Page 13: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

13 13 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 13 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Neyman-Pearson Lemma

Neyman-Peason:

The Likelihood ratio used as “selection criterion” y(x) gives for each selection efficiency the best possible background rejection. (1933)

i.e. it maximises the area under the “Receiver Operation Characteristics” (ROC) curve

Varying y(x)>“cut” moves the working point (efficiency and purity) along the ROC curve

How to choose “cut”? need to know prior probabilities (S, B abundances) • Measurement of signal cross section: maximum of S/√(S+B) or equiv. √(e·p)• Discovery of a signal : maximum of S/√(B)• Precision measurement: high purity (p)• Trigger selection: high efficiency ( )e

P(x | S)Likelihood Ratio : y(x)

P(x | B)

0 1

1

0

1- e

ba

ckg

r.

esignal

random guessing

good classification

better classification

“limit” in ROC curve

given by likelihood ratio

few false positivesmany missed

many false positivesfew missed

Page 14: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

14 14 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 14 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Neyman-Pearson Lemma

Note:

for the determination of your working point (e.g. S/ √(B))

you need the prior S and B probabilities!

number of events/luminosity

0 1

1

0

1- e

ba

ckg

r.

esignal

“limit” in ROC curve

given by likelihood ratio

y(x) y(x)

if discriminating function y(x)=“true likelihood ratio”

optimal working point for specific analysis lies

somewhere on the ROC curve

y(x)≠“true likelihood ratio” different, point on

y(x) might be better for a specific working point than y(x) and vice versa

Page 15: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

15 15 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 15 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Realistic Event Classification

Unfortunately, the true probability densities functions are typically unknown: Neyman-Pearson’s lemma doesn’t really help us…

supervised (machine) learning

* hyperplane in the strict sense goes through the origin. Here is meant an “affine set” to be precise.

Use MC simulation, or more generally: set of known (already classified) “events”

Use these “training” events to:

• Try to estimate the functional form of P(x|C) from which the likelihood ratio can be obtained

e.g. D-dimensional histogram, Kernel densitiy estimators, MC-based matrix-element methods, …

• Find a “discrimination function” y(x) and corresponding decision boundary (i.e. hyperplane* in the “feature space”: y(x) = const) that optimally separates signal from background

e.g. Linear Discriminator, Neural Networks, …

Page 16: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

16 16 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 16 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Realistic Event Classification

Unfortunately, the true probability densities functions are typically unknown: Neyman-Pearson’s lemma doesn’t really help us…

supervised (machine) learning

* hyperplane in the strict sense goes through the origin. Here is meant an “affine set” to be precise.

Use MC simulation, or more generally: set of known (already classified) “events”

Use these “training” events to:

• Try to estimate the functional form of P(x|C) from which the likelihood ratio can be obtained

e.g. D-dimensional histogram, Kernel densitiy estimators, MC-based matrix-element methods, …

• Find a “discrimination function” y(x) and corresponding decision boundary (i.e. hyperplane* in the “feature space”: y(x) = const) that optimally separates signal from background

e.g. Linear Discriminator, Neural Networks, …

Of course, there is no magic in here. We still need to:• Choose the discriminating variables• Choose the class of models (linear, non-linear, flexible or less flexible)• Tune the “learning parameters” bias vs. variance trade off• Check generalisation properties• Consider trade off between statistical and systematic uncertainties

Page 17: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

17 17 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 17 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

What is TMVA

ROOT: is the analysis framework used by most (HEP)-physicists

Idea: rather than just implementing new MVA techniques and making

them available in ROOT (i.e., like TMulitLayerPercetron does):

Have one common platform / interface for high-end multivariate classifiers

Have common data pre-processing capabilities

Train and test all classifiers on same data sample and evaluate consistently

Provide common analysis (ROOT scripts) and application framework

Provide access with and without ROOT, through macros, C++ executables or python

Page 18: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

18 18 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 18 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Multivariate Analysis Methods Examples for classifiers and regression methods– Rectangular cut optimisation

– Projective and multidimensional likelihood estimator

– k-Nearest Neighbor algorithm

– Fisher, Linear and H-Matrix discriminants

– Function discriminants

– Artificial neural networks

– Boosted decision trees

– RuleFit

– Support Vector Machine

Examples for preprocessing methods:

– Decorrelation, Principal Value Decomposition, Gaussianisation

Examples for combination methods:

– Boosting, Categorisation

Page 19: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

19 19 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 19 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

D a t a P r e p r o c e s s i n gD a t a P r e p r o c e s s i n g

Page 20: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

20 20 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 20 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Data Preprocessing: Decorrelation

Commonly realised for all methods in TMVA

Removal of linear correlations by rotating input variables

Cholesky decomposition: determine square-root C of covariance matrix C, i.e., C = CC

Transform original (x) into decorrelated variable space (x) by: x = C 1x

Principal component analysis

Variable hierarchy: linear transformation projecting on axis to achieve largest variance

PC ( )event event

variables

variab , leskk v v v

v

kix x vi x

PC of variable k Sample means

Eigenvector

Matrix of eigenvectors V obeys relation: thus PCA eliminates correlations C V D V

correlation matrix diagonalised square root of C

Page 21: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

21 21 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 21 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

originaloriginal SQRT derorr.SQRT derorr. PCA derorr.PCA derorr.

Note that decorrelation is only complete, if Correlations are linear

Input variables are Gaussian distributed

Not very accurate conjecture in general

Data Preprocessing: Decorrelation

Page 22: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

22 22 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 22 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

“Gaussian-isation”

Improve decorrelation by pre-”Gaussianisation” of variables

First: “Rarity” transformation to achieve uniform distribution:

event

evefl

ntat variabl , es

kx

k k

i

k kix p x kx d

Rarity transform of variable k Measured value PDF of variable k

Second: make Gaussian via inverse error function:

Gauss 1 flevent even

at

t 2 erf 2 1 var iables,k ki i kx x

2

0

2erf

xte tx d

The integral can be solved in an unbinned way by event counting,

or by creating non-parametric PDFs (see later for likelihood section)

Page 23: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

23 23 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 23 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

OriginalOriginal

“Gaussian-isation”

Signal - GaussianisedSignal - Gaussianised

We cannot simultaneously “gaussianise” both signal and background !

Background - GaussianisedBackground - Gaussianised

Page 24: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

24 24 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 24 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

How to apply the Preprocessing Transformation ?

Any type of preprocessing will be different for signal and background

But: for a given test event, we do not know the species !

Not so good solution: choose one or the other, or a S/B mixture.

As a result, none of the transformations will be perfect. for most of the methods

Good solution: for some methods it is possible to test both S and B hypotheses with

their transformations, and to compare them. Example, projective likelihood ratio:

variables

variables variable

tr

event

event

eves

nt ev

an

e t

s

n

ˆ (

ˆ ˆ(

)

) )(

k kk

k k

S S

Sk k

k

S B B

k

L

p T x

yp

i

iT x ip T xi

event

eventev

variables

variables variaent even

est

bl

)

) )

(

( (L

k kk

k k k kk k

S

S B

p x

yp x p

i

ii ix

signal transformation

background transformation

Page 25: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

25 25 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 25 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

T h e C l a s s i f i e r sT h e C l a s s i f i e r s

Page 26: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

26 26 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 26 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Rectangular Cut Optimisation

Simplest method: cut in rectangular variable volume

Technical challenge: how to find optimal cuts ? MINUIT fails due to non-unique solution space

TMVA uses: Monte Carlo sampling, Genetic Algorithm, Simulated Annealing

Huge speed improvement of volume search by sorting events in binary tree

Cuts usually benefit from prior decorrelation of cut variables

cut ,minevent evevariabl

,maes

nt x0,1 ,v v vv

x i x xi x

Page 27: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

27 27 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 27 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Projective Likelihood Estimator (PDE Approach)

Much liked in HEP: probability density estimators for

each input variable combined in likelihood estimator

eventvariables

variable

signal

species

event

events

)

)

(

(U

L

kU

k kk

k k

i

i

i

p x

y

p x

discriminating variables

Species: signal, background types

Likelihood ratio for event ievent

PDFs

Ignores correlations between input variables Optimal approach if correlations are zero (or linear decorrelation)

Otherwise: significant performance loss

PDE introduces fuzzy logic

Page 28: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

28 28 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 28 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

PDE Approach: Estimating PDF Kernels

Technical challenge: how to estimate the PDF shapes

Automatic, unbiased, but suboptimal

Easy to automate, can create artefacts/suppress information

Difficult to automate for arbitrary PDFs

3 ways: parametric fitting (function) nonparametric fitting event counting

We have chosen to implement nonparametric fitting in TMVA

Binned shape interpolation using spline functions and adaptive smoothing

Unbinned adaptive kernel density estimation (KDE) with Gaussian smearing

TMVA performs automatic validation of goodness-of-fit

original distribution is Gaussian

Page 29: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

29 29 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 29 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Multidimensional PDE Approach

Use a single PDF per event class (sig, bkg), which spans Nvar dimensions

PDE Range-Search: count number of signal and background events in “vicinity” of test event preset or adaptive volume defines “vicinity”

Carli-Koblitz, NIM A501, 576 (2003)

H1

H0

x1

x2

test event

eventPDERS , 0.86y i V

Improve yPDERS estimate within V by using various Nvar-D kernel estimators

Enhance speed of event counting in volume by binary tree search

Page 30: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

30 30 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 30 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Multidimensional PDE Approach

Use a single PDF per event class (sig, bkg), which spans Nvar dimensions

PDE Range-Search: count number of signal and background events in “vicinity” of test event preset or adaptive volume defines “vicinity”

Carli-Koblitz, NIM A501, 576 (2003)

H1

H0

x1

x2

test event

eventPDERS , 0.86y i V

Improve yPDERS estimate within V by using various Nvar-D kernel estimators

Enhance speed of event counting in volume by binary tree search

k-Nearest Neighbor

Better than searching within a volume (fixed or floating), count adjacent reference events till statistically significant number reached

Method intrinsically adaptive Very fast search with kd-tree event sorting

Page 31: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

31 31 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 31 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

H1

H0

x1

x2 H1

H0

x1

x2 H1

H0

x1

x2 H1

H0

x1

x2

Fisher’s Linear Discriminant Analysis (LDA)

Well known, simple and elegant classifier

LDA determines axis in the input variable hyperspace such that a projection of events onto this axis pushes signal and background as far away from each other as possible, while confining events of same class in close vicinity to each other

Classifier response couldn’t be simpler:

event evevari

Fabl

i 0e

nts

k kk

i iy F x F

“Fisher coefficients”

Compute Fisher coefficients from signal and background covariance matrices

Fisher requires distinct sample means between signal and background

Optimal classifier (Bayes limit) for linearly correlated Gaussian-distributed variables

“Bias”

Page 32: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

32 32 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 32 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

H1

H0

x1

x2 H1

H0

x1

x2 H1

H0

x1

x2 H1

H0

x1

x2

Fisher’s Linear Discriminant Analysis (LDA)

Well known, simple and elegant classifier

LDA determines axis in the input variable hyperspace such that a projection of events onto this axis pushes signal and background as far away from each other as possible, while confining events of same class in close vicinity to each other

Classifier response couldn’t be simpler:

event evevari

Fabl

i 0e

nts

k kk

i iy F x F

“Fisher coefficients”

Compute Fisher coefficients from signal and background covariance matrices

Fisher requires distinct sample means between signal and background

Optimal classifier (Bayes limit) for linearly correlated Gaussian-distributed variables

“Bias”

Function discriminant analysis (FDA)

Fit any user-defined function of input variables requiring that signal events return 1 and background 0

Parameter fitting: Genetics Alg., MINUIT, MC and combinations Easy reproduction of Fisher result, but can add nonlinearities Very transparent discriminator

Page 33: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

33 33 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 33 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Nonlinear Analysis: Artificial Neural Networks

Achieve nonlinear classifier response by “activating” output nodes using nonlinear weights

1( ) 1 xA x e

1

i

. . .N

1 input layer k hidden layers 1 ouput layer

1

j

M1

. . .

. . . 1

. . .Mk

2 output classes (signal and background)

Nvar discriminating input variables

11w

ijw

1jw. . .. . .

1( ) ( ) ( ) ( 1)

01

kMk k k k

j j ij ii

x w w xA

var

(0)1..i Nx

( 1)1,2kx

(“Activation” function)

with:

Fee

d-fo

rwar

d M

ultil

ayer

Per

cept

ron

Weight adjustment using analytical back-propagation

TMlpANN: Interface to ROOT’s MLP implementation

MLP: TMVA’s own MLP implementation for increased speed and flexibility

CFMlpANN: ALEPH’s Higgs search ANN, translated from FORTRAN

Three different implementations in TMVA (all are Multilayer Perceptrons)

Page 34: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

34 34 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 34 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Decision Trees

Sequential application of cuts splits the data into nodes, where the final nodes (leafs) classify an event as signal or background

Growing a decision tree:

Start with Root node

Split training sample according to cut on best variable at this node

Splitting criterion: e.g., maximum “Gini-index”: purity (1– purity)

Continue splitting until min. number of events or max. purity reached

Classify leaf node according to majority of events, or give weight; unknown test events are classified accordingly

Why not multiple branches (splits) per node ?

Fragments data too quickly; also: multiple splits per node = series of binary node splits

Page 35: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

35 35 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 35 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Decision Trees

Sequential application of cuts splits the data into nodes, where the final nodes (leafs) classify an event as signal or background

Classify leaf node according to majority of events, or give weight; unknown test events are classified accordinglyDecision tree before pruning

Decision tree after pruning

Bottom-up “pruning” of a decision treeRemove statistically insignificant nodes to reduce tree overtraining

Page 36: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

36 36 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 36 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Boosted Decision Trees (BDT)

Data mining with decision trees is popular in science (so far mostly outside of HEP)

Advantages:

Easy to interpret

Immune against outliers

Weak variables are ignored (and don’t (much) deteriorate performance)

Shortcomings:

Instability: small changes in training sample can dramatically alter the tree structure

Sensitivity to overtraining ( requires pruning)

Boosted decision trees: combine forest of decision trees, with differently weighted events in each tree (trees can also be weighted), by majority vote

e.g., “AdaBoost”: incorrectly classified events receive larger weight in next decision tree

“Bagging” (instead of boosting): random event weights, re-sampling with replacement

Boosting or bagging are means to create set of “basis functions”: the final classifier is linear combination (expansion) of these functions improves stability !

Page 37: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

37 37 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 37 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

One of the elementary cellular automaton rules (Wolfram 1983, 2002). It specifies the next color in a cell, depending on its color and its immediate neighbors. Its rule outcomes are encoded in the binary representation 30=00011110 2.

Predictive Learning via Rule Ensembles (RuleFit)

Following RuleFit approach by Friedman-Popescu Friedman-Popescu, Tech Rep, Stat. Dpt, Stanford U., 2003

Model is linear combination of rules, where a rule is a sequence of cuts

RF 01 1

ˆ ˆR RM n

m m k km k

x x xy a ra b

rules (cut sequence rm=1 if all cuts satisfied, =0 otherwise)

normalised discriminating event variables

RuleFit classifier

Linear Fisher termSum of rules

The problem to solve is

Create rule ensemble: use forest of decision trees

Fit coefficients am, bk: gradient direct regularization minimising Risk (Friedman et al.)

Pruning removes topologically equal rules (same variables in cut sequence)

Page 38: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

38 38 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 38 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

x1

x2

margin

support vectors

Sep

arab

le d

ata

optimal hyperplane

x1

x3

x1

x2

(x1,x2)Non

-sep

arab

le d

ata

Support Vector Machine (SVM)

Linear case: find hyperplane that best separates signal from background

Best separation: maximum distance (margin) between closest events (support) to hyperplane

Linear decision boundary

If data non-separable add misclassification cost parameter to minimisation function

Non-linear cases:

Transform variables into higher dim. space where a linear boundary can fully separate the data

Explicit transformation not required: use kernel functions to approximate scalar products between transformed vectors in the higher dim. space

Choose Kernel and fit the hyperplane using the techniques developed for linear case

Page 39: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

39 39 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 39 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Generalised Classifier Boosting

Principle (just as in BDT): multiple training cycles, each time wrongly classified events get a higher event weight

Response is weighted sum of each classifier response

Boosting will be interesting especially for Methods like Cuts, MLP, and SVM

Training Sampleclassifier C(0)(x)

Weighted Sample

re-weightclassifier C(1)(x)

Weighted Sample

re-weightclassifier C(2)(x)

Weighted Sample

re-weight

classifier C(m)(x)

ClassifierN (i)(i)err

(i)i err

1 fy(x) log C (x)

f

Page 40: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

40 40 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 40 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Categorising Classifiers

Multivariate training samples often have distinct sub-populations of data

A detector element may only exist in the barrel, but not in the endcaps

A variable may have different distributions in barrel, overlap, endcap regions

Ignoring this dependence creates correlations between variables, which must be learned by the classifier

Classifiers such as the projective likelihood, which do not account for correlations, significantly loose performance if the sub-populations are not separated

Categorisation means splitting the data sample into categories defining disjoint data samples with the following (idealised) properties:

Events belonging to the same category are statistically indistinguishable

Events belonging to different categories have different properties

In TMVA: All categories are treated independently for training and application (transparent for user), but evaluation is done for the whole data sample

Page 41: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

41 41 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 41 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

U s i n g T M V AU s i n g T M V A

A typical TMVA analysis consists of two main steps:

1. Training phase: training, testing and evaluation of classifiers using data samples with known signal and background composition

2. Application phase: using selected trained classifiers to classify unknown data samples

Illustration of these steps with toy data samples

T MVA tutorial

Page 42: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

42 42 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 42 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

A Simple Example for Training

void TMVClassification( ) { TFile* outputFile = TFile::Open( "TMVA.root", "RECREATE" );

TMVA::Factory *factory = new TMVA::Factory( "MVAnalysis", outputFile,"!V");

TFile *input = TFile::Open("tmva_example.root"); factory->AddSignalTree ( (TTree*)input->Get("TreeS"), 1.0 ); factory->AddBackgroundTree ( (TTree*)input->Get("TreeB"), 1.0 );

factory->AddVariable("var1+var2", 'F'); factory->AddVariable("var1-var2", 'F'); factory->AddVariable("var3", 'F'); factory->AddVariable("var4", 'F');

factory->PrepareTrainingAndTestTree("", "NSigTrain=3000:NBkgTrain=3000:SplitMode=Random:!V" );

factory->BookMethod( TMVA::Types::kLikelihood, "Likelihood", "!V:!TransformOutput:Spline=2:NSmooth=5:NAvEvtPerBin=50" );

factory->BookMethod( TMVA::Types::kMLP, "MLP", "!V:NCycles=200:HiddenLayers=N+1,N:TestRate=5" );

factory->TrainAllMethods(); factory->TestAllMethods(); factory->EvaluateAllMethods(); outputFile->Close(); delete factory;}

create Factory

give training/test trees

register input variables

train, test and evaluate

select MVA methods

T MVA tutorial

Page 43: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

43 43 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 43 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

A Simple Example for an Application

void TMVClassificationApplication( ) {

TMVA::Reader *reader = new TMVA::Reader("!Color");

Float_t var1, var2, var3, var4; reader->AddVariable( "var1+var2", &var1 ); reader->AddVariable( "var1-var2", &var2 ); reader->AddVariable( "var3", &var3 ); reader->AddVariable( "var4", &var4 );

reader->BookMVA( "MLP classifier", "weights/MVAnalysis_MLP.weights.txt" );

TFile *input = TFile::Open("tmva_example.root"); TTree* theTree = (TTree*)input->Get("TreeS");

// … set branch addresses for user TTree for (Long64_t ievt=3000; ievt<theTree->GetEntries();ievt++) { theTree->GetEntry(ievt); var1 = userVar1 + userVar2; var2 = userVar1 - userVar2; var3 = userVar3; var4 = userVar4;

Double_t out = reader->EvaluateMVA( "MLP classifier" );

// do something with it … } delete reader;}

register the variables

book classifier(s)

prepare event loop

compute input variables

calculate classifier output

create Reader

T MVA tutorial

Page 44: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

44 44 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 44 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Data Preparation

Data input format: ROOT TTree or ASCII

Supports selection of any subset or combination or function of available variables

Supports application of pre-selection cuts (possibly independent for signal and bkg)

Supports global event weights for signal or background input files

Supports use of any input variable as individual event weight

Supports various methods for splitting into training and test samples:

Block wise

Randomly

Alternating

User defined training and test trees

Preprocessing of input variables (e.g., decorrelation)

Page 45: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

45 45 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 45 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

A Toy Example (idealized)

Use data set with 4 linearly correlated Gaussian distributed variables:

---------------------------------------- Rank : Variable  : Separation ----------------------------------------      1 : var4      : 0.606     2 : var1+var2 : 0.182     3 : var3       : 0.173     4 : var1-var2  : 0.014

----------------------------------------

Page 46: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

46 46 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 46 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Preprocessing the Input Variables

Decorrelation of variables before training is useful for this example

Note that in cases with non-Gaussian distributions and/or nonlinear correlations decorrelation may do more harm than any good

Page 47: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

47 47 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 47 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Preprocessing the Input Variables

Decorrelation of variables before training is useful for this example

Note that in cases with non-Gaussian distributions and/or nonlinear correlations decorrelation may do more harm than any good

Page 48: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

48 48 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 48 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

MVA Evaluation Framework

TMVA is not only a collection of classifiers, but an MVA framework

After training, TMVA provides ROOT evaluation scripts (through GUI)

Plot all signal (S) and background (B) input variables with and without pre-processing

Correlation scatters and linear coefficients for S & B

Classifier outputs (S & B) for test and training samples (spot overtraining)

Classifier Rarity distribution

Classifier significance with optimal cuts

B rejection versus S efficiency

Classifier-specific plots:• Likelihood reference distributions• Classifier PDFs (for probability output and Rarity)• Network architecture, weights and convergence• Rule Fitting analysis plots

• Visualise decision trees

Page 49: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

49 49 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 49 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (I)

Projective likelihood PDFs, MLP training, BDTs, …

average no. of nodes before/after pruning: 4193 / 968

Page 50: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

50 50 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 50 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (II)

Check for overtraining: classifier output for test and training samples …

Page 51: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

51 51 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 51 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (II)

Check for overtraining: classifier output for test and training samples …

Remark on overtraining

Occurs when classifier training has too few degrees of freedom because the classifier has too many adjustable parameters for too few training events

Sensitivity to overtraining depends on classifier: e.g., Fisher weak, BDT strong

Compare performance between training and test sample to detect overtraining

Actively counteract overtraining: e.g., smooth likelihood PDFs, prune decision trees, …

Page 52: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

52 52 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 52 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (III)

Parallel Coordinates (ROOT class)

Page 53: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

53 53 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 53 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (III)

Parallel Coordinates (ROOT class)

Page 54: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

54 54 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 54 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (IV)

There is no unique way to express the performance of a classifier several benchmark quantities computed by TMVA

Signal eff. at various background effs. (= 1 – rejection) when cutting on classifier output

The Separation:

“Rarity” implemented (background flat):

Other quantities … see Users Guide

2ˆ ˆ( ) ( )1ˆ ˆ2 ( ) ( )S B

S B

y y y ydy

y y y y

ˆ( ) ( )y

R y y y dy

Page 55: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

55 55 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 55 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifier Training (V)

Optimal cut for each classifiers …

Determine the optimal cut (working point) on a classifier output

Page 56: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

56 56 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 56 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifiers Training (VI) (taken from TMVA output…)

--- Fisher : Ranking result (top variable is best ranked)--- Fisher : ------------------------------------------------ Fisher : Rank : Variable : Discr. power--- Fisher : ------------------------------------------------ Fisher : 1 : var4 : 2.175e-01--- Fisher : 2 : var3 : 1.718e-01--- Fisher : 3 : var1 : 9.549e-02--- Fisher : 4 : var2 : 2.841e-02--- Fisher : ---------------------------------------------B

ette

r va

riabl

e

--- Factory : Inter-MVA overlap matrix (signal):--- Factory : --------------------------------- Factory : Likelihood Fisher--- Factory : Likelihood: +1.000 +0.667--- Factory : Fisher: +0.667 +1.000--- Factory : ------------------------------

Input Variable Ranking

Classifier correlation and overlap

How discriminating is a variable ?

Do classifiers select the same events as signal and background ? If not, there is something to gain !

Page 57: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

57 57 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 57 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Evaluating the Classifiers Training (VII) (taken from TMVA output…)

Evaluation results ranked by best signal efficiency and purity (area)------------------------------------------------------------------------------ MVA Signal efficiency at bkg eff. (error): | Sepa- Signifi-

Methods: @B=0.01 @B=0.10 @B=0.30 Area | ration: cance:------------------------------------------------------------------------------

Fisher : 0.268(03) 0.653(03) 0.873(02) 0.882 | 0.444 1.189MLP : 0.266(03) 0.656(03) 0.873(02) 0.882 | 0.444 1.260LikelihoodD : 0.259(03) 0.649(03) 0.871(02) 0.880 | 0.441 1.251PDERS : 0.223(03) 0.628(03) 0.861(02) 0.870 | 0.417 1.192RuleFit : 0.196(03) 0.607(03) 0.845(02) 0.859 | 0.390 1.092HMatrix : 0.058(01) 0.622(03) 0.868(02) 0.855 | 0.410 1.093BDT : 0.154(02) 0.594(04) 0.838(03) 0.852 | 0.380 1.099CutsGA : 0.109(02) 1.000(00) 0.717(03) 0.784 | 0.000 0.000Likelihood : 0.086(02) 0.387(03) 0.677(03) 0.757 | 0.199 0.682

------------------------------------------------------------------------------Testing efficiency compared to training efficiency (overtraining check)

------------------------------------------------------------------------------ MVA Signal efficiency: from test sample (from traing sample)

Methods: @B=0.01 @B=0.10 @B=0.30------------------------------------------------------------------------------

Fisher : 0.268 (0.275) 0.653 (0.658) 0.873 (0.873)MLP : 0.266 (0.278) 0.656 (0.658) 0.873 (0.873)LikelihoodD : 0.259 (0.273) 0.649 (0.657) 0.871 (0.872)PDERS : 0.223 (0.389) 0.628 (0.691) 0.861 (0.881)RuleFit : 0.196 (0.198) 0.607 (0.616) 0.845 (0.848)HMatrix : 0.058 (0.060) 0.622 (0.623) 0.868 (0.868)BDT : 0.154 (0.268) 0.594 (0.736) 0.838 (0.911)CutsGA : 0.109 (0.123) 1.000 (0.424) 0.717 (0.715)Likelihood : 0.086 (0.092) 0.387 (0.379) 0.677 (0.677)

-----------------------------------------------------------------------------

Bet

ter

clas

sifie

r

Check for over-training

Page 58: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

58 58 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 58 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

M o r e T o y E x a m p l e sM o r e T o y E x a m p l e s

Page 59: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

59 59 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 59 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

More Toys: Linear-, Cross-, Circular Correlations

Illustrate the behaviour of linear and nonlinear classifiers

Linear correlations(same for signal and background)

Linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

Page 60: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

60 60 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 60 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Weight Variables by Classifier Output

Linear correlations(same for signal and background)

Cross-linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

How well do the classifier resolve the various correlation patterns ?

LikelihoodLikelihood - DPDERSFisher

Page 61: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

61 61 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 61 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Weight Variables by Classifier Output

Linear correlations(same for signal and background)

Cross-linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

How well do the classifier resolve the various correlation patterns ?

Likelihood

Page 62: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

62 62 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 62 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Weight Variables by Classifier Output

Linear correlations(same for signal and background)

Cross-linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

How well do the classifier resolve the various correlation patterns ?

LikelihoodLikelihood - D

Page 63: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

63 63 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 63 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Weight Variables by Classifier Output

Linear correlations(same for signal and background)

Cross-linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

How well do the classifier resolve the various correlation patterns ?

LikelihoodLikelihood - DPDERS

Page 64: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

64 64 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 64 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Weight Variables by Classifier Output

Linear correlations(same for signal and background)

Cross-linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

How well do the classifier resolve the various correlation patterns ?

LikelihoodLikelihood - DPDERSFisherMLP

Page 65: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

65 65 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 65 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Weight Variables by Classifier Output

Linear correlations(same for signal and background)

Cross-linear correlations(opposite for signal and background)

Circular correlations(same for signal and background)

How well do the classifier resolve the various correlation patterns ?

LikelihoodLikelihood - DPDERSFisherMLPBDT

Page 66: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

66 66 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 66 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Final Classifier Performance

Background rejection versus signal efficiency curve:

LinearExample

Page 67: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

67 67 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 67 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Final Classifier Performance

Background rejection versus signal efficiency curve:

LinearExampleCrossExample

Page 68: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

68 68 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 68 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Final Classifier Performance

Background rejection versus signal efficiency curve:

LinearExampleCrossExampleCircularExample

Page 69: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

69 69 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 69 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

The Schachbrett Toy (chess board)

Performance achieved without parameter adjustments:

nearest Neighbour and BDTs are best “out of the box”

After some parameter tuning, also SVM und ANN(MLP) perform

Theoretical maximum

Event Distribution

Events weighted by SVM response

Page 70: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

70 70 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 70 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Let’s try our standard example of 4 Gaussian-distributed input variables:

Now, “var4” depends on a new variable “eta” (which may not be used for classification)

for |eta| > 1.3 the Signal and Background Gaussian means are shifted w.r.t. |eta| < 1.3

Categorising Classifiers

|eta| > 1.3 |eta| < 1.3

“Categorising” Classifiers

Page 71: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

71 71 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 71 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Let’s try our standard example of 4 Gaussian-distributed input variables:

Now, “var4” depends on a new variable “eta” (which may not be used for classification)

for |eta| > 1.3 the Signal and Background Gaussian means are shifted w.r.t. |eta| < 1.3

Categorising Classifiers

Recover optimal performance after

splitting into categories

The category technique is heavily used in multivariate likelihood fits, eg, RooFit (RooSimultaneousPdf)

“Categorising” Classifiers

Page 72: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

72 72 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 72 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

S u m m a r y

Page 73: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

73 73 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 73 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

No Single Best Classifier …

Criteria

Classifiers

CutsLikeli-hood

PDERS/ k-NN

H-Matrix Fisher MLP BDT RuleFit SVM

Perfor-mance

no / linear correlations nonlinear

correlations

Speed

Training Response /

Robust-ness

Overtraining Weak input variables

Curse of dimensionality Transparency

The properties of the Function discriminant (FDA) depend on the chosen function

Page 74: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

74 74 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 74 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Summary M VA ’s fo r Cla s s ifi c ation a nd Re gre s s ion

Th e mo s t im po rta nt c la s s ifie rs im ple me nted in TM VA : reconstructing the PDF and use Likel ihood Ratio:

Nearest nei ghbour (Multidimensi onal Likelihood) Naï ve-Bayesian classifier (1dim (proj ecti ve) Likel ihood)

fitting directly the deci sion boundary: Linear discriminant (Fi sher) Neuronal Network Support Vector Machine Boosted Decisi on Tress

In tro du c ti on to TM VA Training Testing/Evaluation

To y e x a m ple s

Page 75: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

75 75 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 75 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

TMVA Development and Distribution

TMVA is a now shipped with ROOT, project page on sourceforgeHome page ………………. http://tmva.sf.net/

SF project page …………. http://sf.net/projects/tmva

Mailing list .……………….. http://sf.net/mail/?group_id=152074

Tutorial TWiki ……………. https://twiki.cern.ch/twiki/bin/view/TMVA/WebHome

Active project fast response time on feature requestsCurrently 6 core developers, and ~25 contributors

>3500 downloads since March 2006 (not accounting SVN checkouts and ROOT users)

Written in C++, relying on core ROOT functionality

Integrated and distributed with ROOT since ROOT v5.11/03

Page 76: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

76 76 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 76 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

In developmentIn development

Page 77: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

77 77 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 77 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Multi-Class Classification

Binary classification: two classes, “signal” and “background”

Signal Background

Page 78: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

78 78 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 78 CERN, April 14., 2010 P. Speckmayer ― Multivariate Data Analysis with TMVA

Multi-Class Classification

Multi-class classification – natural extension for many classifiers

Class 1

Class 2

Class 3

Class 5

Class 6

Class 4

Page 79: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

79 79 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 79 CERN, April 14., 2010 P. Speckmayer ― Multivariate Data Analysis with TMVA

A ( b r i e f ) W o r d o n

S y s t e m a t i c s &

I r r e l e v a n t I n p u t V a r i a b l e s

A ( b r i e f ) W o r d o n

S y s t e m a t i c s &

I r r e l e v a n t I n p u t V a r i a b l e s

Page 80: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

80 80 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 80 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Treatment of Systematic Uncertainties

Assume strongest variable “var4” suffers from systematic uncertainty

“Calibration uncertainty” may shift the central value and hence worsen the discrimination power of “var4”

Page 81: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

81 81 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 81 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Treatment of Systematic Uncertainties

Assume strongest variable “var4” suffers from systematic uncertainty

(at least) Two ways to deal with it:

1. Ignore the systematic in the training, and evaluate systematic error on classifier output

- Drawbacks:

“var4” appears stronger in training than it might be suboptimal performance

Classifier response will strongly depend on “var4”

2. Train with shifted (= weakened) “var4”, and evaluate systematic error on classifier output

- Cures previous drawbacks

If classifier output distributions can be validated with data control samples, the second drawback is mitigated, but not the first one (the performance loss) !

Page 82: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

82 82 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 82 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Treatment of Systematic Uncertainties

1st Way

Cla

ssifi

er o

utpu

t dis

trib

utio

ns fo

r si

gnal

onl

yC

lass

ifier

out

put d

istr

ibut

ions

for

sign

al o

nly

Page 83: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

83 83 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 83 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Treatment of Systematic Uncertainties

1st Way2nd Way

Cla

ssifi

er o

utpu

t dis

trib

utio

ns fo

r si

gnal

onl

yC

lass

ifier

out

put d

istr

ibut

ions

for

sign

al o

nly

Page 84: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

84 84 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 84 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Stability with Respect to Irrelevant Variables

Toy example with 2 discriminating and 4 non-discriminating variables ?

Page 85: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

85 85 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 85 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Stability with Respect to Irrelevant Variables

Toy example with 2 discriminating and 4 non-discriminating variables ?

use only two discriminant variables in classifiers

use only two discriminant variables in classifiers

Page 86: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

86 86 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 86 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Stability with Respect to Irrelevant Variables

Toy example with 2 discriminating and 4 non-discriminating variables ?

use only two discriminant variables in classifiers

use only two discriminant variables in classifiersuse all discriminant variables in classifiers

use all discriminant variables in classifiers

Page 87: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

87 87 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 87 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Minimisation

Robust global minimum finder needed at various places in TMVA

Default solution in HEP: (T)Minuit/Migrad [ How much longer do we need to suffer …. ? ]

Gradient-driven search, using variable metric, can use quadratic Newton-type solution

Poor global minimum finder, gets quickly stuck in presence of local minima

Specific global optimisers implemented in TMVA:Genetic Algorithm: biology-inspired optimisation algorithm

Simulated Annealing: slow “cooling” of system to avoid “freezing” in local solution

Brute force method: Monte Carlo SamplingSample entire solution space, and chose solution providing minimum estimator

Good global minimum finder, but poor accuracy

TMVA allows to chain minimisers

For example, one can use MC sampling to detect the vicinity of a global minimum, and then use Minuit to accurately converge to it.

Page 88: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

88 88 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 88 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Minimizers

Minuit Monte Carlo

Genetic Algorithm Simulated Annealing

Page 89: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

89 89 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 89 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

How does linear decorrelation affect strongly nonlinear cases ?

Original correlations

SQRT decorrelation

Page 90: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

90 90 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 90 P. Speckmayer ― Multivariate Data Analysis with TMVACERN, April 14., 2010

Code Flow for Training and Application Phases

T MVA tutorial

Page 91: 11 Top Workshop, LPSC, Oct 18–20, 2007A. Hoecker: Multivariate Analysis with TMVA 1 CERN, April 14., 2010P. Speckmayer ― Multivariate Data Analysis with

91 91 Top Workshop, LPSC, Oct 18–20, 2007 A. Hoecker: Multivariate Analysis with TMVA 91 CERN, April 14., 2010 P. Speckmayer ― Multivariate Data Analysis with TMVA

C o p y r i g h t s & C r e d i t sC o p y r i g h t s & C r e d i t s

Several similar data mining efforts with rising importance in most fields

of science and industry

Important for HEP: Parallelised MVA training and evaluation pioneered by Cornelius package (BABAR)

Also frequently used: StatPatternRecognition package by I. Narsky (Cal Tech)

Many implementations of individual classifiers exist

TMVA is open source software

Use & redistribution of source permitted according to terms in BSD license

Acknowledgments: The fast development of TMVA would not have been possible without the contribution and feedback from many developers and users to whom we are indebted. We thank in particular the CERN Summer students Matt Jachowski (Stan-ford) for the implementation of TMVA's new MLP neural network, Yair Mahalalel (Tel Aviv) and three genius Krakow mathematics students for significant improvements of PDERS, the Krakow student Andrzej Zemla and his supervisor Marcin Wolter for programming a powerful Support Vector Machine, as well as Rustem Ospanov for the development of a fast k-NN algorithm. We thank Doug Schouten (S. Fraser U) for improving the BDT, Jan Therhaag (Bonn) for a reimplementation of LD including regression, and Eckhard v. Toerne (Bonn) for improving the Cuts evaluation. Many thanks to Dominik Dannheim, Alexander Voigt and Tancredi Carli (CERN) for the implementation of the PDEFoam approach. We are grateful to Doug Applegate, Kregg Arms, René Brun and the ROOT team, Zhiyi Liu, Elzbieta Richter-Was, Vincent Tisserand and Alexei Volk for helpful conversations.