Package: lumin
LUMIN: Lumin Unifies Many Improvements for NetworksLUMIN is a deep-learning and data-analysis ecosystem for High-Energy Physics. Similar toKerasandfastaiit is a wrapper framework for a graph computation library (PyTorch), but includes many useful functions to handle domain-specific requirements and problems. It also intends to provide easy access to state-of-the-art methods, but still be flexible enough for users to inherit from base classes and override methods to meet their own demands.Online documentation may be found athttps://lumin.readthedocs.io/en/stableFor an introduction and motivation for LUMIN, checkout this talk from IML-2019 at CERN:video,slides.Distinguishing CharacteristicsData objectsUse with large datasets: HEP data can become quite large, making training difficult:TheFoldYielderclass provides on-demand access to data stored in HDF5 format, only loading into memory what is required.Conversion from ROOT and CSV to HDF5 is easy to achieve using (see examples)FoldYielderprovides conversion methods to PandasDataFramefor use with other internal methods and external packagesNon-network-specific methods expect PandasDataFrameallowing their use without having to convert toFoldYielder.Deep learningPyTorch > 1.0Inclusion of recent deep learning techniques and practices, including:Dynamic learning rate, momentum, beta_1:Cyclical,Smith, 2015Cosine annealedLoschilov & Hutter, 20161-cycle,Smith, 2018HEP-specific data augmentation during training and inferenceAdvanced ensembling methods:Snapshot ensemblesHuang et al., 2017Fast geometric ensemblesGaripov et al., 2018Stochastic Weight AveragingIzmailov et al., 2018Learning Rate Finders,Smith, 2015Entity embedding of categorical features,Guo & Berkhahn, 2016Label smoothingSzegedy et al., 2015Running batchnormfastai 2019Flexible architecture construction:ModelBuildertakes parameters and modules to yield networks on-demandNetworks constructed from modular blocks:Head - Takes input featuresBody - Contains most of the hidden layersTail - Scales down the body to the desired number of outputsEndcap - Optional layer for use post-training to provide further computation on model outputs; useful when training on a proxy objectiveEasy loading and saving of pre-trained embedding weightsModern architectures like:Residual and dense(-like) networks (He et al. 2015&Huang et al. 2016)Graph nets for physics objects, e.g.Battaglia, Pascanu, Lai, Rezende, Kavukcuoglu, 2016,Moreno et al., 2019, andQasim, Kieseler, Iiyama, & Pierini, 2019, with optional self-attentionVaswani et al., 2017.Recurrent layers for series of objects1D convolutional networks for series of objectsSqueeze-excitation blocksHu, Shen, Albanie, Sun, & Wu, 2017HEP-specific architectures, e.g. LorentzBoostNetworksErdmann, Geiser, Rath, Rieger, 2018Configurable initialisations, including LSUVMishkin, Matas, 2016HEP-specific losses, e.g. Asimov lossElwood & Krücker, 2018Exotic training schemes, e.g. Learning to Pivot with Adversarial NetworksLouppe, Kagan, & Cranmer, 2016Easy training and inference of ensembles of models:Default training methodfold_train_ensemble, trains a specified number of models as well as just a single modelEnsembleclass handles the (metric-weighted) construction of an ensemble, its inference, saving and loading, and interpretationEasy exporting of models to other libraries via OnnxUse with CPU and NVidia GPUEvaluation on domain-specific metrics such as Approximate Median Significance viaEvalMetricclassfastai-style callbacks and stateful model-fitting, allowing training, models, losses, and data to be accessible and adjustable at any pointFeature selection methodsDendrograms of feature-pair monotonicityFeature importance via auto-optimised SK-Learn random forestsMutual dependence (via RFPImp)Automatic filtering and selection of featuresInterpretationFeature importance for models and ensemblesEmbedding visualisation1D & 2D partial dependency plots (via PDPbox)PlottingVariety of domain-specific plotting functionsUnified appearance viaPlotSettingsclass - class accepted by every plot function providing control of plot appearance, titles, colour schemes, et ceteraUniversal handling of sample weightsHEP events are normally accompanied by weight characterising the acceptance and production cross-section of that particular event, or to flatten some distribution.Relevant methods and classes can take account of these weights.This includes training, interpretation, and plottingExpansion of PyTorch losses to better handle weightsParameter optimisationOptimal learning rate via cross-validated range testsSmith, 2015Quick, rough optimisation of random forest hyper parametersGeneralisable Cut & Count thresholds1D discriminant binning with respect to bin-fill uncertaintyStatistics and uncertaintiesIntegral to experimental scienceQuantitative results are accompanied by uncertaintiesUse of bootstrapping to improve precision of statistics estimated from small samplesLook and feelLUMIN aims to feel fast to use - liberal use of progress bars mean you're able to always know when tasks will finish, and get live updates of trainingGuaranteed to spark joy (in its current beta state, LUMIN may instead ignite rage, despair, and frustration -dev.)ExamplesSeveral examples are present in the form of Jupyter Notebooks in theexamplesfolder. These can be run also on Google Colab to allow you to quickly try out the package.examples/Simple_Binary_Classification_of_earnings.ipynb: Very basic binary-classification exampleexamples/Binary_Classification_Signal_versus_Background.ipynb: Binary-classification example in a high-energy physics contextexamples/Multiclass_Classification_Signal_versus_Backgrounds.ipynb: Multiclass-classification example in a high-energy physics contextexamples/Single_Target_Regression_Di-Higgs_mass_prediction.ipynb: Single-target regression example in a high-energy physics contextexamples/Multi_Target_Regression_Di-tau_momenta.ipynb: Multi-target regression example in a high-energy physics contextexamples/Feature_Selection.ipynb: In-depth walkthrough for automated feature-selectionexamples/Advanced_Model_Building.ipynb: In-depth look at building more complicated models and a few advanced interpretation techniquesexamples/Model_Exporting.ipynb: Walkthough for exporting a trained model to ONNX and TensorFlowexamples/RNNs_CNNs_and_GNNs_for_matrix_data.ipynb: Various examples of applying RNNs, CNNs, and GNNs to matrix data (top-tagging on jet constituents)examples/Learning_To_Pivot.ipynb: Example of adversarial training for parameter invarianceInstallationDue to some strict version requirements on packages, it is recommended to install LUMIN in its own Python environment, e.gconda create -n lumin python=3.6From PyPIThe main package can be installed via:pip install luminFull functionality requires two additional packages as described below.From sourcegit clone git@github.com:GilesStrong/lumin.git
cd lumin
pip install .Optionally, run pip install with-eflag for development installation. Full functionality requires an additional package as described below.Additional modulesFull use of LUMIN requires the latest version of PDPbox, but this is not released yet on PyPI, so you'll need to install it from source, too:git clone https://github.com/SauceCat/PDPbox.git && cd PDPbox && pip install -e .note the-eflag to make sure the version number gets set properly.NotesWhy use LUMINTMVA contained in CERN's ROOT system, has been the default choice for BDT training for analysis and reconstruction algorithms due to never having to leave ROOT format. With the gradual move to DNN approaches, more scientists are looking to move their data out of ROOT to use the wider selection of tools which are available. Keras appears to be the first stop due to its ease of use, however implementing recent methods in Keras can be difficult, and sometimes requires dropping back to the tensor library that it aims to abstract. Indeed, the prequel to LUMIN was a similar wrapper for Keras (HEPML_Tools) which involved some pretty ugly hacks.
The fastai framework provides access to these recent methods, however doesn't yet support sample weights to the extent that HEP requires.
LUMIN aims to provide the best of both, Keras-style sample weighting and fastai training methods, while focussing on columnar data and providing domain-specific metrics, plotting, and statistical treatment of results and uncertainties.Data typesLUMIN is primarily designed for use on columnar data, and from version 0.5 onwards this also includesmatrix data; ordered series and un-ordered groups of objects. With some extra work it can be used on other data formats, but at the moment it has nothing special to offer. Whilst recent work in HEP has made use of jet images and GANs, these normally hijack existing ideas and models. Perhaps once we get established, domain specific approaches which necessitate the use of a specialised framework, then LUMIN could grow to meet those demands, but for now I'd recommend checking out the fastai library, especially for image data.With just one main developer, I'm simply focussing on the data types and applications I need for my own research and common use cases in HEP. If, however you would like to use LUMIN's other methods for your own work on other data formats, then you are most welcome to contribute and help to grow LUMIN to better meet the needs of the scientific community.FutureThe current priority is to improve the documentation, add unit tests, and expand the examples.The next step will be to try to increase the user base and number of contributors. I'm aiming to achieve this through presentations, tutorials, blog posts, and papers.Further improvements will be in the direction of implementing new methods and (HEP-specific) architectures, as well as providing helper functions and data exporters to statistical analysis packages like Combine and PYHF.Contributing & feedbackContributions, suggestions, and feedback are most welcome! The issue tracker on this repo is probably the best place to report bugs et cetera.Code styleNope, the majority of the code-base does not conform to PEP8. PEP8 has its uses, but my understanding is that it primarily written for developers and maintainers of software whose users never need to read the source code. As a maths-heavy research framework which users are expected to interact with, PEP8 isn't the best style. Instead, I'm aiming to follow morethe style of fastai, which emphasises, in particular, reducing vertical space (useful for reading source code in a notebook) naming and abbreviating variables according to their importance and lifetime (easier to recognise which variables have a larger scope and permits easier writing of mathematical operations). A full list of the abbreviations used may be found inabbr.mdWhy is LUMIN called LUMIN?Aside from being a recursive acronym (and therefore the best kind of acronym) lumin is short for 'luminosity'. In high-energy physics, the integrated luminosity of the data collected by an experiment is the main driver in the results that analyses obtain. With the paradigm shift towards multivariate analyses, however, improved methods can be seen as providing 'artificial luminosity'; e.g. the gain offered by some DNN could be measured in terms of the amount of extra data that would have to be collected to achieve the same result with a more traditional analysis. Luminosity can also be connected to the fact that LUMIN is built around the python version of Torch.Who develops LUMINLUMIN is primarily developed by Giles Strong; a British-born doctor in particle physics, researcher at The University of Padova (Italy), and a member of the CMS collaboration at CERN.As LUMIN has grown, it has welcomed contributions from members of the scientific and software development community. Check out thecontributors pagefor a complete list.Certainly more developers and contributors are welcome to join and help out!ReferenceIf you have used LUMIN in your analysis work and wish to cite it, the preferred reference is:Giles C. Strong, LUMIN, Zenodo (Mar. 2019),https://doi.org/10.5281/zenodo.2601857, Note: Please checkhttps://github.com/GilesStrong/lumin/graphs/contributorsfor the full list of contributors@misc{giles_chatham_strong_2019_2601857,  
  author       = {Giles Chatham Strong},  
  title        = {LUMIN},  
  month        = mar,  
  year         = 2019,  
  note         = {{Please check https://github.com/GilesStrong/lumin/graphs/contributors for the full list of contributors}},  
  doi          = {10.5281/zenodo.2601857},  
  url          = {https://doi.org/10.5281/zenodo.2601857}  
}