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

Preferences

The PyXAI library offers the possibility to handle user preferences. Two kinds of preferences are supported:

  • The user may prefer some explanations to others.
  • The user may exclude some features from explanations.

More information about preferences can be found in the paper On Preferred Abductive Explanations for Decision Trees and Random Forests.

Preferred reasons

In this case, the user has to provide a weight for each feature, representing its disutility (or cost). The PyXAI library offers different options:

  • PreferredReasonMethod.SHAPLEY: Only available with Scikit-learn. It uses Shapley values to discriminate features. See this paper for more information.
  • PreferredReasonMethod.FEATURE_IMPORTANCE: Only available with Scikit-learn. It uses the feature importance of features to discriminate them. See this paper for more information.
  • PreferredReasonMethod.WORD_FREQUENCY: It uses the wordfreq package to discriminate features. The more frequent a word in a feature name, the more likely it is to be understood by users.
  • PreferredReasonMethod.WEIGHTS: The user defines the weights to be used.
  • PreferredReasonMethod.INCLUSION_PREFERRED: The user defines a partition over all features (a list of lists). The first elements of the partition are preferred to the second ones, which are preferred to the third ones, and so on.

The following methods accept a method parameter of type PreferredReasonMethod:

Method Model
preferred_sufficient_reason Decision Tree
preferred_majoritary_reason Random Forest

Excluded features

Excluding some features from explanations can be achieved using set_excluded_features. The function unset_excluded_features restores the initial state where no features are excluded.

The following methods respect excluded features:

Method DT RF BT
direct_reason
sufficient_reason  
minimal_sufficient_reason  
preferred_sufficient_reason    
contrastive_reason    
majoritary_reason    
preferred_majoritary_reason    
minimal_majoritary_reason    
minimal_contrastive_reason  
tree_specific_reason    

It may happen that excluded features prevent an explanation from being computed. In that case, the method returns [].