bartz.bcf.init_bcf¶
- bartz.bcf.init_bcf(*, X_unified, trt, y, outcome_type='continuous', offset, max_split_mu, max_split_tau, num_trees_mu, num_trees_tau, p_nonterminal_mu, p_nonterminal_tau, sum_trees_prior_cov_inv_mu, sum_trees_prior_cov_inv_tau, min_points_per_leaf_mu, min_points_per_leaf_tau, filter_splitless_vars_mu=0, filter_splitless_vars_tau=0, log_s_mu=None, log_s_tau=None, tau_0_prior_var=None, sample_intercept=True, adaptive_coding=False, b_init=None, error_cov_inv=None, num_chains=None)[source]¶
Initialize the MCMC state of a Bayesian Causal Forest.
- Parameters:
X_unified (
UInt[Array, 'p n']|UInt[ndarray, 'p n']) – The unified binned predictors matrix [X, pihat].trt (
Bool[Array, 'n']|Bool[ndarray, 'n']) – The binary treatment assignment.y (
Float32[Array, 'n']|Float32[ndarray, 'n']) – The response array.outcome_type (
Literal['continuous','binary'], default:'continuous') – The regression target type (‘continuous’ or ‘binary’).offset (
float|Float[Array, '']|Float[ndarray, '']) – The response offset.max_split_mu (
UInt[Array, 'p']|UInt[ndarray, 'p'])max_split_tau (
UInt[Array, 'p']|UInt[ndarray, 'p']) – Maximum splits for the prognostic and treatment forests.num_trees_mu (
int)num_trees_tau (
int) – Number of trees in the prognostic and treatment forests.p_nonterminal_mu (
Float32[Array, 'd_mu']|Float32[ndarray, 'd_mu'])p_nonterminal_tau (
Float32[Array, 'd_tau']|Float32[ndarray, 'd_tau']) – Split priors for the prognostic and treatment forests.sum_trees_prior_cov_inv_mu (
Wishart)sum_trees_prior_cov_inv_tau (
Wishart) – The Wishart priors on the precisions of the sums of trees of the prognostic and treatment forests and their initial values, seebartz.mcmcstep.init.min_points_per_leaf_mu (
int)min_points_per_leaf_tau (
int) – Minimum data points per leaf for the prognostic and treatment forests. Nodes with less than twice as many points are not proposed for growth. Both forests count all the units, untreated ones included.filter_splitless_vars_mu (
int, default:0)filter_splitless_vars_tau (
int, default:0) – The maximum number of predictors without splits that each forest can ignore, seebartz.mcmcstep.init. Must be known at trace time.log_s_mu (
Float32[Array, 'p']|Float32[ndarray, 'p']|None, default:None)log_s_tau (
Float32[Array, 'p']|Float32[ndarray, 'p']|None, default:None) – The logarithms of the prior probabilities of splitting on each predictor in the prognostic and treatment forests, seebartz.mcmcstep.init.Nonefor uniform.tau_0_prior_var (
float|Float[Array, '']|Float[ndarray, '']|None, default:None) – Prior variance for the global treatment intercepttau_0.sample_intercept (
bool, default:True) – Whether to sample a global treatment intercepttau_0.adaptive_coding (
bool, default:False) – Whether to use adaptive coding for the treatment effect, seebartz.bcf.bcf.b_init (
tuple[float|Float[Array, '']|Float[ndarray, ''],float|Float[Array, '']|Float[ndarray, '']] |Float[Array, '2']|Float[ndarray, '2']|None, default:None) – The initial coding weights of untreated and treated units with adaptive coding, default(-0.5, 0.5). Ignored without adaptive coding.error_cov_inv (
Wishart|None, default:None) – The Wishart prior on the error precision and its initial value,Nonefor binary outcomes. Seebartz.mcmcstep.init.num_chains (
int|None, default:None) – The number of independent MCMC chains,Nonefor a single chain without a chain axis. Seebartz.mcmcstep.init.
- Returns:
BCFState– The initial BCF MCMC state.
Notes
The arrays passed to this function as arguments may be donated, invalidating them, see
bartz.mcmcstep.init.