Skip to main content

Super-fast BART (Bayesian Additive Regression Trees) in Python

Project description

PyPI DOI

BART vectoriZed

An implementation of Bayesian Additive Regression Trees (BART) in JAX.

If you don't know what BART is, but know XGBoost, consider BART as a sort of Bayesian XGBoost. bartz makes BART run fast enough to be used in place of XGBoost/lightgbm/etc. even on large datasets.

BART is a nonparametric Bayesian regression technique. Given training predictors $X$ and responses $y$, BART finds a function to predict $y$ given $X$. The result of the inference is a sample of possible functions, representing the uncertainty over the determination of the function.

This Python module provides an implementation of BART that runs on GPU, to process large datasets faster. It is also good on CPU. Most other implementations of BART are for R, and run on CPU only.

On CPU, bartz runs at the speed of dbarts (the fastest implementation I know of) if n > 20,000, but using 1/20 of the memory. On GPU, the speed premium depends on sample size; it is convenient over CPU only for n > 10,000. The maximum speedup is currently 200x, on an Nvidia A100 and with at least 2,000,000 observations.

This Colab notebook runs bartz with n = 100,000 observations, p = 1000 predictors, 10,000 trees, for 1000 MCMC iterations, in 10 minutes.

BART is a very flexible method with many variants. This implementation provides only a small subset of the possible features. If you need a feature from another BART implementation or from the BART literature, please open an issue on github.

Links

Citing bartz

Article: Petrillo (2024), "Very fast Bayesian Additive Regression Trees on GPU", arXiv:2410.23244.

To cite the software directly, including the specific version, use zenodo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bartz-0.10.0.tar.gz (102.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bartz-0.10.0-py3-none-any.whl (131.4 kB view details)

Uploaded Python 3

File details

Details for the file bartz-0.10.0.tar.gz.

File metadata

  • Download URL: bartz-0.10.0.tar.gz
  • Upload date:
  • Size: 102.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bartz-0.10.0.tar.gz
Algorithm Hash digest
SHA256 a2ab85db716f9b4913e3e0b80bc7eb3173c6116896c29db797f939874b3775ba
MD5 1cfbbd8de6ceedf876a76555943817a7
BLAKE2b-256 9efacf1e48a730d029a749831faa55a1290d22675f2504d7dfcd263302141b65

See more details on using hashes here.

File details

Details for the file bartz-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: bartz-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 131.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for bartz-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59cac3c4af28b18be67e68b38714f8552fa7aaaa092a47eb20a9846f42c93cce
MD5 a4629a086ba7be30ca9880583d01c043
BLAKE2b-256 9b6a5f338534c44bcfad1f17164ffb878ad8db697b7d57f0708761d3bfd02919

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page