modeva.TestSuite.interpret_local_fi#
- TestSuite.interpret_local_fi(dataset: str = 'test', sample_index: int = 0, centered: bool = True)#
Calculates and visualizes feature importance scores for a single sample.
This function computes the local feature importance scores for a specified sample from the dataset, visualizes the results, and returns a structured validation result containing the analysis details.
- Parameters:
dataset ({"main", "train", "test"}, default="test") – The data set used for calculating the explanation results.
sample_index (int, default=0) – Index of the specific sample to analyze within the selected dataset
centered (bool, default=True) – Whether to center the feature importance scores by subtracting the mean effect of each feature across all samples
- Returns:
A container object with the following components:
key: “interpret_fi_local”
data: Name of the dataset used
model: Name of the model used
inputs: Input parameters used for the analysis
value: Dictionary containing:
”Name”: List of feature names
”Importance”: Feature importance scores
”Values”: Original feature values
table: DataFrame version of the value dictionary
options: Dictionary of visualizations configuration for a horizontal bar-stem plot where x-axis is importance, and y-axis is the feature names. Run results.plot() to show this plot.
- Return type:
Examples