kernel.compute_forest_max_leaf_index

kernel.compute_forest_max_leaf_index(
    model_object,
    forest_type=None,
    forest_inds=None,
)

Compute and return the largest possible leaf index computable by compute_forest_leaf_indices for the forests in a designated forest sample container.

Parameters

Name Type Description Default
model_object BARTModel, BCFModel, or ForestContainer Object corresponding to a BART / BCF model with at least one forest sample, or a low-level ForestContainer object. required
forest_type str Which forest to use from model_object. Valid inputs depend on the model type, and whether or not a given forest was sampled in that model. * BART * 'mean': 'mean': Extracts leaf indices for the mean forest * 'variance': Extracts leaf indices for the variance forest * BCF * 'prognostic': Extracts leaf indices for the prognostic forest * 'treatment': Extracts leaf indices for the treatment effect forest * 'variance': Extracts leaf indices for the variance forest * ForestContainer * NULL: It is not necessary to disambiguate when this function is called directly on a ForestSamples object. This is the default value of this None
forest_inds int or np.ndarray Indices of the forest sample(s) for which to compute max leaf indices. If not provided, this function will return max leaf indices for every sample of a forest. This function uses 0-indexing, so the first forest sample corresponds to forest_num = 0, and so on. None

Returns

Name Type Description
Numpy array containing the largest possible leaf index computable by compute_forest_leaf_indices for the forests in a designated forest sample container.