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.9.0.tar.gz (90.4 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.9.0-py3-none-any.whl (114.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bartz-0.9.0.tar.gz
  • Upload date:
  • Size: 90.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.9.0.tar.gz
Algorithm Hash digest
SHA256 7dc9cbf42e614d63a0977b88cec1cb1000867aa172a5c31e20852a622f38e977
MD5 2e10a2061c4a150d09a60f7e822df7f4
BLAKE2b-256 038371db87be33aa009464cc7b85a55802410d2aca7d2a79469977d464e6650c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bartz-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 114.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8375ec032330468d13d61f23a7871c83a59f5413a08464293ce52ccfec06fda0
MD5 fb7e0453ae19e21f40590fdd3cd56bbb
BLAKE2b-256 075da6a473f5ebb4e4c60f93e9e9b5bdb490d3042bba64e79e9850c87fcf91f1

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