bartz.debug.sample_prior¶
- bartz.debug.sample_prior(key, state)[source]¶
Draw the parameters of the model from their prior.
Replace the same model parameters that
bartz.mcmcstep.stepwould update, with a sample from the prior. The data is left unchanged. Derived fields are updated but for some secondary diagnostics.- Parameters:
key (
Key[Array, '']) – A jax random key.state (
StateT) – A BART MCMC state, as created bybartz.mcmcstep.init.
- Returns:
StateT– The state with new parameters.- Raises:
NotImplementedError – If the minimum number of points per node is set together with a prior on the variable selection probabilities, or if the data is sharded.
Notes
The minimum number of points per node restricts the prior support to the trees that satisfy the constraints on the data
State.X. The trees are sampled exactly by rejection. This does not work with a randomSparsity.log_s, because then the constraints also change its marginal distribution.The memory of the input state is re-used for the output state, so the input state can not be used any more, like with
bartz.mcmcstep.step.