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.11.0.tar.gz (161.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.11.0-py3-none-any.whl (199.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bartz-0.11.0.tar.gz
  • Upload date:
  • Size: 161.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.11.0.tar.gz
Algorithm Hash digest
SHA256 7642f6795e436f4c50478980ebc1e68ebaa6c379e4bc8ab216a7fee040a3df45
MD5 3bfa0445fe5dd5377cb7c91b52bb4ec9
BLAKE2b-256 8ab36fd7bd7412207e3e9029a52b52ddf0d72a5b411c0260e129e9f56d1c308f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bartz-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 199.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c937bb1a6c3ed0c5181463bdc257009551f6b45143d6dd2b03917f9dc64e7112
MD5 816d896140e60c5ad0e914c591fcd31b
BLAKE2b-256 d6d5530e0a2fe6c0bfa3a3f69b7f2daaa09244ac26bb66ea3e492ec3b0909542

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