importBF: Import the BI Python Module

View source: R/importBF.R

importBFR Documentation

Import the BI Python Module

Description

This function initializes the BI Python module through **reticulate**, sets up the environment, and loads the necessary 'jax' and 'jax.numpy' modules. The BI module is stored in the hidden object '.bf' for internal use, but the initialized BI object is also returned for convenience.

Usage

importBF(
  platform = "cpu",
  cores = NULL,
  rand_seed = TRUE,
  deallocate = FALSE,
  print_devices_found = TRUE,
  backend = "numpyro"
)

Arguments

platform

Character string, the computational platform to use (e.g. '"cpu"' or '"gpu"'). Defaults to '"cpu"'.

cores

Integer or 'NULL'. Number of CPU cores to use. Defaults to 'NULL'.

rand_seed

(Boolean): Random seed. Defaults to TRUE.

deallocate

Logical. Whether memory should be deallocated when not in use. Defaults to 'FALSE'.

print_devices_found

(bool, optional): Whether to print devices found. Defaults to TRUE.

backend

(str, optional): Backend to use (numpyro or tfp). Defaults to 'numpyro'.

Details

- Internally, this function imports the 'BI' Python package and assigns it to the hidden variable '.bf'. - It also imports 'jax' and 'jax.numpy', assigning them to 'jax' and 'jnp' respectively. - Startup messages inform the user about the imports.

Value

An initialized BI module object (Python object via **reticulate**).

Examples


library(BayesForge)
m <- importBF()


BayesForge documentation built on June 9, 2026, 1:09 a.m.