---
abstract: 'A persistent challenge in practical classification tasks is that labeled training sets are not always available. In particle physics, this challenge is surmounted by the use of simulations. These simulations accurately reproduce most features of data, but cannot be trusted to capture all of the complex correlations exploitable by modern machine learning methods. Recent work in weakly supervised learning has shown that simple, low-dimensional classifiers can be trained using only the impure mixtures present in data. Here, we demonstrate that complex, high-dimensional classifiers can also be trained on impure mixtures using weak supervision techniques, with performance comparable to what could be achieved with pure samples. Using weak supervision will therefore allow us to avoid relying exclusively on simulations for high-dimensional classification. This work opens the door to a new regime whereby complex models are trained directly on data, providing direct access to probe the underlying physics.'
author:
- 'Patrick T. Komiske'
- 'Eric M. Metodiev'
- Benjamin Nachman
- 'Matthew D. Schwartz'
bibliography:
- 'highweaklett.bib'
title: 'Learning to Classify from Impure Samples with High-Dimensional Data'
---

Data analysis methods at the Large Hadron Collider (LHC) rely heavily on simulations. These simulations are generally excellent and allow us to explore the mapping between truth information (particles from collisions) and observables (reconstructed momenta and energies). In particular, simulations let us train complex algorithms to extract the truth information from the observables. Machine learning methods trained on low-level inputs have been developed for collider physics [@Larkoski:2017jix] to identify boosted $W/Z/$Higgs bosons [@Cogan:2014oua; @deOliveira:2015xxd; @Baldi:2016fql; @Barnard:2016qma; @Louppe:2017ipp; @Datta:2017rhs; @Komiske:2017aww], top quarks [@Almeida:2015jua; @Kasieczka:2017nvn; @Pearkes:2017hku; @Butter:2017cot; @Egan:2017ojy], $b$-quarks [@CMS-DP-2017-005; @ATL-PHYS-PUB-2017-003; @Sirunyan:2017ezt], and light quarks [@Komiske:2016rsd; @CMS-DP-2017-027; @ATL-PHYS-PUB-2017-017; @Bhimji:2017qvb], for removing noise [@Komiske:2017ubm], and for emulating particle interactions with calorimeters [@deOliveira:2017pjk; @Paganini:2017hrr; @Paganini:2017dwg]. These new methods achieve excellent performance by exploiting subtle features of the simulations, which are presumed to be similar to the features in the data. Unfortunately, the simulations are known to be imperfect. This is particularly true for subtle features in high-dimensions, as illustrated clearly for boosted $W$ bosons in Ref. [@Barnard:2016qma] and by the need for non-negligible corrections (“scale factors”) to be applied to multivariate classifiers used by the current LHC experiments (see e.g. ). Thus it is natural to question the performance of machine learning algorithms trained on simulations as we know that if a model is trained on unphysical artifacts, this is what the model will learn. This objection certainly has merit, as the power of these methods for physics applications stems precisely from their ability to find features that we do not fully understand and cannot easily interpret.

Data-driven approaches avoid the pitfalls of relying on simulations in experimental analyses. For simple observables, such as the invariant mass of a photon pair, a traditional experimental approach has been to perform sideband fits directly to the data. This avoids relying on the simulation altogether. Unfortunately, most of the sophisticated discrimination techniques developed in recent years use [*full supervision*]{}, where truth information is needed in order to train the classifier. However, real data generally consist only of mixed samples without truth information, arising from underlying statistical or quantum mixtures of two classes (henceforth referred to as “signal" and “background"). Occasionally one can find a small region of phase space where the signal or background is pure, but these regions are generally sparsely populated and may not produce representative distributions. Recent work on *weak supervision* [@hernandez2016weak] allows classifiers to be trained using only the information available from mixed samples. Two weakly supervised paradigms tailored to physics applications are Learning from Label Proportions (LLP) [@Dery:2017fap] and Classification Without Labels (CWoLa) [@Metodiev:2017vrx]. considered the problem of discriminating the radiation pattern of quark from gluons ($q$/$g$) using three standard observables and showed how to achieve fully supervised discrimination power by using LLP with two samples of different but known quark fractions. In , it was shown that the proportions are not necessary for training since the likelihood ratio of the mixed samples is monotonically related to the signal/background likelihood ratio, the optimal binary classifier for signal vs. background.

One potential objection to the weak-learning demonstrations in is that the dimensionality of the inputs used is small. Indeed, for a one-dimensional discriminant one can extract the exact pure distributions from mixed samples using the fractions. It is not obvious that weak supervision will succeed when trained on high-dimensional inputs where the feature space may be sparsely populated. Indeed, the most powerful modern methods are trained on high-dimensional, low-level inputs, where numerically approximating and weighting the probability distribution is completely intractable. These deep learning techniques can expose subtle correlations in many dimensions which are also much harder to model than simple low-dimensional features.

In this paper, we demonstrate that weak supervision can approach the effectiveness of full supervision on complex models with high-dimensional inputs. As a concrete illustration, we use an image representation to distinguish the radiation pattern from high energy quarks from gluons (“jet images" [@Cogan:2014oua]). Convolutional neural networks (CNNs) are applied to the quark and gluon jet images, where the dimensionality of the inputs is $\mathcal{O}(1000)$ and simulation mis-modeling issues are a challenge [@Aad:2014gea; @ATLAS-CONF-2016-034; @CMS-PAS-JME-13-002; @CMS-DP-2016-070; @CMS-PAS-JME-16-003; @ATL-PHYS-PUB-2017-009]. We find that CWoLa more robustly generalizes to learning with high-dimensional inputs than LLP, with the latter requiring careful engineering choices to achieve comparable performance. Though we use a particle physics problem as an example, the lessons about learning from data using mixtures of signal and background are applicable more broadly.

We begin by establishing some notation and formulating the problem. Let ${{\bf{x}}}$ represent a vector of observables (*features*) useful for discriminating two classes we call *signal* ($S$) and *background* ($B$). For example, ${{\bf{x}}}$ might be the momenta of observed particles, calorimeter energy deposits, or a complete set of observables [@Datta:2017rhs; @Komiske:2017aww]. In fully supervised learning, each training sample is assigned a truth label such as 1 for signal and 0 for background. Then the fully supervised model is trained to predict the correct labels for each training example by minimizing a loss function. For a sufficiently large training set, an appropriate model parameterization, and a suitable minimization procedure, the learned model should approach the optimal classifier defined by thresholding the likelihood ratio.

Data collected from a real detector do not come with signal/background labels. Instead, one typically has two or more *mixtures* $M_a$ of signal and background with different signal fractions $f_a$, such that the distribution of the features, $p_{M_a}({{\bf{x}}})$, is given by: $$\label{eq:decomp}
p_{M_a}({{\bf{x}}}) = f_a \,p_S({{\bf{x}}}) + (1 - f_a)\, p_B({{\bf{x}}}),$$ where $p_S$ and $p_B$ are the signal and background distributions, respectively. Weak supervision assumes [*sample independence*]{}, that Eq. \[eq:decomp\] holds with the same distributions $p_S({{\bf{x}}})$ and $p_B({{\bf{x}}})$ for all mixtures. Although in most situations sample independence does not hold perfectly (see e.g. ), it is often a very good approximation (cf. Table \[tab:sampledep\] below).

LLP uses any fully supervised classification method and modifies the loss function to globally match the signal fraction predicted by the model on a batch of training samples to the known truth fractions $f_a$. Breaking the training set into batches, normally done to parallelize training, takes on a new significance with LLP since the loss function is evaluated globally on each batch. The batch size, which for LLP we define as the number of samples drawn from each mixture during one update of the model, is a critical hyperparameter of LLP.

The loss functions we use for LLP differ from those in . Analogous to the mean squared error (MSE) loss function for fully supervised (or CWoLa) training, we introduce the weak MSE (WMSE) loss for the LLP framework: $$\label{eq:wmse}\ell_{\rm WMSE} = \sum_{a}  \left(f_a - \frac{1}{N}\sum_{i=1}^{N}h({{\bf{x}}}_i)\right)^2,$$ where $N$ is the batch size, $a$ indexes the mixed samples, and $h$ is the model. Analogous to the crossentropy, we also introduce the weak cross entropy (WCE) loss: $$\label{eq:wce}\ell_{\rm WCE} = \sum_{a} \text{CE}\left(f_a,\, \frac{1}{N} \sum_{i=1}^{N}h({{\bf{x}}}_i)\right),$$ where $\text{CE}(a, b) = - a \log b - (1 - a) \log (1 - b)$. One caveat we discovered while exploring LLP is that the range of $h({{\bf{x}}})$ must be restricted to $[0,1]$, otherwise the model falls into trivial minima of the loss function. We also observe the effect of model outputs becoming effectively binary at 0 and 1, necessitating additional care to avoid numerical precision issues.

CWoLa classifies two mixtures, $M_1$ and $M_2$, from each other using any fully supervised classification method. The resulting classifier is then used to directly distinguish the original signal and background processes. Amazingly, the CWoLa classifier asymptotically (as the amount of training data increases) approaches an ideal classifier trained on pure samples [@Metodiev:2017vrx; @scott2013; @Cranmer:2015bka]. CWoLa does not require that the fractions $f_a$ are known for training (the fractions on smaller test sets can be used to calibrate the classifier operating points). The CWoLa framework has the nice property that as the samples approach complete purity ($f_1\to0,\,f_2\to1$) it smoothly approaches the fully supervised paradigm. CWoLa presently only works with two mixtures; if more than two are available they can be pooled at the cost of diluting their purity. The key features of CWoLa and LLP are compared in . Note that no learning is possible with either method as $f_1\rightarrow f_2$.

  ------------------------------------- ----------------------- -- -------------------------
                                         ![image](figures/llp)      ![image](figures/cwola)
                                              [**LLP**]{}                [**CWoLa**]{}
  Compatible with any trainable model                              
  No training modifications needed                                 
  Training does not need fractions                                 
  Smooth limit to full supervision                                 
  Works for $>2$ mixed samples                                               **?**
  ------------------------------------- ----------------------- -- -------------------------

  : The essential pros (), cons (), and open questions (**?**) of the CWoLa and LLP weak supervision paradigms.[]{data-label="tab:comparison"}

To explore weak supervision methods with high-dimensional inputs, we simulate $Z+q/g$ events at $\sqrt{s}=13$ TeV using Pythia 8.226 [@Sjostrand:2007gs] and create artificially mixed samples with various quark (signal) fractions. Jets with transverse momentum $p_T^{\text{jet}}\in[250,275]\text{ GeV}$ and rapidity $|y|\le2.0$ are obtained from final-state, non-neutrino particles clustered using the anti-$k_t$ algorithm [@Cacciari:2008gp] with radius $R=0.4$ implemented in FastJet 3.3.0 [@Cacciari:2011ma]. Single-channel, $33\times33$ jet images [@Cogan:2014oua; @deOliveira:2015xxd; @Komiske:2016rsd] are constructed from a patch of the pseudorapidity-azimuth plane of size $0.8\times0.8$ centered on the jet, treating the particle $p_T$ values as pixel intensities. The images are normalized so the sum of the pixels is 1 and standardized by subtracting the mean and dividing by the standard deviation of each pixel as calculated from the training set.

All instantiations and trainings of neural networks were performed with the python deep learning library Keras [@keras] with the TensorFlow [@tensorflow] backend. A CNN architecture similar to that employed in was used: three 32-filter convolutional layers with filter sizes of $8\times 8$, $4\times 4$, and $4\times 4$ followed by a 128-unit dense layer. Maxpooling of size $2\times2$ was performed after each convolutional layer with a stride length of 2. The dropout rate was taken to be 0.1 for all layers. Keras VarianceScaling initialization was used to initialize the weights of the convolutional layers. Due to numerical precision issues caused by the tendency of LLP to push outputs to 0 or 1, a softmax activation function was included as part of the loss function rather than the model output layer. Validation and test sets were used consisting each of 50k 50%-50% mixtures of quark and gluon jet images. Training was performed with the Adam algorithm [@adam] with a learning rate of 0.001 and a validation performance patience of 10 epochs. Each network was trained 10 times and the variation of the performance was used as a measure of the uncertainty. Unless otherwise specified, the following are used by default: Exponential Linear Unit (ELU) [@clevert2015fast] activation functions for all non-output layers, the CE loss function for CWoLa, and the WCE loss function for LLP.

The performance of a binary classifier can be captured by its receiver operating characteristic (ROC) curve. To condense the classifier performance into a single number, we use the area under the ROC curve (AUC). The AUC is also the probability that the classifier output is higher for signal than for background. Random classifiers have $\text{AUC}=0.5$ and perfect classifiers have $\text{AUC}=1.0$. We also confirmed that our conclusions are unchanged when using the background mistag rate at 50% signal efficiency as a performance metric instead.

![The AUC and training time of CWoLa (solid) and LLP (dashed) as the batch size is varied. Training times are measured on an NVIDIA Tesla K80 GPU using CUDA 8.0, TensorFlow 1.4.1, and Keras 2.1.2. AUC is a measure of classifier performance and is 1 for a perfect classifier and 0.5 for a completely random one.[]{data-label="fig:batchsweep"}](figures/BatchSize_Timing_Sweep){width="\columnwidth"}

As previously noted, the LLP paradigm works by matching the predicted fraction of signal events to the known fraction for multiple mixed samples. In , the averaging took place over the entire mixed sample. Averaging over the entire training set at once is effectively impossible for high-dimensional inputs such as jet images because the graphics processing units (GPUs) that are needed to train the CNNs in a reasonable amount of time typically do not have enough memory to hold the entire training set at one time. Hence, the ability to train with batches is highly desirable for using LLP with high-dimensional inputs.

There are many tradeoffs inherent with choosing the LLP batch size. Smaller batch sizes are susceptible to shot noise in the sense that the actual signal fraction on that batch may differ significantly from the fraction for the entire mixed sample, an effect which decreases as the batch size increases. Smaller batch sizes result in longer training times per epoch (because the full parallelization capabilities of the GPU cannot be used) but often require fewer epochs to train. Larger batch sizes have shorter training times per epoch but typically require more epochs to train. For CWoLa, the batch size plays the same role as in full supervision, with the performance being largely insensitive to it but the total training time varying slightly. These tradeoffs are captured in , which shows both the performance and training time for CWoLa and LLP models as the batch size is swept in powers of two from 64 to 16384, trained on two mixtures with $f_1 = 0.2$ and $f_2 = 0.8$. The expected independence of CWoLa performance and the degradation of LLP performance for low batch sizes can clearly be seen. The training time curves are concave with optimum batch sizes toward the middle of the swept region. Based on this figure, we choose default batch sizes of $4000$ for LLP and 400 for CWoLa.

In order to explore a slightly more realistic scenario than artificially mixing samples from the same distribution of quarks and gluons, we generate $Z+\text{jet}$ and dijet events with the same generation parameters and cuts as described previously. These “naturally” mixed samples have quark fractions $f_{Z+\text{jet}}=0.88$ and $f_{\text{dijets}}=0.37$. The signal and background fractions have been systematically explored for these and many other processes in . As indicated by Table \[tab:sampledep\], there is no significant difference in performance on the naturally mixed or artificially mixed samples. Hence, artificially mixed samples are used in the rest of this study in order to evaluate weak supervision performance at different quark purities.

   **Learning**                                                   
  -------------- -------------------------- --------------------- --
                 $Z$+jet vs. dijets         0.8626 $\pm$ 0.0020   
                 Artificial $Z$ + $q$/$g$   0.8621 $\pm$ 0.0019   
                 $Z$+jet vs. dijets         0.8544 $\pm$ 0.0019   
                 Artificial $Z$ + $q$/$g$   0.8549 $\pm$ 0.0018   

  : AUCs for training with CWoLa and LLP on $Z+\text{jet}$ and dijet samples as well as on artificial mixtures of $Z+g$ and $Z+q$ samples. The error given is the interquartile range. There is no significant difference in classifier performance between the naturally mixed ($Z$+jet vs. dijets) samples and the artificially mixed ($Z + q/g$) samples with the same signal fractions.[]{data-label="tab:sampledep"}

compares CWoLa and LLP performance for various quark/gluon purities as a function of the number of training samples. Each network is trained using two samples, one with quark fraction $f_1$ and the other with quark fraction $f_2=1-f_1$. Each point in the figure is the median of 10 independent network trainings and the error bars show the $25^{\text{th}}$ and $75^{\text{th}}$ percentiles. Full supervision performance corresponds to CWoLa with $f_1=0$. The most important takeaway from is that we have achieved good performance with both weak supervision methods over a large variety of sample purities and training sample sizes. We also see that CWoLa consistently outperforms LLP and continues to get better as additional training samples are used, likely a result of the increasingly-populated feature space, whereas LLP performance tends to level off. It should be noted that given the binary output nature of LLP models, classifiers trained in this way effectively come with a working point and sweeping the threshold to produce a ROC curve may not be ideal. The purity/data tradeoff analysis of can provide valuable information for practical applications of weak supervision methods in physics, particularly in cases where more data can be acquired at the expense of worsening sample purity.

The sensitivity of LLP to different choices of loss function and activation function was examined. We studied the choices of the symmetric squared loss of and the weak crossentropy loss of with Rectified Linear Unit (ReLU) [@nair2010rectified] and ELU activation functions. We found a significant improvement in LLP classification performance in using ELU activations instead of ReLU activations, particularly at high signal efficiencies. The choice of loss function was found to be less important than the choice of activation function, but minor improvements in AUC were observed with the WCE loss function over WMSE. We also studied the dependence of CWoLa on the choice of activation function and found consistent performance between ELU and ReLU activations. These results justify our default choices of ELU activation and WCE loss functions. With the choice of ELU activation, LLP achieves almost the same performance to our CWoLa-trained network near the operating point with equal signal and background efficiencies. We suspect this is a result of the tendency of LLP to output binary predictions (near 0 or 1) rather than a continuous output that can be easily thresholded.

Lastly, LLP has the potential advantage over the present implementation of CWoLa that it can naturally encompass multiple mixed samples with different purities. While in principle adding more samples should help, it is not obvious whether the network will effectively take advantage of them. Indeed, we did not find significant improvement to LLP when adding additional samples with intermediate purities, even after significant, dedicated architecture engineering.

![Classifier performance (AUC) shown for both CWoLa (solid) and LLP (dashed) trained on two mixed samples with various signal fractions $f_1,\,1-f_1$ as the number of training data is varied between 100k and 1M. Each training is repeated 10 times and the $25^{\text{th}}$, $50^{\text{th}}$, and $75^{\text{th}}$ percentiles are shown. The $f_1 = 0.0$ CWoLa curve corresponds to full supervision. CWoLa outperforms LLP by this metric, though both methods work quite well.[]{data-label="fig:fracdatasweep"}](figures/Fraction_NumData_Sweep){width="\columnwidth"}

In conclusion, we have shown that machine learning approaches using very high-dimensional inputs can be trained directly on mixtures of signal and background, and therefore on data. This addresses one of the main objections to the use of modern machine learning in jet tagging: sensitivity to untrustworthy simulations. We have implemented and tested weakly supervised learning with both LLP and CWoLa, finding that for the quark/gluon discrimination problem considered here CWoLa outperforms LLP and is less sensitive to particular hyperparameter choices. We have developed a method for training LLP with high-dimensional inputs in batches and demonstrated that the batch size is a critical hyperparameter for both performance and training time. Given any fully supervised classifier, CWoLa works “out-of-the-box” whereas LLP requires additional engineering to achieve good performance and is generally harder to train. Nonetheless, the success in using both of these weak supervision approaches on high-dimensional data is encouraging for the future of modern machine learning techniques in particle physics and beyond.

The authors would like to thank Lucio Dery and Francesco Rubbo for collaboration in the initial stages of this work. We are grateful to Jesse Thaler for helpful discussions. PTK and EMM would like to thank the MIT Physics Department for its support. Computations for this paper were performed on the Odyssey cluster supported by the FAS Division of Science, Research Computing Group at Harvard University. This work was supported by the Office of Science of the U.S. Department of Energy (DOE) under contracts DE-AC02-05CH11231 and DE-SC0013607, the DOE Office of Nuclear Physics under contract DE-SC0011090, and the DOE Office of High Energy Physics under contract DE-SC0012567. Cloud computing resources were provided through a Microsoft Azure for Research award. Additional support was provided by the Harvard Data Science Initiative.
