# A Comparative Study of Two Rule-Based Explanation Methods for Diabetic Retinopathy Risk Assessment
## 4 Explanation Generation System  
In this section, we define the explanation generation methodology. Figure 2 shows the proposed architecture. Given an input \(x\), i.e., a patient record, we first pass it to the RETIPROGRAM to obtain a class, \(y\). Then, we pass the input \(x\) and its corresponding output \(y\) to the explanation unit (shown in the bottom part of Figure 2) to extract an explanation for that decision. The explanation unit (in blue) is composed of three parts: the neighbours' generation module, the training module and the explanation extraction module. Finally, we forward the obtained results to the evaluation part (explained in Section 5) of the system to obtain insights into its performance. In this article, we focus on describing the explanation and evaluation parts. We explain in detail each of these parts and their sub-modules below. For more information about the RETIPROGRAM and its development and evaluation, we refer the reader to our previous papers [14; 32; 33]. As we presented in Section 3, the neighbours' generation module applies a Uniform Cost Search based on the HVDM [26] distance metric, using some contextual information about the features to generate positive neighbours (instances with the same label as \(x\)) and negative neighbours (instances with different labels than \(x\)). All of these examples are labelled using the RETIPROGRAM system, combined into one set \(\mathcal{D}\) and fed to the interpretable model training module to build a surrogate model to mimic the behaviour of the RETIPROGRAM locally on \(\mathcal{D}\). This model can be any simple model such as Linear Regression. However, as stated earlier, we consider two types of models in this work: a Decision Tree and Ordinal Decision Rules. To construct the desired explanation, we first extract all decision rules from the interpretable model in the following form: IF _condition\({}_{1}\)_ AND _condition\({}_{2}\)_...AND _condition\({}_{n}\)_ THEN _decision\({}_{k}\)_. In the case of the Ordinal Rules, we use DRSA and we obtain a minimal set of rules as output of the model training. In the case of the Decision Tree, we can derive such decision rules just following the conditions of each branch of the tree. In the case of decision trees, the selection criteria of the nodes during their construction ensures that the set of rules is small and that they use an small number of conditions. So in both cases, the generated models are much simpler than the original Fuzzy Random Forest (which has 100 trees, each one with several rules). In the last step, we extract the explanation from these small sets of decision rules in the form of a triplet \((r,\delta,\mathbb{C})\), where:  
* \(r\) is the decision rule(s) that covers the instance \(x\). This rule tells which are the necessary conditions to be satisfied by the object for being classified as \(y\), so they indicate the minimal reasons for belonging to that class. When using DRSA, we can have more than one applicable rule with different combinations of conditions. Figure 2: Architecture of the proposed explanation generation methodology. * \(\delta\) is the set of counterfactual rules that lead to an outcome different than the one of \(x\). They indicate the minimal number of conditions that should be simultaneously changed in the object for not being in class \(y\). * \(\mathbb{C}\) is a set of counterfactual instances that represent examples of objects that belong to a different class and have the minimum changes with respect to the original input object \(x\). The counterfactual rules extraction procedure is described in Algorithm 3. It looks for all rules leading to a decision different than \(y\) and it chooses the ones with the minimum number of conditions not satisfied by \(x\) (returned by the function \(nf\)).