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 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.1.0.tar.gz (14.3 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.1.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rbartpackages-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 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 rbartpackages-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f0425eb7d5b1a9d2ad1e6e190f9a203770335d4709f2ef0398364567302bbdda
MD5 2ab61da38e23ec9b0fc59fb93025e341
BLAKE2b-256 0103751240aed7ee72d73ba8672e0b171dd0440ab93b011453e9b723b5afc58b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rbartpackages-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 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 rbartpackages-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5d2edd6c5194b0d9eb00fa5b70394f41d37c6841f5fbd67e30c1eca12ba152f
MD5 9fd66543ecc2ea7894b7efa098f2bcc9
BLAKE2b-256 a89ba29f19167479bdefd7ec77f8fd5ab98558d0be7586e95d9ec7c18e895b7c

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