Link Search Menu Expand Document
PyXAI
Papers Video GitHub In-the-Loop EXPEKCTATION Release Notes About

Building Models

The Builder module of PyXAI allows you to build a tree-based classifier using nodes and leaves. This can be very useful to test and verify different types of explanations. All function definitions are available in the API. Some examples are provided in the Decision Tree, Random Forest and Boosted Tree pages.

PyXAI data structures are used directly in the Builder module.

Each DecisionNode represents a condition “<id_feature> <operator> <threshold> ?” (such as “$x_4 \ge 0.5$ ?”) which can be created using the DecisionNode class:

When the operator and threshold parameters are not defined, they take their default values. In this case, the associated condition is of the form “$x \ge 0.5$ ?” which can be used to represent a binary feature (i.e. a feature with value 0 or 1).

The DecisionTree, RandomForest and BoostedTrees methods allow you to create models. During this process, binary variables representing the conditions (of the form “<id_feature> <operator> <threshold> ?”) of nodes are defined. These binary variables allow one to represent instances and explanations. The value of a binary variable denotes the condition used and its sign indicates whether this condition is satisfied or not in the model. By default, these binary variables have random values depending on the order according to which the tree is traversed. However, in rare cases when the features represent conditions (this is not true with most datasets), setting the force_features_equal_to_binaries parameter to True allows us to get binary variables, and then explanations, that directly match the features, without needing to use the to_features method.

The Builder module of PyXAI also allows you to build a regression model with tree components using nodes and leaves. This can be very useful to test and verify different types of explanations.

An example of how to build a regression model is given in the second part of the Boosted Tree page.


Table of contents