pidgan
:package: GAN-based models to flash-simulate the LHCb PID detectors
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.9%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
:package: GAN-based models to flash-simulate the LHCb PID detectors
Basic Info
Statistics
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 9
- Releases: 5
Topics
Metadata Files
README.md
GAN-based models to flash-simulate the LHCb PID detectors
What is PIDGAN?
PIDGAN is a Python package built upon TensorFlow 2 to provide ready-to-use implementations for several GAN algorithms (listed in this table). The package was originally designed to simplify the training and optimization of GAN-based models for the Particle Identification (PID) system of the LHCb experiment. Today, PIDGAN is a versatile package that can be employed in a wide range of High Energy Physics (HEP) applications and, in general, whenever one has anything to do with tabular data and aims to learn the conditional probability distributions of a set of target features. This package is one of the building blocks to define a Flash Simulation framework of the LHCb experiment [1].
PIDGAN is (almost) all you need (for flash-simulation)
Standard techniques for simulations consume tons of CPU hours in reproducing all the radiation-matter interactions occurring within a HEP detector when traversed by primary and secondary particles. Directly transforming generated particles into analysis-level objects allows Flash Simulation strategies to speed up significantly the simulation production, up to x1000 [1]. Such transformations can be defined by using Generative Adversarial Networks (GAN) [2] trained to take into account the kinematics of the traversing particles and the detection conditions (e.g., magnet polarity, occupancy).
GANs rely on the simultaneous (adversarial) training of two neural networks called generator and discriminator, whose competition ends once reached the Nash equilibrium. At this point, the generator can be used as simulator to generate new data according to the conditional probability distributions learned during the training [3]. By relying on the TensorFlow and Keras APIs, PIDGAN allows to define and train a GAN model with no more than 20 code lines.
```python from pidgan.players.generators import Generator from pidgan.players.discriminators import Discriminator from pidgan.algorithms import GAN
x = ... # conditions y = ... # targets
G = Generator( outputdim=y.shape[1], latentdim=64, output_activation="linear", )
D = Discriminator( outputdim=1, outputactivation="sigmoid", )
model = GAN(generator=G, discriminator=D) model.compile( metrics=["accuracy"], generatoroptimizer="rmsprop", discriminatoroptimizer="rmsprop", )
model.fit(x, y, batch_size=256, epochs=100) ```
Installation guide
First steps
Before installing PIDGAN, we suggest preparing a fully operational TensorFlow installation by following the instructions described in the dedicated guide. If your device is equipped with one of the NVIDIA GPU cards supported by TensorFlow (see Hardware requirements), do not forget to verify the correct installation of the libraries for hardware acceleration by running:
bash
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
If the equipped GPU card is not included in the list printed by the previous command, your device and/or Python environment may be misconfigured. Please refer to this table for the correct configuration of CUDA Toolkit and cuDNN requested by the different TensorFlow versions.
How to install
PIDGAN has a minimal list of requirements:
- Python >= 3.7, < 3.13
- TensorFlow >= 2.8, < 2.18
- scikit-learn >= 1.0, < 1.6
- NumPy < 2.0
- Hopaas client (https://github.com/landerlini/hopaas_client)
The easiest way to install PIDGAN is via pip:
bash
pip install pidgan
In addition, since hopaas_client is not available on PyPI, you need to install it manually to unlock the complete set of PIDGAN functionalities:
bash
pip install git+https://github.com/landerlini/hopaas_client
Optional dependencies
Standard HEP applications may need additional packages for data management, results visualization/validation, and model export. PIDGAN and any additional requirements potentially useful in HEP can be installed via pip in one shot:
bash
pip install pidgan[hep]
Models available
The main components of PIDGAN are the algorithms and players modules that provide, respectively, implementations for several GAN algorithms and the so-called adversarial neural networks (e.g., generator, discriminator). The objects exposed by the algorithms and players modules are implemented by subclassing the Keras Model class and customizing the training procedure that is executed when one calls the fit() method. With PIDGAN v0.2.0 the package has been massively rewritten to be also compatible with the new multi-backend Keras 3. At the moment, the custom training procedures defined for the various GAN algorithms are only implemented for the TensorFlow backend, while relying also on the Pytorch and JAX backends is planned for a future release. The following tables report the complete set of algorithms and players classes currently available, together with a snapshot of their implementation details.
Generative Adversarial Networks
| Algorithms* | Source | Avail | Test | Lipschitz** | Refs | Tutorial |
|:-----------:|:------:|:-----:|:----:|:-----------:|:----:|:--------:|
| GAN | k2/k3 | ✅ | ✅ | ❌ | 2, 10, 11 | |
| BceGAN |
k2/k3 | ✅ | ✅ | ❌ | 4, 10, 11 | |
| LSGAN |
k2/k3 | ✅ | ✅ | ❌ | 5, 10, 11 | |
| WGAN |
k2/k3 | ✅ | ✅ | ✅ | 6, 11 | |
| WGAN-GP |
k2/k3 | ✅ | ✅ | ✅ | 7, 11 | |
| CramerGAN |
k2/k3 | ✅ | ✅ | ✅ | 8, 11 | |
| WGAN-ALP |
k2/k3 | ✅ | ✅ | ✅ | 9, 11 | |
| BceGAN-GP |
k2/k3 | ✅ | ✅ | ✅ | 4, 7, 11 | |
| BceGAN-ALP |
k2/k3 | ✅ | ✅ | ✅ | 4, 9, 11 | |
*each GAN algorithm is designed to operate taking conditions as input [3]
**the GAN training is regularized to ensure that the discriminator encodes a 1-Lipschitz function
Generators
| Players | Source | Avail | Test | Skip conn | Refs |
|:-------:|:------:|:-----:|:----:|:---------:|:----:|
| Generator | k2/k3 | ✅ | ✅ | ❌ | 2, 3 |
| ResGenerator | k2/k3 | ✅ | ✅ | ✅ | 2, 3, 12 |
Discriminators
| Players | Source | Avail | Test | Skip conn | Aux proc | Refs |
|:-------:|:------:|:-----:|:----:|:---------:|:--------:|:----:|
| Discriminator | k2/k3 | ✅ | ✅ | ❌ | ❌ | 2, 3, 11 |
| ResDiscriminator | k2/k3 | ✅ | ✅ | ✅ | ❌ | 2, 3, 11, 12 |
| AuxDiscriminator | k2/k3 | ✅ | ✅ | ✅ | ✅ | 2, 3, 11, 12, 13 |
Other players
| Players | Source | Avail | Test | Skip conn | Aux proc | Multiclass |
|:-------:|:------:|:-----:|:----:|:---------:|:--------:|:---------:|
| Classifier | src | ✅ | ✅ | ❌ | ❌ | ❌ |
| ResClassifier | src | ✅ | ✅ | ✅ | ❌ | ❌ |
| AuxClassifier | src | ✅ | ✅ | ✅ | ✅ | ❌ |
| MultiClassifier | src | ✅ | ✅ | ❌ | ❌ | ✅ |
| MultiResClassifier | src | ✅ | ✅ | ✅ | ❌ | ✅ |
| AuxMultiClassifier | src | ✅ | ✅ | ✅ | ✅ | ✅ |
References
- M. Barbetti, "The flash-simulation paradigm and its implementation based on Deep Generative Models for the LHCb experiment at CERN", PhD thesis, University of Firenze, 2024
- I.J. Goodfellow et al., "Generative Adversarial Networks", arXiv:1406.2661
- M. Mirza, S. Osindero, "Conditional Generative Adversarial Nets", arXiv:1411.1784
- A. Radford, L. Metz, S. Chintala, "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks", arXiv:1511.06434
- X. Mao et al., "Least Squares Generative Adversarial Networks", arXiv:1611.04076
- M. Arjovsky, S. Chintala, L. Bottou, "Wasserstein GAN", arXiv:1701.07875
- I. Gulrajani et al., "Improved Training of Wasserstein GANs", arXiv:1704.00028
- M.G. Bellemare et al., "The Cramer Distance as a Solution to Biased Wasserstein Gradients", arXiv:1705.10743
- D. Terjék, "Adversarial Lipschitz Regularization", arXiv:1907.05681
- M. Arjovsky, L. Bottou, "Towards Principled Methods for Training Generative Adversarial Networks", arXiv:1701.04862
- T. Salimans et al., "Improved Techniques for Training GANs", arXiv:1606.03498
- K. He et al., "Deep Residual Learning for Image Recognition", arXiv:1512.03385
- A. Rogachev, F. Ratnikov, "GAN with an Auxiliary Regressor for the Fast Simulation of the Electromagnetic Calorimeter Response", arXiv:2207.06329
Credits
Most of the GAN algorithms are an evolution of what provided by the mbarbetti/tf-gen-models repository. The BceGAN model is freely inspired by the TensorFlow tutorial Deep Convolutional Generative Adversarial Network and the Keras tutorial Conditional GAN. The WGAN-ALP model is an adaptation of what provided by the dterjek/adversariallipschitzregularization repository.
Citing PIDGAN
To cite this repository:
bibtex
@software{pidgan:2023abc,
author = "Matteo Barbetti and Lucio Anderlini",
title = "{PIDGAN: GAN-based models to flash-simulate the LHCb PID detectors}",
version = "v0.2.0",
url = "https://github.com/mbarbetti/pidgan",
doi = "10.5281/zenodo.10463728",
publisher = "Zenodo",
year = "2023",
}
In the above bibtex entry, the version number is intended to be that from pidgan/version.py, while the year corresponds to the project's open-source release.
License
PIDGAN has a GNU General Public License v3 (GPLv3), as found in the LICENSE file.
Owner
- Name: Matteo Barbetti
- Login: mbarbetti
- Kind: user
- Location: Firenze, Italy
- Company: University of Florence
- Website: mbarbetti.github.io
- Twitter: mbarbetz
- Repositories: 11
- Profile: https://github.com/mbarbetti
PhD student in Smart Computing @ UniFi
Citation (CITATION.bib)
@software{pidgan:2023abc,
author = "Lucio Anderlini and Matteo Barbetti",
title = "{PIDGAN: GAN-based models to flash-simulate the LHCb PID detectors}",
version = "v0.2.0",
url = "https://github.com/mbarbetti/pidgan",
doi = "10.5281/zenodo.10463728",
publisher = "Zenodo",
year = "2023",
}
GitHub Events
Total
- Watch event: 3
- Pull request event: 2
- Create event: 2
Last Year
- Watch event: 3
- Pull request event: 2
- Create event: 2
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Matteo Barbetti | m****4@g****m | 161 |
| dependabot[bot] | 4****] | 3 |
| Matteo Barbetti | 5****i | 1 |
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 7
- Total pull requests: 9
- Average time to close issues: 10 days
- Average time to close pull requests: about 1 month
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 0.43
- Average comments per pull request: 0.33
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 7
Past Year
- Issues: 1
- Pull requests: 3
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.33
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
- mbarbetti (7)
Pull Request Authors
- dependabot[bot] (10)
- mbarbetti (3)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 73 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 13
- Total maintainers: 1
pypi.org: pidgan
GAN-based models to flash-simulate the LHCb PID detectors
- Documentation: https://pidgan.readthedocs.io/
- License: GPLv3 License
-
Latest release: 0.2.0
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- pyyaml *
- scikit-learn >=1.0
- tensorflow >=2.7
- pyyaml *
- scikit-learn >=1.0
- tensorflow >=2.7
- black *
- flake8 *
- isort *
- pytest >=6.0 test
- pytest-cov * test
- html-reports >=0.2
- matplotlib *
- numpy *
- pandas *
- pyyaml *
- scikinC >0.2.6
- tqdm *
- uproot *