RegressionPartialDependence
Partial dependence curves for regression models.
For each numeric feature, sweeps a grid of values, replaces the feature
with each grid value across the test set and averages the model's
predictions, showing the marginal effect of the feature on the predicted
value. Model agnostic (only predict is queried); assumes features are
not strongly correlated.
References
- [1] Friedman, J.H. (2001). "Greedy Function Approximation: A Gradient Boosting Machine." Annals of Statistics 29(5).
- [2] https://scikit-learn.org/stable/modules/partial_dependence.html
Parameters
- grid_resolution : integer, default=
50 - Number of equally spaced grid points per feature.
- lower_percentile : number, default=
0.05 - Lower percentile of the feature values used as grid start.
- upper_percentile : number, default=
0.95 - Upper percentile of the feature values used as grid end.
Methods
explain(self, dataset)
RegressionPartialDependenceCompute partial dependence curves on the test split.
Parameters
- dataset : Tuple[DatasetDict, DatasetDict]
- A
(x, y)pair where each element has at least a"test"split.
Returns
- dict
- Mapping from feature name to
{"grid_values", "average"}, plus a"metadata"entry with the output column name.
plot(self, explanation: dict) -> List[DashAI.back.core.artifacts.GroupedArtifacts]
RegressionPartialDependenceCreate a grouped artifact with one line plot group per feature.
Parameters
- explanation : dict
- Output of :meth:
explain.
Returns
- List[GroupedArtifacts]
- A single grouped artifact whose groups are one plotly curve per numeric feature.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.