explainer.base#
This module gathers base Explanation Methods
Classes
|
Base class for incremental explainer algorithms. |
|
Base class for incremental feature importance explainer algorithms. |
- class explainer.base.BaseIncrementalExplainer(model_function, feature_names)[source]#
Bases:
objectBase class for incremental explainer algorithms.
Warning: This class should not be used directly. Use derived classes instead.
- Parameters:
model_function (Callable) – The Model function to be explained.
feature_names (list) – List of feature names to be explained for the model.
- class explainer.base.BaseIncrementalFeatureImportance(model_function, loss_function, feature_names, storage=None, imputer=None, dynamic_setting=False, smoothing_alpha=None)[source]#
Bases:
BaseIncrementalExplainerBase class for incremental feature importance explainer algorithms.
Warning: This class should not be used directly. Use derived classes instead.
- get_normalized_importance_values(mode='sum')[source]#
Normalizes the importance scores.
- Parameters:
mode (str) – The normalization mode to be applied. Possible values are ‘sum’ and ‘delta’.
'sum'. (Defaults to) –
sum: Normalizes the importance scores by division through the sum of importance scores.
delta: Normalizes the importance scores by division through the difference between the max of the
importance scores and the min of the importance scores.
- Returns:
The normalized importance values.
- Return type:
(dict)
- update_storage(x_i, y_i=None)[source]#
Manually updates the data storage with the given observation. :type x_i:
dict:param x_i: The input features of the current observation. :type x_i: dict :type y_i:Optional[Any] :param y_i: Target label of the current observation. Defaults to None :type y_i: Any, optional
- property importance_values#
Incremental Importance Values property.
- property variances#
Incremental Variances values property.