holisticai.explainability.metrics.weighted_tree_gini#
- holisticai.explainability.metrics.weighted_tree_gini(tree)[source]#
Compute the weighted Gini index for the tree (WGNI). Reference value: 0.0
Parameters
- treeTree
The tree to compute the weighted Gini index of.
Returns
- float
The weighted Gini index of the tree.
Examples
>>> from sklearn.datasets import load_iris >>> from sklearn.tree import DecisionTreeClassifier >>> from holisticai.explainability.metrics import weighted_average_depth >>> X, y = load_iris(return_X_y=True) >>> clf = DecisionTreeClassifier() >>> clf.fit(X, y) >>> weighted_tree_gini(clf.tree_)