Skip to main content

PartialDependence

GlobalExplainer
DashAI.back.explainability.explainers.PartialDependence

Global explainer that shows how the model's average prediction changes with each feature.

A Partial Dependence Plot (PDP) marginalises the model output over the distribution of all other features, leaving a curve (or surface) that shows the average effect of the target feature in isolation. For a feature x_j, the partial dependence is:

::

f̄(x_j) = E_(x_-j) [ f(x_j, x_-j) ] ≈ (1/n) Σ_i f(x_j, x_-j,i)

PDPs assume feature independence; when features are correlated, the marginalisation extrapolates into regions with low data density. Individual Conditional Expectation (ICE) plots (one line per sample) can be overlaid to detect heterogeneous effects hidden by the average.

References

Parameters

grid_resolution : integer, default=100
Number of equidistant points to split the range of the target feature.
lower_percentile : number, default=0.05
Lower percentile used to limit the feature values.
upper_percentile : number, default=0.95
Upper percentile used to limit the feature values.

Methods

explain(self, dataset)

Defined on PartialDependence

Method to generate the explanation

Parameters

X: Tuple[DatasetDict, DatasetDict]
Tuple with (input_samples, targets). Input samples are used to evaluate the partial dependence of each feature
Returns:
dict
Dictionary with metadata and the partial dependence of each feature

plot(self, explanation: dict) -> List[dict]

Defined on PartialDependence

Method to create the explanation plot.

Parameters

explanation: dict
dictionary with the explanation generated by the explainer.
Returns:
List[dict]
list of JSONs containing the information of the explanation plot to be rendered.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It 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.

Compatible with