modeva.TestSuite.interpret_llm_profile#
- TestSuite.interpret_llm_profile(feature: str = None, dataset: str = 'test')#
Calculate local feature importance for a specific feature using LLM profiles.
This function computes the local feature importance for a given feature by analyzing the LLM profiles and visualizes the results. It retrieves the necessary data, calculates the feature importance, and generates a plot that illustrates the distribution of feature importance across different LLMs.
- Parameters:
feature (str) – Feature name to explain.
dataset ({"main", "train", "test"}, default="test") – The data set used for calculating the explanation results.
nllms (int, default=30) – The number of top LLMs to show.
- Returns:
A container object with the following components:
key: “llm_profile”
data: Name of the dataset used
model: Name of the model used
inputs: Input parameters
value: Dictionary containing:
”feature”: Name of the feature being analyzed
”sample_idx_by_llms”: Sample indices grouped by LLMs
”feature_names”: List of feature names
”feature_importance”: Feature importance scores
options: Dictionary of visualizations configuration for a LLM profile plot. Run results.plot() to show this plot.
- Return type:
Examples