ictonyx.explainers
SHAP-based feature importance across runs.
- ictonyx.explainers.plot_shap_summary(model_wrapper, X_data, feature_names=None, plot_type='bar')[source]
Generates a SHAP summary plot for a model.
- Parameters:
model_wrapper (BaseModelWrapper) – The trained model wrapper.
X_data (np.ndarray) – The data to explain.
feature_names (Optional[List[str]]) – List of feature names.
plot_type (str) – The type of plot to generate (“bar”, “dot”, “violin”).
- ictonyx.explainers.plot_shap_waterfall(model_wrapper, X_data, sample_index=0, feature_names=None, class_index=0)[source]
Generates a SHAP waterfall plot for a single prediction.
- Parameters:
model_wrapper (BaseModelWrapper) – The trained model wrapper.
X_data (np.ndarray) – The data to explain.
sample_index (int) – Index of the sample to explain.
feature_names (Optional[List[str]]) – List of feature names.
class_index (int) – For multi-class models, which class to explain.
- ictonyx.explainers.plot_shap_dependence(model_wrapper, X_data, feature_name, feature_names=None, interaction_index=None, class_index=0)[source]
Generates a SHAP dependence plot showing how a feature affects predictions.
- Parameters:
model_wrapper (BaseModelWrapper) – The trained model wrapper.
X_data (np.ndarray) – The data to explain.
feature_name (str) – Name of the feature to plot (or index if feature_names not provided).
feature_names (Optional[List[str]]) – List of feature names.
interaction_index (Optional[int]) – Feature index to use for coloring interaction effects.
class_index (int) – For multi-class models, which class to explain.
- ictonyx.explainers.get_shap_feature_importance(model_wrapper, X_data, feature_names=None, class_index=0)[source]
Get feature importance scores based on mean absolute SHAP values.
- Parameters:
model_wrapper (BaseModelWrapper) – The trained model wrapper.
X_data (np.ndarray) – The data to explain.
feature_names (Optional[List[str]]) – List of feature names.
class_index (int) – For multi-class models, which class to analyze.
- Returns:
Mean absolute SHAP values for each feature.
- Return type:
np.ndarray