PartialDependenceExplainer#
- class sdm.explain.PartialDependenceExplainer(grid_resolution: int = 20)#
Bases:
ICEExplainerCompute the partial dependence of feature columns from the “Greedy Function Approximation: A Gradient Boosting Machine” paper.
The partial dependence of a column is the mean of its curves of
ICEExplainerover all query rows.- Parameters:
grid_resolution (int) – The number of grid values
Gof numerical columns.
- explain(model: ICLModel, x: TableTensor, output: str, inputs: str | Iterable[str] | None = None) dict[str, tuple[Tensor, Tensor]]#
Explain how feature values affect predictions.
- Parameters:
model (ICLModel) – The fitted model.
x (TableTensor) – The feature tensor of query examples with shape
[..., R, D]withRrows andDcolumns.output (str) – The name of the predicted column to explain.
inputs (str | Iterable[str] | None) – The name or names of the input feature columns to explain. If
None, all supported columns will be used.
- Returns:
A dictionary from each column name to its grid table with shape
[..., G]and its partial dependence with shape[..., G].- Return type: