bartz.stochtree.PrognosticForestParams

class bartz.stochtree.PrognosticForestParams(*, num_trees=250, alpha=0.95, beta=2.0, min_samples_leaf=5, keep_vars=None, drop_vars=None, max_depth=10, sample_sigma2_leaf=True, sigma2_leaf_init=None, sigma2_leaf_shape=3.0, sigma2_leaf_scale=None)[source]

Mirror of stochtree’s prognostic_forest_params dict, restricted to the keys bartz handles.

num_trees: int = 250

Number of trees in the prognostic forest.

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

Initial leaf variance. If None, matches stochtree’s defaults of 2 * var(resid_train) / num_trees for continuous and 1 / num_trees for probit.

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

Twice the scale parameter of the inverse-gamma prior on the leaf variance. If None, defaults to var(resid_train) / num_trees for continuous and 1 / num_trees for probit.

alpha: float | Float[Array, ''] | Float[ndarray, ''] = 0.95

Tree split prior base.

beta: float | Float[Array, ''] | Float[ndarray, ''] = 2.0

Tree split prior decay.

drop_vars: Sequence[str] | Sequence[int] | Shaped[ndarray, 'k_drop'] | Integer[Array, 'k_drop'] | Series | None = None

Names (for dataframes) or indices of covariates the trees may not split on. Ignored if keep_vars is set.

keep_vars: Sequence[str] | Sequence[int] | Shaped[ndarray, 'k_keep'] | Integer[Array, 'k_keep'] | Series | None = None

Names (for dataframes) or indices of the only covariates the trees may split on.

max_depth: int = 10

Maximum tree depth. Must be a non-negative integer at most 16.

min_samples_leaf: int = 5

Minimum number of training samples at a leaf.

sample_sigma2_leaf: bool = True

Whether to sample the leaf variance with an inverse-gamma prior, or hold it fixed at sigma2_leaf_init.

sigma2_leaf_shape: float | Float[Array, ''] | Float[ndarray, ''] = 3.0

Twice the shape parameter of the inverse-gamma prior on the leaf variance, i.e., the prior is IG(sigma2_leaf_shape / 2, sigma2_leaf_scale / 2).