bartz.debug.sample_data¶
- bartz.debug.sample_data(key, state)[source]¶
Draw the data from the model given the parameters.
Replaces the outcome
State.y, and the latent outcomeState.zin binary regression. The predictors and the missing datapoints are left unchanged.State.residis updated incrementally rather than recomputed, so any inconsistency it had with the other fields persists.- Parameters:
key (
Key[Array, '']) – A jax random key.state (
StateT) – A BART MCMC state. If it has multiple chains, it must be aChainDataState, to draw separate data for each chain.
- Returns:
StateT– The state with new data.- Raises:
ValueError – If
statehas multiple chains which share the data.NotImplementedError – If the data is sharded.
Notes
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.