bartz.stochtree.GeneralParams

class bartz.stochtree.GeneralParams(*, standardize=True, sample_sigma2_global=True, sigma2_global_shape=0.0, sigma2_global_scale=0.0, variable_weights=None, random_seed=None, keep_every=1, num_chains=1, outcome_model=OutcomeModel(), sigma2_init=None)[source]

Mirror of stochtree’s general_params dict of BARTModel.sample, with the keys bartz handles.

sigma2_init: float | Float[Array, ''] | Float[ndarray, ''] | None = None

Starting value of the global error variance. If None (default), uses var(resid_train) for continuous and 1.0 for probit.

keep_every: int = 1

Thinning factor for retained MCMC samples.

num_chains: int = 1

Number of independent MCMC chains.

random_seed: int | Key[Array, ''] | None = None

Seed for the random number generator. Unlike stochtree, the default None is deterministic (equivalent to seed 0) rather than drawing a random seed, so repeated fits reproduce by default.

sample_sigma2_global: bool = True

Whether to sample the global error variance, or hold it fixed at its starting value. Ignored for probit binary regression, where the variance is fixed at 1.

sigma2_global_scale: float | Float[Array, ''] | Float[ndarray, ''] = 0.0

Scale parameter of the inverse-gamma prior on the global error variance.

sigma2_global_shape: float | Float[Array, ''] | Float[ndarray, ''] = 0.0

Shape parameter of the inverse-gamma prior on the global error variance. bartz does not support shape 0 with positive scale, which yields NaN samples.

standardize: bool = True

Whether to standardize the outcome before fitting. Ignored for probit binary.

variable_weights: Float[Array, 'p'] | Float[ndarray, 'p'] | None = None

Relative probability of splitting on each covariate. The trees never split on covariates with weight 0.

outcome_model: OutcomeModel

Outcome family and link specification. Defaults to continuous with identity link.