Showing posts with label CERN. Show all posts
Showing posts with label CERN. Show all posts

Thursday, June 4, 2015

Automatic reweighting with gradient boosting

In high energy physics there is frequently used trick: reweighting of distribution. The most frequent reason to reweight data is to introduce some kind of constistency between real data and simulated one. The typical picture of how it looks like you can find below:


The aim is to find such weights for MC, that makes original distribution look like target distribution. I've found a way to use here gradient boosting over regression trees, though it is quite different from usual GBRT in loss, update rule and splitting criterion.

Update rule of reweighting GB
Here is the definition of weights:
$$w = \begin{cases}w, \text{event from target distribution} \\ e^{pred} w, \text{event from original distribution} \end{cases}, $$
so as you see, we are looking for multiplier $e^{pred}$, which will reweight the original distribution.

Pred is raw prediction of gradient boosting.

Splitting criterion of reweighting GB
The most obvious way to select splitting is to maximize binned $\chi^2$ statistics, so we are looking for the tree, which splits the space on the most 'informative' cells, where the difference is significant.

$$ \chi^2 = \sum_{\text{bins}} \dfrac{ (w_{target} - w_{original} )^2}{w_{target} + w_{original} } $$

Here I selected a bit more symmetric version, though this was not necessary.

Computing optimal value in the leaf
since we are going to remove difference in distributions, the optimal value is obviously:
$$ \text{leaf_value} = \log{\dfrac{w_{target}}{ w_{original} }} $$

Sunday, May 10, 2015

Anomaly detection at CERN experiments

Yesterday I dot a brilliant idea on how to implement automatic anomaly detection at CERN experiments. Today this work is done manually - many students / PhD students are looking at different distributions online. This first is quite inreliable, second - it's quite expensive, since you need many people to work all the time (nobody is paid for this - but you anyway spend money on travels).

So, the basic idea is quite simple: one can bin each variable and look at distributions within each of bins. Knowing, that number of events observed inside each bin is Poisson-distributed, one can detect anomalies.

However, this detects only deviations of single variable. How to compute deviations of many variables?
Inside LHCb experiment, for instance, we have topological trigger, which uses gradient-boosted regression trees to filter out events. Trees are actually splitting data into bins, so one can use this and eatimate for one tree the probability of observing anomaly. Here we can apply Wilks theorem, but only for every particular tree, since bins of different trees are correlated.