• No results found

MACHINE LEARNING IN HIGH ENERGY PHYSICS

N/A
N/A
Protected

Academic year: 2021

Share "MACHINE LEARNING IN HIGH ENERGY PHYSICS"

Copied!
48
0
0

Loading.... (view fulltext now)

Full text

(1)

MACHINE LEARNING IN HIGH ENERGY PHYSICS

LECTURE #1

Alex Rogozhnikov, 2015

(2)

INTRO NOTES

4 days

two lectures, two practice seminars every day

this is introductory track to machine learning

kaggle competition!

(3)

WHAT IS ML ABOUT?

Inference of statistical dependencies which give us ability to predict

Data is cheap, knowledge is precious

(4)

WHERE ML IS CURRENTLY USED?

Search engines, spam detection

Security: virus detection, DDOS defense Computer vision and speech recognition

Market basket analysis, Customer relationship management (CRM)

Credit scoring, fraud detection Health monitoring

Churn prediction

... and hundreds more

(5)

ML IN HIGH ENERGY PHYSICS

High-level triggers (LHCb trigger system: ) Particle identification

Tagging

Stripping line Analysis

40MHz → 5kHz

Different data is used on different stages

(6)

GENERAL NOTION

In supervised learning the training data is represented as set of pairs

, x i y i

is index of event

is vector of features available for event is target — the value we need to predict

i x i

y i

(7)

CLASSIFICATION EXAMPLE

, if finite set on the plot: , Examples:

defining type of particle (or decay channel)

— binary classification, 1 is signal, 0 is bck

∈ Y

y i Y

x i2 y i ∈ {0, 1, 2}

Y = {0, 1}

(8)

REGRESSION

y ∈ ℝ

Examples:

predicting price of house by it's positions

predicting number of customers / money income reconstructing real momentum of particle

Why need automatic classification/regression?

in applications up to thousands of features higher quality

much faster adaptation to new problems

(9)

CLASSIFICATION BASED ON NEAREST NEIGHBOURS

Given training set of objects and their labels we predict the label for new observation. { , } x i y i

= , j = arg ρ(x, )

ŷ y j min

i x i

(10)

VISUALIZATION OF DECISION RULE

(11)

NEAREST NEIGHBOURS

k

A better way is to use neighbours: k (x) =

p i # of knn events in class i

k

(12)

k = 1, 2, 5, 30

(13)

OVERFITTING

what is the quality of classification on training dataset when

?

answer: it is ideal (closest neighbor is event itself) quality is lower when

this doesn't mean is the best,

it means we cannot use training events to estimate quality when classifier's decision rule is too complex and captures details from training data that are not relevant to

distribution, we call this overfitting (more details tomorrow)

k = 1

k > 1

k = 1

(14)

KNN REGRESSOR

Regression with nearest neighbours is done by averaging of output

= ŷ 1

k ∑ j∈knn(x) y j

(15)

KNN WITH WEIGHTS

(16)
(17)

COMPUTATIONAL COMPLEXITY

Given that dimensionality of space is and there are

training samples: d n

training time ~ O(save a link to data)

prediction time: n × d for each sample

(18)

SPACIAL INDEX: BALL TREE

(19)

BALL TREE

training time ~

prediction time ~ O(d × n log(n)) for each sample

log(n) × d

Other option exist: KD-tree.

(20)

OVERVIEW OF KNN

1. Awesomely simple classifier and regressor 2. Have too optimistic quality on training data 3. Quite slow, though optimizations exist

4. Hard times with data of high dimensions

5. Too sensitive to scale of features

(21)

SENSITIVITY TO SCALE OF FEATURES

Euclidean distance:

ρ(x, y = ( − ) 2 x 1 y 1 ) 2 + ( − x 2 y 2 ) 2 + ⋯ + ( − x d y d ) 2

Change scale fo first feature:

ρ(x, y = (10 − 10 ) 2 x 1 y 1 ) 2 + ( − x 2 y 2 ) 2 + ⋯ + ( − x d y d ) 2 ρ(x, y ∼ 100( − ) 2 x 1 y 1 ) 2

Scaling of features frequently increases quality.

(22)

DISTANCE FUNCTION MATTERS

Minkowski distance Canberra

Cosine metric

(x, y) = ( −

ρ pi x i y i ) p ρ(x, y) = ∑ i | − | x i y i

| | + | | x i y i ρ(x, y) = < x, y >

|x| |y|

(23)

MINUTES BREAK

x

(24)

RECAPITULATION

1. Statistical ML: problems 2. ML in HEP

3. nearest neighbours classifier and regressor. k

(25)

MEASURING QUALITY OF BINARY CLASSIFICATION

The classifier's output in binary classification is real variable

Which classifier is better?

All of them are identical

(26)

ROC CURVE

These distributions have the same ROC curve:

(ROC curve is passed signal vs passed bck dependency)

(27)

ROC CURVE DEMONSTRATION

(28)

ROC CURVE

Contains important information:

all possible combinations of signal and background efficiencies you may achieve by setting threshold

Particular values of thresholds (and initial pdfs) don't matter, ROC curve doesn't contain this information ROC curve = information about order of events:

Comparison of algorithms should be based on information from ROC curve

s s b s b ... b b s b b

(29)

TERMINOLOGY AND CONVENTIONS

fpr = background efficiency = b tpr = signal efficiency = s

(30)

where are predictions of random background and signal events.

ROC AUC

(AREA UNDER THE ROC CURVE)

ROC AUC = P(x < y) x, y

(31)

Which classifier is better for triggers?

(they have the same ROC AUC)

(32)

STATISTICAL MACHINE LEARNING

Machine learning we use in practice is based on statistics 1. Main assumption: the data is generated from probabilistic

distribution:

2. Does there really exist the distribution of people / pages?

3. In HEP these distributions do exist

p(x, y)

(33)

OPTIMAL CLASSIFICATION. OPTIMAL BAYESIAN CLASSIFIER

Assuming that we know real distributions we reconstruct using Bayes' rule p(x, y)

p(y|x) = p(x, y) = p(x)

p(y)p(x|y) p(x)

p(y = 1 | x) = p(y = 0 | x)

p(y = 1) p(x | y = 1) p(y = 0) p(x | y = 0)

LEMMA (NEYMAN–PEARSON):

The best classification quality is provided by p(y = 1 | x)

(34)

The best classification quality is provided by

(optimal bayesian classifier) p(y = 0 | x)

OPTIMAL BINARY CLASSIFICATION

Optimal bayesian classifier has highest possible ROC curve.

Since the classification quality depends only on order, gives optimal classification quality too!

p(y = 1 | x)

p(y = 1 | x) = p(y = 0 | x)

p(y = 1) p(x | y = 1)

p(y = 0) p(x | y = 0)

(35)

FISHER'S QDA (QUADRATIC DISCRIMINANT ANALYSIS)

Reconstructing probabilities from

data, assuming those are multidimensional normal distributions:

p(x | y = 1), p(x | y = 0)

p(x | y = 0) ∼ ( , ) μ 0 Σ 0

p(x | y = 1) ∼ ( , ) μ 1 Σ 1

(36)
(37)

QDA COMPLEXITY

samples, dimensions

n d

training takes

computing covariation matrix inverting covariation matrix

prediction takes for each sample

O(n + ) d 2 d 3

O(n ) d 2 O( ) d 3

O( ) d 2

f (x) = (2π ) k/2 1 | 1/2 exp ( − (x − μ 1 2 ) T Σ −1 (x − μ) )

(38)

QDA

simple decision rule fast prediction

many parameters to reconstruct in high dimensions

data almost never has gaussian distribution

(39)

WHAT ARE THE PROBLEMS WITH GENERATIVE APPROACH?

Generative approach: trying to reconstruct , then use

it to predict. p(x, y)

Real life distributions hardly can be reconstructed Especially in high-dimensional spaces

So, we switch to discriminative approach: guessing p(y|x)

(40)

This is (finding parameters ).

LINEAR DECISION RULE

Decision function is linear:

d(x) =< w, x > +w 0

{ d(x) > 0,

d(x) < 0,  class  + 1  class  − 1

parametric model w, w 0

(41)

FINDING OPTIMAL PARAMETERS

A good initial guess: get such , that error of classification is minimal ([true] = 1, [false] = 0):

Discontinuous optimization (arrrrgh!) Let's make decision rule smooth

w, w 0

 = ∑ [ ≠ sgn(d( ))]

i∈events

y i x i

(x) p +1

(x) p −1

= f (d(x))

= 1 − p +1 (x)

⎩ ⎨⎪⎪ f (0) = 0.5 f (x) > 0.5

f (x) < 0.5 if x > 0

if x < 0

(42)

LOGISTIC FUNCTION

a smooth step rule.

σ(x) = e x = 1 + e x

1

1 + e −x

PROPERTIES

1. monotonic, 2.

3.

4.

σ(x) ∈ (0, 1) σ(x) + σ(−x) = 1

(x) = σ(x)(1 − σ(x)) σ

2 σ(x) = 1 + tanh(x/2)

(43)

LOGISTIC FUNCTION

(44)

Optimizing log-likelihood (with probabilities obtained with logistic function)

LOGISTIC REGRESSION

d(x) (x) p +1

(x) p −1

=

=

=

< w, x > +w 0 σ(d(x))

σ(−d(x))

 = 1 − ln( ( )) = L( , ) → min

N ∑ i∈events p y

i

x i 1

N ∑ i x i y i

(45)

Exercise: find expression and build plot for L( , ) x i y i

DATA SCIENTIST PIPELINE

1. Experiments in appropriate high-level language or environment

2. After experiments are over — implement final algorithm in low-level language (C++, CUDA, FPGA)

Second point is not always needed.

(46)

SCIENTIFIC PYTHON

NumPy

vectorized computations in python

Matplotlib

for drawing

Pandas

for data manipulation and analysis (based on NumPy)

(47)

SCIENTIFIC PYTHON

Scikit-learn

most popular library for machine learning

Scipy

libraries for science and engineering

Root_numpy

convenient way to work with ROOT files

(48)

THE END

References

Related documents

near the inner boundary and almost oscillatory nature are observed for all the models for time. η = .69, whereas for small time η = .026 i,e, at the early stage the maximum

However, we also found that households with a head in the 30-39 age group have shown a sharp increase in debt holdings in recent years, due largely to the fact that tax breaks

Strengthening the delivery of essential surgical services at primary care level (district hospitals, health centres) should be a priority to reduce death and

Abstract In this study, a limit equilibrium method has been developed that satisfies all conditions of equilibrium and assumes circular slip surfaces.. All force and

Significantly desirable economic heterosis across the environments was found in 44 crosses for days to 75% flowering, 9 crosses for number of ear bearing tillers, 30 crosses for

There are exceptions to the rule including offices at LCP House, The Pensnett Estate, Kingswinford which are available on a simple monthly licence, fully furnished with

We then show that the balanced growth equilibrium is stable and unique under specifications of preferences and innovation technologies that are widely used in the growth

Frame material: aluminium Number of gears: 21 Extra info: front suspension, Shop price: 395 € (incl.