Skip to main content

Python wrappers of R BART packages via rpy2

Project description

rbartpackages

Python wrappers of R BART (Bayesian Additive Regression Trees) packages, built on rpy2.

rbartpackages lets you call several R BART implementations from Python with a uniform, lightly-typed interface: arguments are converted to R, the fitted R object's components become Python attributes, and the original R documentation is attached to each wrapper class. It currently wraps:

Installation

pip install rbartpackages

You also need R with 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. Optional extras pandas, polars, and jax enable passing those array/frame types directly. See the documentation for details.

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.trainx_train).

Links

These wrappers originated in the bartz project, where they are used to validate against reference R implementations.

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

rbartpackages-0.2.0.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

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

rbartpackages-0.2.0-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file rbartpackages-0.2.0.tar.gz.

File metadata

  • Download URL: rbartpackages-0.2.0.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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 rbartpackages-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fc1f2e66f8f88170c03595f16e090c57b1c22bf3762c4c9866eca5cda690113b
MD5 467b9f29796128b4f475bad818233703
BLAKE2b-256 536eb3f282e0807fd4b565b693fc807a921820f8514ad84fa52c7ec3d4fa452c

See more details on using hashes here.

File details

Details for the file rbartpackages-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rbartpackages-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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 rbartpackages-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14a24cfcafbecd68321dadcf1babefef26c495a3e4fe2de394a458ecf905c192
MD5 49e1d8bcbae3cfce2a83c35352fde993
BLAKE2b-256 6e0ed961b4b9d1ee5494cf553aa057f0e983d5f78e240229ffeabc078c9aeefe

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