bartz.debug.trees_BART_to_bartz¶
- bartz.debug.trees_BART_to_bartz(trees, *, min_maxdepth=0, offset=None)[source]¶
Convert trees from the R BART format to the bartz format.
- Parameters:
trees (
str) – The string representation of a trace of trees of the R BART package. Can be accessed frommc_gbart(...).treedraws['trees'].min_maxdepth (
int, default:0) – The maximum tree depth of the output will be set to the maximum observed depth in the input trees. Use this parameter to require at least this maximum depth in the output format.offset (
float|Float[Array, '']|Float[ndarray, '']|None, default:None) – The trace returned bybartz.mcmcloop.run_mcmccontains an offset to be summed to the sum of trees. To match that behavior, this function returns an offset as well, zero by default. Set with this parameter otherwise.
- Returns:
trace (TraceWithOffset) – A representation of the trees compatible with the trace returned by
bartz.mcmcloop.run_mcmc.meta (BARTTraceMeta) – The metadata of the trace, containing the number of iterations, trees, and the maximum split value.