bartz.stochtree.BCFGeneralParams

class bartz.stochtree.BCFGeneralParams(*, 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_global_init=None, propensity_covariate='prognostic', adaptive_coding=False, control_coding_init=-0.5, treated_coding_init=0.5)[source]

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

sigma2_global_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.

propensity_covariate: Literal['none', 'prognostic', 'treatment_effect', 'both'] = 'prognostic'

The forests that split on the propensity score, which then has splitting weight 1 / p, with p the number of columns of X_train. Unless 'none', propensity_train is required.

adaptive_coding: bool = False

Whether to code the treatment as b_0 (1 - Z) + b_1 Z, sampling b_0 and b_1 with independent priors N(0, 1/2), truncated to |b| >= 0.01. Ignored if Z_train is constant.

control_coding_init: float | Float[Array, ''] | Float[ndarray, ''] = -0.5

Initial value of b_0 with adaptive coding.

treated_coding_init: float | Float[Array, ''] | Float[ndarray, ''] = 0.5

Initial value of b_1 with adaptive coding.

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.