holisticai.explainability.metrics.alpha_score#
- holisticai.explainability.metrics.alpha_score(feature_importance: ArrayLike, alpha: float = 0.8)[source]#
Alpha Score calculates the smallest proportion of features that account for the alpha percentage of the overall feature importance.
Parameters
- feature_importance: Importances
The feature importance values.
- alpha: float, optional
The alpha value represents the percentage of importance that will be considered in the calculation. For example, if alpha=0.8, the top 80% of the most important features will be considered.
Returns
- float
The alpha importance score
Examples
>>> from holisticai.explainability.commons import Importance >>> from holisticai.explainability.metrics import alpha_score >>> values = np.array([0.50, 0.30, 0.20]) >>> feature_names = ["feature_1", "feature_2", "feature_3"] >>> feature_importance = Importance(values=values, feature_names=feature_names) >>> alpha_score(feature_importance) 0.6666666666666666