Skip to main content

rbartpackages

Python wrappers of R BART (Bayesian Additive Regression Trees) packages.

rbartpackages lets you use a few R BART implementations (including the 3 most popular ones) from Python with a natural Python experience. The Python wrappers closely follow the R packages they wrap, so they should be obvious to use coming from R if one wants to switch to Python.

The packages included are:

The wrappers are incomplete and only wrap the main functions and objects of the packages. The most complete wrapper is dbarts. If you need more functionality wrapped, feel free to open an issue on github. Alternatively, this library provides simplified tools and utilities to let the user wrap arbitrary R classes and functions, see the guide and the reference.

Installation

pip install rbartpackages

You also need R with the latest version of the package(s) you want to use installed (BART, dbarts, bartMachine from CRAN; BART3 from rsparapa/bnptools and missBART from yongchengoh/missBART on GitHub). bartMachine additionally requires Java. If you install polars[pyarrow], dataframes are returned as polars dataframes instead of pandas dataframes. For convenience, you can install both with pip install 'rbartpackages[polars]'. If you install jax (separately or with pip install 'rbartpackages[jax]'), jax arrays are accepted as input in place of numpy arrays, but output arrays remain numpy.

Usage

import numpy as np
from rbartpackages import BART3

x_train = np.random.randn(100, 5)
y_train = x_train[:, 0] + 0.1 * np.random.randn(100)

bart = BART3.gbart(x_train=x_train, y_train=y_train, ndpost=200)
y_pred = bart.predict(x_train)  # shape (ndpost, n)

R argument names with dots are passed with underscores (x.train → x_train).

Metadata

Release files for rbartpackages 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rbartpackages 0.3.1
File Size Uploaded Provenance Actions
rbartpackages-0.3.1.tar.gz 49.6 kB Without provenance Details for rbartpackages-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rbartpackages 0.3.1
File Interpreter ABI Platform Actions
rbartpackages-0.3.1-py3-none-any.whl Python 3 none any Details for rbartpackages-0.3.1-py3-none-any.whl

Total release size: 117.0 kB

Release files / rbartpackages-0.3.1.tar.gz

Download URL rbartpackages-0.3.1.tar.gz
Size 49.6 kB
Tags Source
SHA-256 checksum
How to use checksums
17063b19c19dc7f271deba804d19f820d3ae0decdf5e99480aa47aadbd9a5c6a
BLAKE2b-256 checksum
How to use checksums
b4c1c296a8cc098b65d35c720f868fdc3771427d53af0c49e75974fa92159bad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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}

Release files / rbartpackages-0.3.1-py3-none-any.whl

Download URL rbartpackages-0.3.1-py3-none-any.whl
Size 67.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82ce8c0f7847227ff866412d14364b1e37975a7f88af389604af62a0088c54f3
BLAKE2b-256 checksum
How to use checksums
faac3f480ae2173424e2234651f33f5f9895a8fdb027cbe4e8e3f103b8d14eca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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}

Security for rbartpackages 0.3.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page