Generate C++ representations of boosted decision trees
This project tries to provide a generic functionality to transpile trained BDTs into minimal, efficient C++ functions to evaluate single vectors of features.
While many frameworks exist to train, evaluate and store BDTs, its often hard to use the results in a productive manner.
Installation
So far there is only python3 support. Run
pip install bdt2cpp
to install the latest tagged version or
pip install git+https://github.com/bixel/bdt2cpp.git
for the current master version.
lxplus
If you want to use bdt2cpp on CERNs lxplus machines, you need to get hold of minimum python3.6. According to CERNs Service Article KB0000730, one way to install the tool is:
# On lxplus
scl enable rh-python36
# this will install bdt2cpp to your `~/.local/` directory
pip install --user bdt2cpp
Usage
To generate a minimal Makefile together with the C++ code inside a build/
directory from a given XGBoost dump or TMVA .xml file, simply run
bdt2cpp my-bdt-dump.xgb
You will find the corresponding files within the build/ directory and if you
have installed clang, you can simply
cd build
make
Note for CERN Users: Currently, the Makefile uses clang as the default
compiler. You might need to adjust that in the generated file (inside the
build/ directory)
The generated executable is essentially a very minimal placeholder, if you had 3 input features you could quickly cross-check the predictions against the original training framework:
cd build
./main 1 2 3
should give the same output as received within the training framework if a
feature vector f = (1, 2, 3) is evaluated.
To see the complete list of features with some explanations, run
bdt2cpp -h
Metadata
Release files for bdt2cpp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bdt2cpp-0.2.0.tar.gz | 7.2 kB | Without provenance | Details for bdt2cpp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bdt2cpp-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for bdt2cpp-0.2.0-py2.py3-none-any.whl |
Total release size: 17.6 kB
Release files / bdt2cpp-0.2.0.tar.gz
| Download URL | bdt2cpp-0.2.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a711fde6399e7967d8a5c7c389900d5587a8eb79d2f0e79a88c5a7b25b47ff38
|
|
BLAKE2b-256 checksum How to use checksums |
bedd22ccb395fb7511a05939a769facf6d0936d4c42e8eb753d82a42e7bd9026
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
|
Release files / bdt2cpp-0.2.0-py2.py3-none-any.whl
| Download URL | bdt2cpp-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
02565b8c0fe49af7acea61db01ee260617e601cb67f9893327dc653f7d5dcdb6
|
|
BLAKE2b-256 checksum How to use checksums |
c17860922f703087dbeae4f714fe2475f80e1e85c0d0b66537e72d4365b1618f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
|
Security for bdt2cpp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.