On the Computation of Necessary and Sufficient ExplanationsOn the Computation of Necessary and Sufficient Explanations


Abstract

The complete reason behind a decision is a Boolean formula that characterizes why the decision was made. This recently introduced notion has a number of applications, which include generating explanations, detecting decision bias and evaluating counterfactual queries. Prime implicants of the complete reason are known as sufficient reasons for the decision and they correspond to what is known as PI explanations and abductive explanations. In this paper, we refer to the prime implicates of a complete reason as necessary reasons for the decision. We justify this terminology semantically and show that necessary reasons correspond to what is known as contrastive explanations. We also study the computation of complete reasons for multi-class decision trees and graphs with nominal and numeric features for which we derive efficient, closed-form complete reasons. We further investigate the computation of shortest necessary and sufficient reasons for a broad class of complete reasons, which include the derived closed forms and the complete reasons for Sentential Decision Diagrams (SDDs). We provide an algorithm which can enumerate their shortest necessary reasons in output polynomial time. Enumerating shortest sufficient reasons for this class of complete reasons is hard even for a single reason. For this problem, we provide an algorithm that appears to be quite efficient as we show empirically.

1 Introduction↩︎

Reasoning about the behavior of AI systems has been receiving significant attention recently, particularly the decisions made by machine learning classifiers. Some methods operate directly on classifiers, e.g., [1], [2] while others operator on symbolic encodings of their input-output behavior, e.g., [3], [4] which may be compiled into tractable circuits [5][10]. When explaining decisions, the notion of a sufficient reason has been well investigated. This is a minimal subset of an instance that is sufficient to trigger the decision and can therefore be used to explain why it was made. Sufficient reasons were introduced in [6] under the name of PI explanations and later referred to as abductive explanations [4].1 Two related notions we discuss later are contrastive explanations as formalized in [14] and counterfactual explanations as formalized in [9].2

[26] introduced the complete reason for a decision as a Boolean formula that characterizes why a decision was made, and showed how it can be used to gather insights about the decision. This includes generating explanations, determining decision bias and evaluating counterfactual queries. For example, it was shown that sufficient reasons correspond to the prime implicants of the complete reason. Hence, if one has access to the complete reason behind a decision, then one can abstract the computation of sufficient reasons away from the classifier and its encoding or compilation. Consider a classifier for admitting applicants to an academic program based five Boolean features [26]: passing the entrance exam (\(E\)), being a first time applicant (\(F\)), having good grades (\(G\)), having work experience (\(W\)) and coming from a rich hometown (\(R\)). The positive instances of this classifier are specified by the following Boolean formula: \(\Delta = (e \vee g)\wedge(e \vee r)\wedge(e \vee w)\wedge(f \vee r)\wedge({\bar{f}} \vee g \vee w).\) Luna (\(\delta\)) passed the entrance exam, has good grades and work experience, comes from a rich hometown but is not a first time applicant (\(\delta = e,{\bar{f}},g,r,w\)). The classifier will admit Luna. The complete reason for this decision is: \(\Gamma = (e\vee g)\wedge(e \vee w)\wedge(r)\wedge({\bar{f}}\vee g \vee w).\) There are four prime implicants of \(\Gamma\): \(\{e,g,r\}, \{e,r,w\}, \{e,{\bar{f}},r\}\) and \(\{g,r,w\}\). Each is a minimal subset of instance \(\delta\) which is sufficient to trigger the admit decision. Even though the number of sufficient reasons may be exponential, the complete reason can be compact and computed in linear time if the classifier is represented using a suitable form [26]. Further insights can be obtained about a decision by analyzing its complete reason. For example, the decision on Luna is biased as it would be different if she did not come from a rich hometown. In that case, she would be denied admission because she does not come from a rich hometown and is not a first time applicant as this would be the only sufficient reason for rejection. These conclusions can be derived by operating directly, and efficiently, on the complete reason as shown in [26].

More recently, [27] introduced the notion of universal literal quantification to Boolean logic and used it to formulate complete reasons. According to this formulation, we can obtain the above complete reason \(\Gamma\) by computing \(\forall e,{\bar{f}},g,r,w \cdot \Delta\), to be explained later. We will base our treatment on this formulation while operating in a discrete instead of a Boolean setting. The conclusion section in [27] proposed a generalization of universal literal quantification to discrete variables but without further discussion. We will adopt this definition, study it further and exploit it to derive efficient, closed-form complete reasons for multi-class decision trees and graphs with nominal (discrete) and numeric (continuous) features. We will show that the obtained complete reasons belong to a particular logical form that arise when explaining the decisions of a broader class of classifiers. We will further show that the prime implicates of complete reasons correspond to contrastive explanations, which will provide further insights into the semantics and utility of these explanations. We will refer to these prime implicates as necessary reasons for the decision and semantically justify this terminology. We will then propose an output polynomial algorithm for computing the shortest necessary reasons of the identified class of complete reasons. We will finally show that computing shortest sufficient reasons is hard for this class of complete reasons and propose an algorithm for computing them which appears to be quite efficient based on an empirical evaluation. Proofs of all results can be found in the appendix.

2 Syntax and Semantics of Discrete Formulas↩︎

We start by defining the syntax and semantics of discrete formulas which we use to capture classifiers with discrete features. The treatment in this section is largely classical and provides obvious generalizations of what is known on Boolean logic. But we spell it out so we can provide a formal treatment of our upcoming results, especially that we sometimes depart from what may be customary.

For a discrete variable \(X\) with values \(x_1, \ldots, x_n\), we will call \({X}\!=\!{x}_i\) a state for variable \(X\). A discrete formula is defined over a set of discrete variables as follows. Every state or constant (\(\top\), \(\bot\)) is a discrete formula. If \(\alpha\) and \(\beta\) are discrete formulas, then \(\neg \alpha\), \(\alpha \vee \beta\) and \(\alpha \wedge \beta\) are discrete formulas. A positive literal is a state \({X}\!=\!{x}_i\) typically denoted by \(x_i\). A negative literal is a negated state \(\neg ({X}\!=\!{x}_i),\) typically denoted by \({\bar{x}}_i\). A negative literal will also be called a state if the variable has only two values. A clause is a disjunction of literals with at most one literal per variable. A term is a conjunction of literals with at most one literal per variable.

A CNF is a conjunction of clauses. A DNF is a disjunction of terms. An NNF is defined as follows. Constants and literals are NNFs. If \(\alpha\) and \(\beta\) are NNFs, then \(\alpha \vee \beta\) and \(\alpha \wedge \beta\) are NNFs (hence, conjunctions and disjunctions cannot be negated). An NNF is \(\vee\)-decomposable iff for each disjunction \(\bigvee_i \alpha_i\) in the NNF, the disjuncts \(\alpha_i\) do not share variables. An NNF is \(\wedge\)-decomposable iff for each conjunction \(\bigwedge_i \alpha_i\) in the NNF, the conjuncts \(\alpha_i\) do not share variables. An NNF is positive iff it contains only positive literals. Any NNF can be made positive by replacing negative literals \({\bar{x}}_i\) with \(\bigvee_{j \neq i} x_j\). An NNF is monotone iff it is positive and does not contain distinct states \(x_i\) and \(x_j\) for any variable \(X\).

A positive term contains only positive literals (i.e., states). The conditioning of discrete formula \(\Delta\) on positive term \(\gamma\) is denoted \(\Delta {|}\gamma\) and obtained as follows. For each state \(x_i \in \gamma\), replace the occurrences of \(x_i\) with \(\top\) and the occurrences of \(x_j\), \(j \neq i\), with \(\bot\). The formula \(\Delta {|}x_i\) does not mention variable \(X\). An instance is a positive term which contains precisely one state for each variable. If we condition a discrete formula on an instance, we get a Boolean formula that does not mention any variables (evaluates to true or false).

The semantics of discrete formulas is symmetric to the semantics of Boolean formulas, except that the notion of a world (truth assignment) is now defined as a function that maps each discrete variable to one of its states (a world corresponds to an instance). A world \({\omega}\) satisfies a discrete formula \(\alpha\), written \({\omega}\models \alpha\), precisely when \(\alpha {|}{\omega}\) evaluates to true. In this case, we say that world \({\omega}\) is a model of formula \(\alpha\). Notions such as satisfiability, validity, implication and equivalence can now be defined for discrete formulas as in Boolean logic. For example, formula \(\alpha\) implies formula \(\beta\), written \(\alpha \models \beta\), iff every model of \(\alpha\) is a model of \(\beta\). We next define the notions of implicants and implicates. An implicant of a discrete formula \(\Delta\) is a term \(\delta\) such that \(\delta \models \Delta\). The implicant is prime iff no other implicant \(\delta^\star\) is such that \(\delta^\star \subset \delta\). An implicate is a clause \(\delta\) such that \(\Delta \models \delta\). The implicate is prime iff no other implicate \(\delta^\star\) is such that \(\delta^\star \subset \delta\).

Our treatment will represent a classifier with discrete features and multiple classes \(c_1, \ldots, c_n\) by a set of mutually exclusive and exhaustive discrete formulas \(\Delta^1, \ldots, \Delta^n\), where the models of formula \(\Delta^i\) capture the instances in class \(c_i\). That is, instance \(\delta\) is in class \(c_i\) iff \(\delta \models \Delta^i\). We refer to each \(\Delta^i\) as a class formula. When \(\delta \models \Delta^i\), we say that instance \(\delta\) is decided positively by \(\Delta^i\). The complete reason for this decision will then be the formula \(\forall \delta \cdot \Delta^i\). The next section will explain what \(\forall \delta\) is and how to compute it efficiently. In the upcoming discussion, we may use the engineering notation for Boolean operators when convenient, writing \(x_1y_2 + x_2 z_3\), for example, instead of \((x_1 \wedge y_2) \vee (x_2 \wedge z_3)\).

3 Quantifying States of Discrete Variables↩︎

[27] introduced universal literal quantification for Boolean logic and suggested the following generalization to discrete variables without further study.

Definition 1. For formula \(\Delta\) and variable \(X\) with states \(x_1, \ldots, x_n\), the universal quantification of state \(x_i\) from \(\Delta\) is defined as follows: \(\forall x_i \cdot \Delta = (\Delta {|}x_i) \wedge \bigwedge_{j\neq i} (x_i \vee \Delta {|}x_j)\).

Quantification is commutative so we can equivalently write \(\forall x \cdot (\forall y \cdot \Delta)\), \(\forall y \cdot (\forall x \cdot \Delta)\) or \(\forall \{x,y\} \cdot \Delta\). We will study Definition 1 and exploit it for computing complete reasons.

Definition 2. If instance \(\delta\) is decided positively by class formula \(\Delta\), then \(\forall \delta \cdot \Delta\) is the ‘complete reason’ for the decision.

The next three results parallel Boolean ones in [27]. They are followed by two novel results.

Proposition 1. We have \(\forall x_i \cdot \top = \top\) and \(\forall x_i \cdot \bot = \bot\); \(\forall x_i \cdot x_i = x_i\) and \(\forall x_i \cdot {\bar{x}}_i = \bot\); \(\forall x_i \cdot x_j = \bot\) and \(\forall x_i \cdot {\bar{x}}_j = x_i\) when \(j \neq i\); \(\forall x_i \cdot y_j = y_j\) and \(\forall x_i \cdot {\bar{y}}_j = {\bar{y}}_j\) when \(X \neq Y\).

The next result shows when \(\forall x_i\) can be distributed.

Proposition 2. For discrete formulas \(\alpha\), \(\beta\) and state \(x_i\) of variable \(X\), we have \(\forall x_i \cdot (\alpha \wedge \beta) = (\forall x_i \cdot \alpha) \wedge (\forall x_i \cdot \beta)\). Moreover, if variable \(X\) does not occur in both \(\alpha\) and \(\beta\), then \(\forall x_i \cdot (\alpha \vee \beta) = (\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \beta)\).

Given Propositions 1 and 2, we can universally quantify states out of \(\vee\)-decomposable NNFs in linear time while preserving \(\vee\)-decomposability in the resulting NNF.

Proposition 3. Let \(\Delta\) be a \(\vee\)-decomposable NNF and \(\gamma\) be a set of states. Then \(\forall \gamma \cdot \Delta\) can be obtained from \(\Delta\) as follows. For each state \(x_i \in \gamma\), replace the occurrences of literals \({\bar{x}}_i\), \(x_j\) and \({\bar{x}}_j\), \(j \neq i\), in \(\Delta\) with \(\bot\), \(\bot\) and \(x_i\), respectively.

Consider the class formula \(\Delta = {\bar{x}}_1(x_2+{\bar{y}}_1)({\bar{y}}_1+z_1)\) over ternary variables \(X\), \(Y\), \(Z\) and instance \(\delta = x_2, y_2, z_1\) which is decided positively by \(\Delta\). The complete reason for this decision is \(\forall \delta \cdot \Delta\). Since \(\Delta\) is \(\vee\)-decomposable, Proposition 3 gives \(\forall x_2, y_2, z_1 \cdot \Delta = (x_2)(x_2+y_2)(y_2+z_1) = x_2(y_2+z_1).\) Hence, this instance was decided positively because it has characteristic \(x_2\) and one of the characteristics \(y_2\) and \(z_1\).

We next identify conditions that allow the distribution of \(\forall x_i\) over disjuncts that share variables.

Proposition 4. Consider positive NNFs \(\alpha,\) \(\beta\) and state \(x_i\) of variable \(X\). If \(x_i\) does not occur in \(\alpha, \beta\), or \(x_j\) does not occur in \(\alpha, \beta\) for all \(j \neq i\), then \(\forall x_i \cdot (\alpha \vee \beta) = (\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \beta)\).

For a Boolean variable \(X\) with states \(x\) and \({\bar{x}}\), Proposition 4 says that we can distribute \(\forall x\) over disjuncts \(\alpha\) and \(\beta\) even if they mention literal \({\bar{x}}\) (but do not mention \(x\)). This is a novel result compared to [27].

Next is another novel condition that licenses the distribution of \(\forall x_i\) over disjuncts, which we use to derive closed forms for the complete reasons of decision trees and graphs.

Proposition 5. Let \(\alpha\) be an NNF, \(S\) be a set of states for variable \(X\) and \(\beta = \bigvee_{x_k \in S} x_k\). If variable \(X\) occurs in \(\alpha\) only in disjunctions of the form \(\bigvee_{x_k \in S'} x_k\) where \(S' \supseteq S\) are states of variable \(X\), then \(\forall x_i \cdot (\alpha \vee \beta) = (\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \beta)\).

Consider variables \(X\) (\(x_1, \ldots, x_4\)) and \(Y\) (\(y_1, y_2\)) and the formulas \(\alpha = y_1 (x_1 + x_2 + x_4)\) and \(\beta = x_1 + x_2\). We can invoke Proposition [prop:wtop] to distribute \(\forall x_1\) using \(S = \{x_1,x_2\}\) and \(S' = \{x_1,x_2,x_4\}\). Hence, \(\forall x_1 \cdot (\alpha \vee \beta) = \forall x_1 \cdot (y_1 (x_1 + x_2 + x_4)) \vee \forall x_1 \cdot (x_1 + x_2) = y_1 x_1 + x_1 = x_1\). Propositions 2 and 4 do not license this distribution of \(\forall x_i\) though.

4 The Complete Reasons for Decision Graphs↩︎

Figure 1: A classifier in the form of a decision graph.

We next provide closed forms for the complete reasons of decision graphs, which subsume decision trees, in the form of monotone, \(\vee\)-decomposable NNFs. This will later facilitate the computation of their prime implicants and implicates (sufficient and necessary reasons). We first treat multi-class decision graphs with nominal features and then treat decision graphs with numeric features; see Figures [fig:admissions-dg] and 3.

Each leaf node in a decision graph is labeled with some class \(c\). Moreover, each internal node \(T\) in the graph has outgoing edges \(\xrightarrow[]{ X,\:S_1}\!T_1, \ldots, \xrightarrow[]{ X,\:S_n}\!T_n\), \(n \geq 2\). We say in this case that node \(T\) tests variable \(X\). The children of node \(T\) are \(T_1, \ldots, T_n\) and \(S_1, \ldots, S_n\) is a partition of some states of variable \(X\). A decision graph will be represented by its root node. Hence, each node in the graph represents a smaller decision graph. We allow variables to be tested more than once on a path from the root to a leaf but under the following condition, which we call the weak test-once property. Consider path \(\ldots, T\xrightarrow[]{ X,\:S_j}\!T_j, \ldots, T'\xrightarrow[]{ X,\:R_k}\!T_k, \ldots\) from the root to leaf and suppose that nodes \(T\) and \(T'\) test variable \(X\). If no nodes between \(T\) and \(T'\) on the path test variable \(X\), then \(\{R_k\}_k\) must be a partition of states \(S_j\). Moreover, if \(T\) is the first node that tests \(X\) on the path, then \(\{S_j\}_j\) must be a partition of all states for \(X\). For binary variables, the weak test-once property reduces to the standard test-once property: A variable can be tested at most once on any path from the root to a leaf. The weak test-once property is critical for treating numeric features. As we show later, one can easily discretize continuous variables based on the thresholds used at decision nodes, which leads to decision graphs that satisfy the weaker test-once property but not the standard one.

A decision graph classifies an instance \(\delta\) as follows. Suppose \(\delta[X]\) is the state of variable \(X\) in instance \(\delta\). We start at the graph root and repeat the following. When we are at node \(T\) that has outgoing edges \(\xrightarrow[]{ X,\:S_1}\!T_1, \ldots, \xrightarrow[]{ X,\:S_n}\!T_n\), we follow the (unique) edge \(\xrightarrow[]{ X,\:S_i}\!T_i\) which satisfies \(\delta[X] \in S_i\). This process leads us to a unique leaf node. The label \(c\) of this leaf node is then the class assigned to instance \(\delta\) by the decision graph (that is, instance \(\delta\) belongs to class \(c\)).

We next provide a closed-form NNF that captures the instances belonging to some class \(c\) in a decision graph.

Definition 3. The NNF for a decision graph \(T\) and class \(c\) is denoted \(\Delta^c[T]\) and defined inductively as follows: \[\Delta^c[T] = \left\{ \begin{array}{ll} \top & if \(T\) has class \(c\) \\ \bot & if \(T\) has class \(c' \neq c\) \\ \bigwedge_j (\Delta^c[T_j] \vee \bigvee_{x_i \not \in S_j} x_i) & if \(T\) has edges \(\xrightarrow[]{ X,\:S_j}\!T_j\) \end{array} \right. \label{eq:dt-nnf}\qquad{(1)}\]

Proposition 6. For decision graph \(T\), class \(c\) and instance \(\delta\), we have \(\delta \models \Delta^c[T]\) iff \(T\) assigns class \(c\) to instance \(\delta\).

This NNF is positive and can be constructed in linear time but is not \(\vee\)-decomposable: The disjuncts in \(\bigvee_{x_j \not \in S_i} x_j\) share variables and variable \(X\) will appear in \(\Delta^c[T_j]\) if tested again in graph \(T_j\). Yet, this NNF is tractable for universal quantification as revealed in the proof of the next result, which provides closed-form complete reasons for decision graphs.

Proposition 7. Let \(T\) be a decision graph, \(\delta\) be an instance in class \(c\) and \(\delta[X]\) be the state of variable \(X\) in instance \(\delta\). The complete reason \(\forall \delta \cdot \Delta^c[T]\) is given by the NNF: \[\Gamma^c[T] = \left\{ \begin{array}{ll} \top & if \(T\) has class \(c\) \\ \bot & if \(T\) has class \(c' \neq c\) \\ \bigwedge_{j} (\Gamma^c[T_j] \vee {\ell}_j) & if \(T\) has edges \(\xrightarrow[]{ X,\:S_j}\!T_j\) \end{array} \right. \label{eq:cr-cf}\qquad{(2)}\] where \({\ell}_j = \delta[X]\) if \(\delta[X] \in S_k\) for some \(k \neq j\), else \({\ell}_j = \bot\).

Figure 2: A complete reason constructed by Proposition 7 for the decision graph in Figure [fig:admissions-dg] and instance SAT <1450, GPA=medium, Essay=fail, Interview=fail. This complete reason is in the form of a monotone, \vee-decomposable NNF.

Consider the decision graph in Figure [fig:admissions-dg] and an applicant who scored \(< 1450\) on the SAT, had a medium GPA and did not pass their essay or interview. This applicant is rejected by the classifier and the complete reason for the decision, as constructed by Proposition 7, is shown in Figure [fig:admissions-cr].

Proposition 8. Let \(T\) be a decision graph and \(\delta\) be an instance in class \(c\). The complete reason \(\forall \delta \cdot \Delta^c[T]\) in Equation ?? is an NNF that is monotone and \(\vee\)-decomposable.

Even though we are working with decision graphs that include discrete variables and multiple classes, we get complete reasons in the form of monotone NNFs, which are effectively Boolean NNFs. This will simplify the computation of necessary and sufficient reasons in later sections, as it allows us to avoid certain complications that can arise when binarizing discrete variables; see, e.g., [28].

4.1 Numeric Features↩︎

a

b

Figure 3: A decision tree with continuous variables learned using weka (left)and its discretization (right)..

Suppose we have a continuous variable \(X\) that is being tested at node \(T\) in a decision graph. The test will have the form \(X \leq t_i\), where \(t_i\) is a threshold in \((-\infty,\infty)\). Node \(T\) will then have two outgoing edges, one is followed when \(X \leq t_i\) (high edge) and the other is followed when \(X > t_i\) (low edge); see Figure 3. Suppose now that \(t_1, \ldots, t_n\) is the set of all thresholds for variable \(X\) in the decision graph and assume that these thresholds are in increasing order. We can then treat variable \(X\) as a discrete variable with the following \(n+1\) states: \((-\infty,t_1], (t_1,t_2], \ldots, (t_{n-1},t_n], (t_n,\infty)\). If variable \(X\) is being tested first at node \(T\), we label the high edge of node \(T\) with states \((-\infty,t_1], (t_1,t_2], \ldots, (t_{i-1},t_i]\) and its low edge with states \((t_i,t_{i+1}], \ldots, (t_{n-1},t_n], (t_n,\infty)\). Consider Figure 3 (left). Variable “petalwidth" (\(W\)) has three thresholds \(0.6, 1.5, 1.7\), leading to four discrete states \(S_W = (-\infty, 0.6]\), \((0.6, 1.5]\), \((1.5, 1.7]\), \((1.7,\infty)\). Variable”petallength” (\(L\)) has one threshold \(4.9\), leading to two discrete states \(S_L = (-\infty, 4.9]\), \((4.9, \infty)\). Variable \(W\) is tested three times in the decision tree. The first test (\(W \leq 0.6\)) splits states \(S_W\) into \(S_1 = (-\infty, 0.6]\) for the high edge and \(S_2 = (0.6, 1.5], (1.5, 1.7], (1.7,\infty)\) for the low edge. The second test (\(W \leq 1.7\)) splits \(S_2\) into \(S_{21} = (0.6, 1.5], (1.5, 1.7]\) for the high edge and \(S_{22} = (1.7,\infty)\) for the low edge. The third and final test (\(W \leq 1.5\)) splits states \(S_{21}\) into \((0.6, 1.5]\) and \((1.5, 1.7]\). The resulting decision tree with discrete variables does not satisfy the test-once property but does satisfy the weak test-once property as shown in Figure 3 (right).

Consider now instance \(\delta_1: W = 0.8, L = 5.3\) which is classified as “Iris-virginica” by the decision tree with continuous variables (\(T_1\)). We can view this instance as the discrete instance \(\delta_2: W = (0.6,1.5], L = (4.9,\infty)\) since \(0.8 \in (0.6,1.5]\) and \(5.3 \in (4.9,\infty)\). The decision tree with discrete variables (\(T_2\)) will also classify instance \(\delta_2\) as “Iris-virginica.” A continuous instance and its corresponding discrete instance will be classified identically by decision trees \(T_1\) and \(T_2\) because \(T_1\) cannot discriminate continuous values that belong to the same interval. Finally, to generate the complete reason for instance \(\delta_1\), we compute \(\forall \delta_2 \cdot \Delta^c[T_2]\) using Proposition 7 where \(c\) is class “Iris-virginica.”

4.2 Further Extensions↩︎

The closed-form complete reason in Proposition 7 applies directly to Free Binary Decision Diagrams (FBDDs) [29] and Ordered Binary Decision Diagrams (OBDDs) [30] as they are special cases of decision graphs. FBDDs use binary variables and binary classes (\(\top\) and \(\bot\)). OBDDs are a subset of FBDDs which test variables in the same order along any path from the root to a leaf. We can similarly obtain closed forms for the complete reasons of Sentential Decision Diagrams (SDDs) [31], which test on formulas (sentences) instead of variables. This is possible since given an SDD for \(\Delta\) we can obtain an SDD for \(\neg \Delta\) in linear time. An SDD \(\Delta\) is an \(\wedge\)-decomposable NNF that represents instances for class \(\top\). The SDD for \(\neg \Delta\) is also an \(\wedge\)-decomposable NNF but represents instances for class \(\bot\). If we negate \(\Delta\) and \(\neg \Delta\) using deMorgan’s law, we obtain \(\vee\)-decomposable NNFs for classes \(\bot\) and \(\top\), respectively. This allows us to obtain a closed-form, monotone, \(\vee\)-decomposable complete reason for any instance using universal quantification. [27] showed that an SDD can be universally quantified in linear time. Earlier, [26] showed that Decision-DNNFs [32] can be universally quantified in linear time as well.3 Decision-DNNFs cannot be negated efficiently so they do not permit closed-form complete reasons unless we have Decision-DNNFs for classes \(\top\) and \(\bot\). While decision tree classifiers are normally learned from data, classifiers such as OBDDs and SDDs are compiled from other classifiers like Bayesian/neural networks and random forests; see, e.g., [7], [8], [28]. The relative succinctness of these representations of classifiers has been well studied. FBDDs are a subset of Decision-DNNFs and there is a quasipolynomial simulation of Decision-DNNFs by equivalent FBDDs [33]. SDDs and FBDDs are not comparable [34], [35] so SDDs and Decision-DNNFs are not comparable either. SDDs are exponentially more succinct than OBDDs [36].

5 Necessary and Sufficient Reasons↩︎

As mentioned earlier, the prime implicants of a complete reason can be interpreted as sufficient reasons for the decision.

We next show that the prime implicates of a complete reason can be interpreted as necessary reasons for the decision and correspond to contrastive explanations [14]. We first provide further insights into complete reasons which will help in justifying this interpretation.

Definition 4. Instances \(\delta_1\) and \(\delta_2\) are ‘congruent’ iff \(\delta_1 \cap \delta_2 \models \Delta\) for some class formula \(\Delta\). We also say in this case that the decisions on instances \(\delta_1\) and \(\delta_2\) are congruent.

If instances \(\delta_1\) and \(\delta_2\) are congruent, they must belong to the same class since \(\delta_1 \models \Delta\) and \(\delta_2 \models \Delta\) so they are decided similarly. Moreover, their common characteristics \(\delta_1\cap\delta_2\) are sufficient to justify the decision. That is, the decisions on them are equal and have a common justification.

Proposition 9. Let \(\forall \delta \cdot \Delta\) be the complete reason for the decision on instance \(\delta\). Then instance \(\delta^\star\) is congruent to instance \(\delta\) iff \(\delta^\star \models \forall \delta \cdot \Delta\).

Hence, the complete reason \(\forall \delta \cdot \Delta\) captures all, and only, instances that are congruent to instance \(\delta\). The complete reason does not capture all instances that are decided similarly to \(\delta\) since some of these instances may be decided that way for a different reason (the decisions are not congruent).

Consider the class formula \(\Delta = {\bar{x}}_1(x_2+{\bar{y}}_1)({\bar{y}}_1+z_1)\) over ternary variables \(X\), \(Y\) and \(Z\). The instance \(\delta = x_2 y_2 z_1\) is decided positively by this formula (\(\delta \models \Delta\)) and the complete reason for this decision is \(\forall x_2, y_2, z_1 \cdot \Delta = x_2(y_2+z_1)\). There are four other instances that satisfy this complete reason, \(x_2 y_2 z_2\), \(x_2 y_2 z_3\), \(x_2 y_1 z_1\) and \(x_2 y_3 z_1\). All are decided positively by \(\Delta\) and the states each share with instance \(\delta\) justify the decision. Instance \(x_3 y_2 z_1\) is also decided positively by \(\Delta\) but for a different reason: the states \(y_2 z_1\) it shares with instance \(\delta\) do not justify the decision, \(y_2 z_1 \not \models \Delta\). Hence, this instance is not captured by the complete reason for \(\delta\).

5.1 Implicants and Implicates as Reasons↩︎

We next review the interpretation of prime implicants as sufficient reasons and discuss the interpretation of prime implicates as necessary reasons for a decision. We will represent these notions by sets of literals, which are interpreted as conjunctions for prime implicants (terms) and as disjunctions for prime implicates (clauses).

Proposition 10. The prime implicants and prime implicates of a complete reason \(\forall \delta \cdot \Delta\) are subsets of instance \(\delta\).

A prime implicant \(\sigma\) of the complete reason \(\forall \delta \cdot \Delta\) can be viewed as a sufficient reason for the underlying decision as it is a minimal subset of instance \(\delta\) that is guaranteed to sustain the decision, congruently. If we change any part of the instance but for \(\sigma\), the decision will stick and for a common reason since the new and old instances are congruent. Consider the complete reason in Figure [fig:admissions-cr] which corresponds to a reject decision on the instance SAT \(<1450\), GPA=medium, Essay=fail, Interview=fail. There are two prime implicants for this complete reason: \(\{\text{SAT~<1450, GPA=medium, Interview=fail}\}\) and \(\{\text{Essay=fail, Interview=fail}\}\). Each of these prime implicants is a minimal subset of the instance that is sufficient to trigger the reject decision.

A prime implicate \(\sigma\) of the complete reason \(\forall \delta \cdot \Delta\) can be viewed as a necessary reason for the underlying decision as it is a minimal subset of the instance that is essential for sustaining a congruent decision. If we change all states in \(\sigma\), the decision on the new instance will be different or will be made for a different reason since the new and old instances will not be congruent (we provide a stronger semantics later). Consider again the complete reason in Figure [fig:admissions-cr] and the corresponding instance and reject decision. There are three prime implicates for this complete reason: \(\{\text{Interview=fail}\}\), \(\{\text{SAT~<1450, Essay=fail}\}\) and \(\{\text{GPA=medium, Essay=fail}\}\). Changing Interview to pass will change the decision. Changing SAT to \(\geq 1450\) and Essay to pass will also change the decision. Since GPA is a ternary variable, there are two ways to change its value. If we change GPA and Essay to high and pass, respectively, the decision will change. But if we change these features to low and pass, respectively, the decision will not change but the new instance (SAT \(<1450\), GPA=low, Essay=pass, Interview=fail) will not be congruent with the original instance (SAT \(<1450\), GPA=medium, Essay=fail, Interview=fail). That is, the common characteristics of these instances \(\{\text{SAT~<1450, Interview=fail}\}\) cannot on their own justify the reject decision.

For yet another example, consider again class formula \(\Delta = {\bar{x}}_1(x_2+{\bar{y}}_1)({\bar{y}}_1+z_1)\) over ternary variables \(X\), \(Y\) and \(Z\). The complete reason for positive instance \(\delta = x_2 y_2 z_1\) is \(\Gamma = \forall \delta \cdot \Delta = x_2(y_2+z_1)\). The prime implicants of \(\Gamma\) are \(x_2 y_2\) and \(x_2 z_1\), which are the sufficient reasons for the decision. If we change instance \(\delta\) while keeping one of these reasons intact, the decision sticks. The prime implicates of \(\Gamma\) are \(x_2\) and \(y_2+z_1\), which are the necessary reasons for the decision. If we violate one of these reasons, the decision will be different or made for a different reason. Changing instance \(\delta\) to \(x_2 y_1 z_3\) violates the necessary reason \(y_2+z_1\), which leads to a negative decision. Changing the instance to \(\delta^\star = x_3 y_2 z_1\) violates the necessary reason \(x_2\). The decision remains positive though but for a different reason than why \(\delta\) is positive. That is, the common characteristics \(\delta \cap \delta^\star = y_2 z_1\) do not justify the decision on these instances, \(y_2 z_1 \not \models \Delta\).

5.2 More on Necessity↩︎

We next show that necessary reasons correspond to basic contrastive explanations as formalized in [14] using the following definition (modulo notation).

Definition 5. Let \(\delta\) be an instance decided positively by class formula \(\Delta\). A ‘contrastive explanation’ of this decision is a minimal subset \(\gamma\) of instance \(\delta\) such that \(\delta \setminus \gamma \not \models \Delta\).

That is, it is possible to change the decision on instance \(\delta\) by only changing the states in \(\gamma\). Moreover, we must change all states in \(\gamma\) for the decision to change.

Proposition 11. Let \(\delta\) be an instance decided positively by class formula \(\Delta\). Then \(\gamma\) is a prime implicate of the complete reason \(\forall \delta \cdot \Delta\) iff \(\gamma\) is a contrastive explanation.

This correspondence is perhaps not too surprising given the duality between abductive and contrastive explanations [14] and the classical duality between prime implicants and prime implicates. However, it does provide further insights into contrastive explanations: changing the states of a contrastive explanation leads to a non-congruent decision. It also provides further insights on the necessity of prime implicates: while violating a necessary reason will only lead to an instance that is not congruent (decided differently or for a different reason), there must exist at least one violation of each necessary reason which is guaranteed to change the decision. This follows directly from Definition 5. If the variables of a necessary reason are all binary, there is only one way to violate the reason (by negating each variable in the reason). In this case, violating the necessary reason is guaranteed to change the decision.

For an example, let us revisit the complete reason in Figure [fig:admissions-cr] and the corresponding instance and reject decision. This decision has three necessary reasons: \(\{\text{Interview=fail}\}\), \(\{\text{SAT~<1450, Essay=fail}\}\) and \(\{\text{GPA=medium, Essay=fail}\}\). There is only one way to violate each of the first two reasons, and each violation leads to reversing the decision as we saw earlier. There are two ways to violate the third necessary reason. One of these violations (GPA=high, Essay=pass) reverses the decision but the other violation (GPA=low, Essay=pass) keeps the reject decision intact (but for a different reason).

In summary, a necessary reason (contrastive explanation) identifies a minimal subset of the instance which is guaranteed to change the decision if that subset is altered properly. The minimality condition ensures that we must alter every variable in a necessary reason to change the decision, but it does not specify how to alter it (except for binary variables). We will revisit this distinction when we discuss counterfactual explanations [9].

5.3 Targeting a Particular Class↩︎

Figure 4: (a) decision tree (b) complete reason for “why x_2 y_1 is c_2” (c) complete reason for “why x_2 y_1 is not c_3.”

Beyond basic contrastive explanations, [14] discussed targeted contrastive explanations which aim to change the instance class from \(c\) to some class \(c^\star\); see [18], [21]. This notion is particularly relevant to multi-class classifiers as it reduces to basic contrastive explanations when the classifier has only two classes. Targeted contrastive explanations can be obtained using the complete reason for why the instance was classified as not \(c^\star\) (that is, a class other than \(c^\star\)). This complete reason can be obtained using a slight modification of Equation ?? where we modify the first two conditions as follows: \[\Gamma^c[T] = \left\{ \begin{array}{ll} \top & if \(T\) has class \(c' \neq c^\star\) \\ \bot & if \(T\) has class \(c^\star\) \\ \bigwedge_{j} (\Gamma^c[T_j] \vee {\ell}_j) & if \(T\) has edges \(\xrightarrow[]{ X,\:S_j}\!T_j\) \end{array} \right. \label{eq:cr-cf-target}\tag{1}\] The prime implicates for this complete reason (i.e., necessary reasons) will then identify minimal subsets of the instance that lead to the targeted class \(c^\star,\) if altered properly.

Consider the decision tree in Figure [fig:target](a) which has two binary features \(X\) and \(Y\) and three classes \(c_1, c_2, c_3.\) The instance \(x_2 y_1\) is classified as \(c_2\). The complete reason for this decision, as computed by Equation ?? , is shown in Figure [fig:target](b) and has two necessary reasons \(x_2\) and \(y_1\). If we violate the first necessary reason (\(x_2 \rightarrow x_1\)), the class changes to \(c_1\). If we violate the second necessary reason (\(y_1 \rightarrow y_2\)), the class changes to \(c_3\). Suppose now we wish to change the class \(c_2\) of this instance particularly to \(c_3\). The complete reason for “why not \(c_3\),” as computed by Equation 1 , is shown in Figure [fig:target](c) and has only one necessary reason, \(y_1\). Violating this necessary reason is guaranteed to change the class to \(c_3\).

[9] discussed the complexity of computing the related notion of counterfactual explanations which are defined as follows. Given an instance \(\delta\) in class \(c\), find an instance \(\delta^\star\) in a different class \(c^\star\) that is as close as possible to instance \(\delta\) with respect to the hamming distance. In other words, instance \(\delta^\star\) must maximize the number of characteristics it shares with instance \(\delta\). Consider now the characteristics \(\gamma\) of instance \(\delta\) that do not appear in instance \(\delta^\star\) (\(\gamma=\delta\setminus\delta^\star\)). Changing these characteristics to \(\gamma^\star = \delta^\star\setminus\delta\) will change the class from \(c\) to \(c^\star\). Hence, characteristics \(\gamma\) are a length-minimal subset of instance \(\delta\) which, if changed properly, will guarantee a change from class \(c\) to class \(c^\star\). Every characteristic of \(\gamma\) must be changed to ensure this class change, otherwise \(\delta^\star\) would not be a counterfactual explanation. Moreover, when the features are binary, there is only one way to change the characteristics \(\gamma\) so the class will change from \(c\) to \(c^\star\); that is, by flipping every characteristic in \(\gamma\) to yield \(\gamma^\star\). In this case, counterfactual explanations are in one-to-one correspondence with the shortest necessary reasons which we discuss next.

6 Computing Shortest Explanations↩︎

A complete reason may have too many prime implicants and implicates. We will therefore provide algorithms for computing the shortest implicants and implicates (which must be prime) for monotone, \(\vee\)-decomposable NNFs. As discussed earlier, we can in linear time obtain complete reasons in this form for decision graphs and SDDs, which include FBDDs, OBDDs and decision trees as special cases.

Figure 5: Shortest Necessary Reasons (SNRs)
Figure 6: Shortest Sufficient Reasons (SSRs)

Shortest Necessary Reasons. This will be an output polynomial algorithm that is based on three (conceptual) passes on the complete reason which we describe next.

Definition 6. The ‘implicate minimum length (iml)’ of a valid formula is \(\infty\). For non-valid formulas, it is the minimum length attained by any implicate of the formula.

The first pass computes the implicate minimum length.

Proposition 12. The imlof a monotone, \(\vee\)-decomposable NNF is computed as follows: \(\mathrm{\small iml}(\top) = \infty\), \(\mathrm{\small iml}(\bot) = 0\), \(\mathrm{\small iml}(x_i) = 1\), \(\mathrm{\small iml}(\alpha \vee \beta) = \mathrm{\small iml}(\alpha) + \mathrm{\small iml}(\beta)\) and \(\mathrm{\small iml}(\alpha \wedge \beta) = \min(\mathrm{\small iml}(\alpha),\mathrm{\small iml}(\beta))\).

The second pass prunes the NNF using the imlof nodes.

Proposition 13. Let \(\mathrm{\small prune}(\Delta)\) be the NNF obtained from monotone, \(\vee\)-decomposable NNF \(\Delta\) by dropping \(\alpha_i\) from conjunctions \(\alpha = \alpha_1 \wedge \ldots \wedge \alpha_n\) if \(\mathrm{\small iml}(\alpha_i) > \mathrm{\small iml}(\alpha)\). Then \(\mathrm{\small prune}(\Delta)\) is a monotone, \(\vee\)-decomposable NNF and its prime implicates are the shortest implicates of \(\Delta\).

The third pass computes the prime implicates of NNF \(\mathrm{\small prune}(\Delta)\) in output polynomial time. Algorithm [alg:snr] implements the second and third passes assuming the first, linear-time pass has been performed. It represents an implicate by a set of literals and uses the Cartesian product operation on sets of implicates: \(S_1 \times S_2 = \{\sigma_1 \cup \sigma_2 \mid \sigma_1 \in S_1, \sigma_2 \in S_2\}\). Algorithm [alg:snr] applies the second pass implicitly by excluding conjuncts on Line [snr:ln:and]. This is the standard procedure for computing the prime implicates of a monotone NNF, but with no subsumption checking which is critical for its complexity. In the standard procedure, one must ensure that the implicates computed on Lines 5 and [snr:ln:and] are reduced: no implicate \(\sigma_1\) subsumes another \(\sigma_2\) (\(\sigma_1 \subseteq \sigma_2\)).4

Since NNF \(\mathrm{\small prune}(\Delta)\) is \(\vee\)-decomposable, the disjuncts \(\alpha_1, \ldots, \alpha_n\) on Line 5 do not share variables. Hence, if every \(\Call{snr}{\alpha_i}\) is reduced, their Cartesian product is reduced. Moreover, due to pruning in the second pass, the implicates \(\Call{snr}{\alpha_i}\) computed on Line [snr:ln:and] all have the same length so no subsumption is possible.

Table 1: Evaluating Algorithms [alg:snr][alg:ssr]. Times in secs. First ten entries are decision trees. Last five entries are decision graphs.
benchmark decision tree/graph properties
1-2 (lr)3-8 (lr)9-10 (lr)11-12 (lr)13-14 (lr)15-16 name examples nodes num nom classes card acc count time count time count time count time
adult 48842 726 6 7 2 24 86.0 2.8 0.0005 1.4 0.0007 5.6 0.0004 2.9 0.0003
compas 5278 55 5 3 2 8 71.2 1.7 0.0002 1.1 0.0003 2.9 0.0002 1.8 0.0001
fash-mnist 70000 6681 734 0 10 29 80.8 1851.6 3.7925\(^{\mathbf{657}}\) 7.5 0.0348\(^{\mathbf{8}}\) 104.8 0.0123 12.4 0.0008
gisette 7000 231 111 0 2 3 93.9 3288.4 6.2361\(^{\mathbf{486}}\) 95.5 0.0545 31.8 0.0013 7.4 0.0004
isolet 7797 645 201 0 26 7 83.9 8.9 0.0008 1.5 0.0026 17.7 0.0006 10.1 0.0003
la1s.wc 3204 457 201 0 6 3 73.2 461.1 1.8227\(^{\mathbf{36}}\) 7.7 0.0368 42.1 0.0038 19.3 0.0004
mnist-784 70000 4365 477 0 10 18 88.3 1833.3 4.6191\(^{\mathbf{622}}\) 5.5 0.0235\(^{\mathbf{1}}\) 103.9 0.0099 11.5 0.0008
nomao 34465 932 61 25 2 17 95.3 1640.8 4.9576\(^{\mathbf{156}}\) 2.4 0.0180 38.6 0.0018 4.3 0.0005
ohscal.wc 11162 1761 582 0 10 6 70.9 787.1 2.0714\(^{\mathbf{225}}\) 86.2 0.3018\(^{\mathbf{21}}\) 59.9 0.0090 23.7 0.0006
spambase 4601 189 37 0 2 8 91.5 35.8 0.0029 4.6 0.0060 16.9 0.0007 4.1 0.0003
andes 5454 24 2 2 78.8 0.1660 2.6 0.0295 58.0 0.0300 4.5 0.0055
emdec6g30 4154 30 2 2 11.6 0.0362 1.8 0.0445 13.6 0.0184 2.9 0.0048
math-skills 3693629 46 2 2 9.6 0.2895\(^{\mathbf{26}}\) 7.6 0.0261 9.9 0.4271\(^{\mathbf{18}}\) 3.4 0.0290
mooring 14468 22 2 2 145.4 2.3991\(^{\mathbf{14}}\) 20.9 3.9951\(^{\mathbf{7}}\) 216.3 0.7678\(^{\mathbf{1}}\) 16.2 0.0189
tcc4e38 22508 38 2 2 14.4 0.1370 2.6 0.0155 10.4 0.0632 2.0 0.0103

Proposition 14. Let \(\Delta\) be a monotone, \(\vee\)-decomposable NNF with \(M\) shortest implicates, \(N\) nodes and \(E\) edges. The time complexity of \(\Call{snr}{\Delta}\) in Algorithm [alg:snr] is \(O(M \cdot E)\) and its space complexity is \(O(M \cdot N)\).

We obtain a tighter complexity if we apply Algorithm [alg:snr] to the closed-form complete reasons of decision trees given by Proposition 7, due to the following bound on the number of prime implicates (a superset of shortest implicates).

Proposition 15. For a decision tree, the complete reason for an instance in class \(c\) has \(\leq L\) prime implicates, where \(L\) is the number of leaves in the tree labeled with a class \(c' \neq c\).

The complete reason for a decision tree \(T\) has \(O(|T|)\) nodes and edges, where \(|T|\) is the decision tree size (see Proposition 7). The time and space complexity of Algorithm [alg:snr] is then \(O(|T| \cdot L)\) for decision trees.

[38] showed that the number of contrastive explanations is linear in the decision tree size. Proposition 15 tightens this result by providing a more specific bound. For a decision \(T\) with binary variables and binary classes, [39] showed that the set of all contrastive explanations can be computed in time polynomial in \(|T|+n\), where \(n\) is the number of variables. Algorithm [alg:snr] comes with a tighter complexity for the computation of shortest contrastive explanations for decision trees and applies to multi-class decision trees with discrete features. Another related complexity result is that counterfactual explanations, as discussed earlier, can be enumerated with polynomial delay if the classifier satisfies some conditions as stated in [9].

We finally observe that if an NNF is monotone and \(\wedge\)-decomposable, then one can develop a dual of Algorithm [alg:snr] for computing the shortest prime implicants of the NNF.

Shortest Sufficient Reasons We next present Algorithm [alg:ssr] for computing the shortest implicants of monotone, \(\vee\)-decomposable NNFs which is a hard task. For decision trees, the problem of deciding whether there exists a sufficient reason of length \(\leq k\) is NP-complete [40]. Since decision trees have closed-form complete reasons that are monotone and \(\vee\)-decomposable, computing the shortest implicants for this class of NNFs is hard. [39] showed that the number of shortest sufficient reasons for decision trees can be exponential and provided an incremental algorithm for computing the shortest sufficient reasons for decision trees with binary variables and binary classes, based on a reduction to the Partial MaxSat problem. Algorithm [alg:ssr] has a broader scope, does not require a reduction and is based on two key techniques.

The first technique is to compute all unsubsumed implicants of length \(\leq k\), called \(k\)-implicants, starting with \(k=0\). If no implicants are found, \(k\) is incremented and the process is repeated. The second technique relates to computing the \(k\)-implicants of a conjunction \(\alpha \wedge \beta\). If we have the \(k\)-implicants \(S\) for \(\alpha\) and the \(k\)-implicants \(R\) for \(\beta\), we can compute the Cartesian product \(S \times R\) and keep unsubsumed implicants of length \(\leq k\). Algorithm [alg:ssr] does something more refined. It first computes the \(k\)-implicants \(S\) for \(\alpha\). For each implicant \(\sigma \in S\), it then computes and accumulates the \(k'\)-implicants for \(\beta | \sigma\) where \(k' = k - |\sigma|\). These techniques control the number of generated \(k\)-implicants at each NNF node (smaller \(k\) leads to fewer \(k\)-implicants). Our implemented caching scheme on Lines 6[ssr:ln:i-cache] exploits the following properties. If the \(k\)-implicants for \(\Delta | \sigma\) are \(\{\{\}\}\), then these are also its \(j\)-implicants for all \(j\). Further, if we cached the \(k\)-implicants for \(\Delta | \sigma\), then we can use them to retrieve its \(j\)-implicants for any \(j \leq k\) by selecting implicants of length \(\leq j\). We empirically evaluate Algorithms [alg:snr][alg:ssr] next.

Empirical Evaluation. Table 1 depicts an empirical evaluation on decision trees learned from OpenML datasets [41] and binary decision graphs compiled from Bayesian network classifiers [7], [42]. The decision trees were learned by weka [43] using python-weka-wrapper3 available at pypi.org. We used weka’s J48 classifier with default settings, which learns pruned C4.5 decision trees with numeric and nominal features [44]. Each dataset was split using weka into training (\(85\%\)) and testing (\(15\%\)) data. We aimed for OpenML datasets with more than \(100\) features since many smaller datasets we tried were very easy, but we kept a few smaller ones since they are commonly reported on (adult, compas, spambase). Some of the learned decision trees had significantly fewer variables than the corresponding datasets (e.g., gisette has \(5000\) features but the learned decision tree has \(111\)). The decision graphs we used are the reportedly largest ones compiled by [7], [42]. For each decision tree, we computed reasons for decisions on \(1000\) instances sampled from testing data (or all testing data if smaller than \(1000\)). We tried random instances but they were much easier. For each decision graph, we computed complete reasons for \(1000\) random instances (there is no corresponding data). The total number of instances for the fifteen benchmarks was \(13963\). We did not report the time for computing a complete reason as this is a closed form with linear size (Equation ?? ).

We compared four algorithms: snr(Algorithm [alg:snr]), nr(standard algorithm for computing prime implicates of a monotone NNF but with no subsumption checking at \(\vee\)-nodes since the input NNF is \(\vee\)-decomposable),5 ssr(Algorithm [alg:ssr]) and sr(dual of nr). Each instance had a timeout of \(60\) seconds. In Table 1, nodes, num, nom, classes; card and acc stand for number of nodes, numeric features, nominal features, classes; maximum cardinality of variables and accuracy. Count and time are averages over instances that both sr/ssr(nr/snr) finished. The bolded exponent of time is the number of instances that timed out (not reported if zero). The supplementary material contains further statistics such as stdev, mean and max. We used a Python implementation on a dual Intel(R) Xeon E5-2670 CPUs running at 2.60GHz and 256GB RAM. As revealed by Table 1, ssris quite effective. Its average running time is normally in milliseconds, it timed out on only \(37\) instances and can be two orders of magnitude faster than srwhich timed out on \(2222\) instances. snris also much faster than nrbut the latter is also very effective on decision trees (see Proposition 15) but timed out on \(19\) decision graph instances. All algorithms are quite effective on the easier benchmarks.

7 Conclusion↩︎

We studied the computation of complete reasons for multi-class classifiers with nominal and numeric features. We derived closed forms for the complete reasons of decision trees and graphs in the form of monotone, \(\vee\)-decomposable NNFs and showed how similar forms can be derived for SDDs. We further established a correspondence between the prime implicates of complete reasons and contrastive explanations. We then presented an output polynomial algorithm for enumerating the shortest implicates (shortest necessary reasons) for complete reasons in the above form. We also presented a simple algorithm for enumerating the shortest implicants (shortest sufficient reasons) which appears to be effective based on an empirical evaluation over fifteen datasets.

8 Acknowledgements↩︎

This work has been partially supported by NSF grant #ISS-1910317 and ONR grant #N00014-18-1-2561.

9 Proofs↩︎

Lemma 1. Conditioning an NNF preserves the properties of \(\vee\)-decomposability, \(\wedge\)-decomposability and monotonicity. Moreover, if an NNF is \(\wedge\)-decomposable or monotone, then its satisfiability can be decided in linear time. Finally, if an NNF is \(\vee\)-decomposable or monotone, then its validity can be decided in linear time.

Proof of Lemma 1. The first part about conditioning follows directly from the definitions of conditioning, \(\vee\)-decomposability, \(\wedge\)-decomposability and monotonicity. The satisfiability test distributes over disjunctions. It distributes over a conjunction when the conjuncts do not share variables. The validity test distributions over conjunctions. It distributes over disjunctions when the disjuncts do not share variables. A monotone NNF is satisfiable (valid) iff it evaluates to true after replacing each of its literals with \(\top\) (\(\bot\)). ◻

Lemma 2. For state \(x_i\) of variable \(X\) and positive NNF \(\alpha\), we have \(x_i \vee \alpha\;= x_i \vee \alpha[x_i \!\!\to\!\!\bot]\) where \(\alpha[x_i \!\!\to\!\!\bot]\) is obtained by replacing every occurrence of \(x_i\) in \(\alpha\) with \(\bot\).

Proof of Lemma 2. We prove this by induction on the structure of positive NNF \(\alpha\). The base cases for \(\alpha\) are \(\top\), \(\bot\), \(x_i\), \(x_j\) for \(j \neq i\), and \(y_j\) for \(Y \neq X\). When \(\alpha = x_i\), \(\alpha[x_i \!\!\to\!\!\bot] = \bot\) and \(x_i \vee x_i = x_i \vee \bot\) so the result holds. For all other base cases, \(\alpha[x_i \!\!\to\!\!\bot] = \alpha\) so the result holds. There are two inductive steps for \(\alpha = \alpha_1 \wedge \alpha_2\) and \(\alpha = \alpha_1 \vee \alpha_2\). By the induction hypothesis, \(x_i \vee \alpha_1[x_i \!\!\to\!\!\bot] = x_i \vee \alpha_1\) and \(x_i \vee \alpha_2[x_i \!\!\to\!\!\bot] = x_i \vee \alpha_2\). We have \((\alpha_1 \wedge \alpha_2)[x_i \!\!\to\!\!\bot] = (\alpha_1[x_i \!\!\to\!\!\bot]) \wedge (\alpha_2[x_i \!\!\to\!\!\bot])\) and hence \(x_i \vee (\alpha_1 \wedge \alpha_2)[x_i \!\!\to\!\!\bot] = (x_i \vee \alpha_1) \wedge (x_i \vee \alpha_2) = x_i \vee \alpha\). We also have \((\alpha_1 \vee \alpha_2)[x_i \!\!\to\!\!\bot] = (\alpha_1[x_i \!\!\to\!\!\bot]) \vee (\alpha_2[x_i \!\!\to\!\!\bot])\) and hence \(x_i \vee (\alpha_1 \vee \alpha_2)[x_i \!\!\to\!\!\bot] = (x_i \vee \alpha_1) \vee (x_i \vee \alpha_2) = x_i \vee \alpha\). ◻

Proof of Proposition 1. Follows directly from Definition 1. ◻

Proof of Proposition 2. For the first part of the proposition, we have: \[\begin{align} \forall x_i \cdot (\alpha \wedge \beta) & = & (\alpha \wedge \beta){|}x_i \wedge \bigwedge_{j \neq i} (x_i \vee (\alpha \wedge \beta) {|}x_j) \\ & = & (\alpha {|}x_i) \wedge (\beta{|}x_i) \wedge \bigwedge_{j \neq i} (x_i \vee \alpha{|}x_j) \wedge \bigwedge_{j \neq i} (x_i \vee \beta {|}x_j) \\ & = & (\forall x_i \cdot \alpha) \wedge (\forall x_i \cdot \beta). \end{align}\]

To show the second part of the proposition, suppose variable \(X\) does not occur in \(\alpha\). Then \(\alpha {|}x_j = \alpha\) for all \(j\). Hence, \(\forall x_i \cdot \alpha = \alpha\) by Definition 1. We now have: \[\begin{align} \forall x_i \cdot (\alpha \vee \beta) & = & (\alpha \vee \beta){|}x_i \wedge \bigwedge_{j \neq i} (x_i \vee (\alpha \vee \beta) {|}x_j) \\ & = & (\alpha \vee (\beta {|}x_i)) \wedge (x_i \vee \alpha \vee \bigwedge_{j \neq i} \beta {|}x_j) \\ & = & \alpha \vee (x_i \wedge (\beta {|}x_i)) \vee ((\beta {|}x_i) \wedge \bigwedge_{j \neq i} \beta {|}x_j) \\ & = & \alpha \vee ((\beta {|}x_i) \wedge \bigwedge_{j \neq i} (x_i \vee \beta {|}x_j)) \\ & = & (\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \beta). \qedhere \end{align}\] ◻

Proof of Proposition 3. Follows directly from Propositions 1 and 2. Note that universal quantification is commutative so we can quantify states in any order. ◻

Lemma 3. Let \(\alpha\) be a positive NNF and let \(x_i\) be a state of variable \(X\). If \(x_i\) does not occur in \(\alpha\), then \(\alpha {|}x_i \models \alpha {|}x_j\) for all \(j \neq i\) and \(\forall x_i \cdot \alpha = \alpha {|}x_i\). If \(x_j\) does not occur in \(\alpha\) for \(j \neq i\), then \(\alpha {|}x_j \models \alpha {|}x_i\) for \(j \neq i\), \(\alpha {|}x_j = \alpha {|}x_k\) for \(j, k \neq i\) and \(\forall x_i \cdot \alpha = \alpha\).

Proof of Lemma 3. Suppose state \(x_i\) does not occur in NNF \(\alpha\) and let \(j \neq i\). Then \(\alpha {|}x_i\) is obtained from \(\alpha\) by replacing every state of variable \(X\) in \(\alpha\) with \(\bot\). Moreover, \(\alpha {|}x_j\) is obtained from \(\alpha\) by replacing state \(x_j\) with \(\top\) and replacing all other states of variable \(X\) in \(\alpha\) with \(\bot\). Hence, \(\alpha {|}x_i \models \alpha {|}x_j\). We now have: \[\begin{align} \forall x_i \cdot \alpha & = & (\alpha {|}x_i) \wedge \bigwedge_{j \neq i} (x_i \vee \alpha {|}x_j) \\ & = & (\alpha {|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i} \alpha {|}x_j) \\ & = & ((\alpha {|}x_i) \wedge x_i) \vee ((\alpha {|}x_i) \wedge \bigwedge_{j\neq i} \alpha {|}x_j )) \\ & = & ((\alpha {|}x_i) \wedge x_i) \vee (\alpha {|}x_i)\quadsince \(\alpha {|}x_i \models \alpha {|}x_j\) \\ & = & \alpha {|}x_i. \end{align}\] Suppose state \(x_j\) does not occur in NNF \(\alpha\) for \(j \neq i\). Then \(\alpha {|}x_j\) is obtained from \(\alpha\) by replacing state \(x_i\) with \(\bot\). Hence, \(\alpha {|}x_j = \alpha {|}x_k\) for \(k \neq i\). Moreover, \(\alpha {|}x_i\) is obtained from \(\alpha\) by replacing state \(x_i\) with \(\top\). Hence, \(\alpha {|}x_j \models \alpha {|}x_i\). We now have: \[\begin{align} \forall x_i \cdot \alpha & = & (x_i \wedge (\alpha {|}x_i)) \vee ((\alpha {|}x_i) \wedge \bigwedge_{j\neq i} \alpha {|}x_j )) \quadby previous derivation \\ & = & (x_i \wedge (\alpha {|}x_i)) \vee (\bigwedge_{j\neq i} \alpha {|}x_j) \quadsince \(\bigwedge_{j \neq i} \alpha {|}x_j \models \alpha {|}x_i\) \\ & = & (x_i \wedge (\alpha {|}x_i)) \vee (x_i \wedge \bigwedge_{j\neq i} \alpha {|}x_j) \vee ({\bar{x}}_i \wedge \bigwedge_{j\neq i} \alpha {|}x_j) \\ & = & (x_i \wedge (\alpha {|}x_i)) \vee ({\bar{x}}_i \wedge \bigwedge_{j\neq i} \alpha {|}x_j) \quadsince \(x_i \wedge \bigwedge_{j \neq i} \alpha {|}x_j \models x_i \wedge (\alpha {|}x_i)\) \\ & = & (x_i \wedge (\alpha {|}x_i)) \vee \bigvee_{k \neq i} (x_k \wedge \bigwedge_{j\neq i} \alpha {|}x_j) \\ & = & (x_i \wedge (\alpha {|}x_i)) \vee \bigvee_{k \neq i} (x_k \wedge \alpha {|}x_k) \quadsince \(\alpha {|}x_k = \alpha {|}x_j\) \\ & = & \alpha. \qedhere \end{align}\] ◻

Proof of Proposition 4. Suppose \(x_i\) does not occur in either \(\alpha\) or \(\beta\). Then \(x_i\) does not occur in \(\alpha \vee \beta\). By Lemma 3, \(\forall x_i \cdot \alpha = \alpha {|}x_i\), \(\forall x_i \cdot \beta = \beta {|}x_i\) and \(\forall x_i \cdot (\alpha \vee \beta) = (\alpha \vee \beta) {|}x_i = (\alpha {|}x_i) \vee (\beta {|}x_i) = (\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \beta)\).

Suppose \(x_j\) does not occur in either \(\alpha\) or \(\beta\) for \(j \neq i\). Then \(x_j\) does not occur in \(\alpha \vee \beta\) for \(j \neq i\). By Lemma 3, \(\forall x_i \cdot \alpha = \alpha\), \(\forall x_i \cdot \beta = \beta\) and \(\forall x_i \cdot (\alpha \vee \beta) = \alpha \vee \beta = (\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \beta)\). ◻

Proof of Proposition [prop:wtop]. Suppose the states of \(X\) appear in \(\alpha\) only in disjunctions of the form \(\Sigma_{S'} = \bigvee_{k \in S'} x_k\) where \(S' \supseteq S\). Then \(\alpha {|}x_p \models \alpha {|}x_q\) for all \(x_p\) and for all \(x_q \in S\). This follows since \(x_q \in S'\) and hence \(\Sigma_{S'} {|}x_q = \top\). We now have the following equality, which is key for the proof: \[\bigwedge_{x_j \not \in S} \alpha {|}x_j = \bigwedge_{x_j \not \in S} \alpha {|}x_j \wedge \bigwedge_{x_j \in S} \alpha {|}x_j = \bigwedge_{j} \alpha {|}x_j. \label{eq:wtop}\tag{2}\] The proof will consider two cases: \(x_i \in S\) and \(x_i \not \in S\). Suppose \(x_i \in S\). We then have: \[\begin{align} \forall x_i \cdot (\alpha \vee \bigvee_{x_k \in S} x_k) & = & ((\alpha \vee \bigvee_{x_k \in S} x_k){|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i} (\alpha \vee \bigvee_{x_k \in S} x_k) {|}x_j) \\ & = & x_i \vee \bigwedge_{x_j \not \in S} (\alpha \vee \bigvee_{x_k \in S} x_k) {|}x_j \\ & = & x_i \vee \bigwedge_{x_j \not \in S} \alpha {|}x_j \\ & = & x_i \vee \bigwedge_{j} \alpha {|}x_j \quad by Equation~\ref{eq:wtop}. \end{align}\] Moreover, we have \[\begin{align} \forall x_i \cdot \bigvee_{x_k \in S} x_k & = & x_i. \\ \forall x_i \cdot \alpha & = & (\alpha {|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i} \alpha {|}x_j). \end{align}\] The proposition holds since \[(\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \bigvee_{x_k \in S} x_k) = x_i \vee ((\alpha {|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i} \alpha {|}x_j)) \\ = x_i \vee \bigwedge_{j} \alpha {|}x_j\] Suppose now that \(x_i \not \in S\). We then have: \[\begin{align} \forall x_i \cdot (\alpha \vee \bigvee_{x_k \in S} x_k) & = & ((\alpha \vee \bigvee_{x_k \in S} x_k){|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i} (\alpha \vee \bigvee_{x_k \in S} x_k) {|}x_j) \\ & = & (\alpha {|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i, x_j \not \in S} \alpha {|}x_j) \\ & = & (x_i \wedge (\alpha {|}x_i)) \vee \bigwedge_{x_j \not \in S} \alpha {|}x_j \\ & = & (x_i \wedge \alpha) \vee \bigwedge_{j} \alpha {|}x_j \quad by Equation~\ref{eq:wtop}. \end{align}\] Moreover, we have \[\begin{align} \forall x_i \cdot \bigvee_{x_k \in S} x_k & = & \bot. \\ \forall x_i \cdot \alpha & = & (\alpha {|}x_i) \wedge (x_i \vee \bigwedge_{j \neq i} \alpha {|}x_j) = (x_i \wedge \alpha) \vee \bigwedge_{j} \alpha {|}x_j. \end{align}\] The proposition holds since \[(\forall x_i \cdot \alpha) \vee (\forall x_i \cdot \bigvee_{x_k \in S} x_k) = (x_i \wedge \alpha) \vee \bigwedge_{j} \alpha {|}x_j. \qedhere\] ◻

Proof of Proposition 6. Consider the following NNF, which is the standard translation of a decision graph into an NNF except that we are switching the \(\top\) and \(\bot\) leaf nodes: \[\Lambda^c[T] = \left\{ \begin{array}{ll} \bot, & if \(T\) is labeled with class \(c\) \\ \top, & if \(T\) is labeled with class \(c' \neq c\) \\ \displaystyle\bigvee_j (\Lambda^c[T_j] \wedge \bigvee_{x_i \in S_j} x_i), & \(T\) has edges \(\xrightarrow[]{ X,\:S_j}\!T_j\) \end{array} \right.\] This NNF characterizes the instances of classes \(c' \neq c\). That is, \(\delta \models \Lambda^c[T]\) iff \(T\) assigns a class \(c' \neq c\) to instance \(\delta\). NNF \(\Delta^c[T]\) of Definition 3 results from negating \(\Lambda^c[T]\) using deMorgan’s law. Hence, \(\Delta^c[T]\) characterizes the instances of class \(c\). ◻

Proof of Proposition 7. We first prove this proposition for decision graphs that satisfy the test-once property. In this case, NNF \(\Delta^c[T]\) of Definition 3 will be \(\vee\)-decomposable except for the disjunction \(\Upsilon_j = \bigvee_{x_i \not \in S_j} x_i\) of each node \(T\) with edges edges \(\xrightarrow[]{ X,\:S_j}\!T_j\). By Proposition 2, we can compute \(\forall \delta \cdot \Delta^c[T]\) by simply replacing each such disjunction \(\Upsilon_j\) with \(\forall \delta \cdot \Upsilon_j\) since \(\forall \delta\) distributes over all other conjunctions and disjunctions in the NNF. Let \(x_l = \delta[X]\). Then \(\forall \delta \cdot \Upsilon_j = \forall x_l \cdot \Upsilon_j\) by Lemma 3. Since \(\{S_j\}_j\) is a state partition for variable \(X\) (test-once property), we have \(x_l \in \bigcup_j S_j\) and \(x_l \in S_k\) for some unique \(k\). By Definition 1, \(\forall x_l \cdot \Upsilon_j = \bot\) if \(j = k\) and \(\forall x_l \cdot \Upsilon_j = x_l = \delta[X]\) if \(j \neq k\). Applying these substitutions to NNF \(\Delta^c[T]\) of Definition 3 yields NNF \(\Gamma^c[T]\) of Equation ?? .

Suppose now that the decision graph satisfies only the weak test-once property. There is one place where the previous argument breaks and another place where it is incomplete. Consider the disjunction \(\Delta^c[T_j] \vee (\bigvee_{x_i \not \in S_j} x_i)\) in Definition 3 and suppose variable \(X\) is tested again at some node in graph \(T_j\) (not possible under the test-once property). Variable \(X\) will then appear in NNF \(\Delta^c[T_j]\) so we can no longer justify the the distribution of \(\forall \delta\) over \(\Delta^c[T_j]\) and \((\bigvee_{x_i \not \in S_j} x_i)\) using \(\vee\)-decomposability. Observe however that every occurrence of variable \(X\) in NNF \(\Delta^c[T_j]\) will be in disjunctions of the form \(\bigvee_{x_i \not \in R_o} x_i\) where \(\xrightarrow[]{ X,\:R_o}\!T_o\) is an edge in graph \(T_j\). By the weak test-once property, \(R_o \subseteq S_j\) and, hence, \(\overline{S}_j \subseteq \overline{R}_o\) so \(\forall \delta\) will distribute over the disjunction \(\Delta^c[T_j] \vee (\bigvee_{x_i \not \in S_j} x_i)\) by Proposition [prop:wtop] (and Proposition 2). We now consider the place where the previous argument is incomplete. This is when \(x_l = \delta[X]\) and \(x_l \not \in \bigcup_o R_o\) (not possible under the test-once property). In this case, \({\ell}_o = \forall x_l \cdot (\bigvee_{x_i \not \in R_o} x_i) = x_l\). However, \({\ell}_o = \bot\) according to Equation ?? . Using \(\bot\) instead of \(x_l\) preserves equivalence of the complete reason as we show next (and ensures its \(\vee\)-decomposable). Since \(x_l \not \in \bigcup_o R_o\), we have \(x_l \not \in S_j\) by the weak test-once property. Hence, \(\forall x_l \cdot (\bigvee_{x_i \not \in S_j} x_i) = x_l\) which leads to \(\forall \delta \cdot (\Delta^c[T_j] \vee \bigvee_{x_i \not \in S_j} x_i) = (\forall \delta \cdot \Delta^c[T_j]) \vee x_l\). By Lemma 2, we can therefore replace the occurrences of \(x_l\) in \(\forall \delta \cdot \Delta^c[T_j]\) with \(\bot\) while preserving equivalence. ◻

Proof of Proposition 8. The formula in Equation ?? does not contain negations so it is an NNF. Literals can only appear in this NNF as \({\ell}_j\) in the expression \(\bigwedge_{j} (\Gamma^c[T_j] \vee {\ell}_j)\) for a graph node with edges \(\xrightarrow[]{ X,\:S_j}\!T_j\). Since \({\ell}_j = \bot\) or \({\ell}_j = \delta[X]\), all literals in the NNF are states in instance \(\delta\) so the NNF is monotone. To show that the NNF is \(\vee\)-decomposable, suppose variable \(X\) is tested again at some node in graph \(T_j\) which has edges \(\xrightarrow[]{ X,\:R_o}\!T_o\). By the conditions of Equation ?? , if \({\ell}_j = \delta[X]\), then \({\ell}_j \not \in S_j\). By the weak test-once property, \({\ell}_j \not \in R_o\) for all \(o\). By the conditions of Equation ?? , \({\ell}_o = \bot\) for all \(o\) so state \({\ell}_j\) will not appear in the expression \(\bigwedge_{o} (\Gamma^c[T_o] \vee {\ell}_o)\) for node \(T_k\). Hence, the NNF is \(\vee\)-decomposable. ◻

Proof of Proposition 9. We first observe that \(\forall \delta \cdot \Delta\) can be written as a DNF \(\tau_1 + \ldots + \tau_n\) where \(\tau_i\) are the prime implicants of \(\Delta\) that satisfy \(\tau_i \subseteq \delta\) [26]. Moreover, \(\delta \models \Delta\) by the definition of complete reason (we universally quantify \(\delta\) from the class formula satisfied by \(\delta\)).

\({\Rightarrow}\) Suppose instances \(\delta\) and \(\delta^\star\) are congruent. Since \(\delta \models \Delta\), we get \(\delta \cap \delta^\star \models \Delta\) by Definition 4. Since \(\delta \cap \delta^\star\) is an implicant of \(\Delta\) and a subset of \(\delta\), then \(\tau_i \subseteq \delta \cap \delta^\star\) for some \(\tau_i\). Hence, \(\delta\cap\delta^\star \models \forall \delta \cdot \Delta\) and therefore \(\delta^\star \models \forall \delta \cdot \Delta\).

\({\Leftarrow}\) Suppose \(\delta^\star \models \forall \delta \cdot \Delta = \tau_1 + \ldots + \tau_n\). Hence, \(\delta^\star \models \tau_i\) for some \(\tau_i\). Since \(\tau_i \subseteq \delta\), \(\tau_i \subseteq \delta^\star\) and \(\tau_i \models \forall \delta \cdot \Delta\), we have \(\tau_i \subseteq \delta \cap \delta^\star \models \forall \delta \cdot \Delta\). Moreover, \(\delta \cap \delta^\star \models \Delta\) since \(\forall \delta \cdot \Delta \models \Delta\) [27]. Hence, instances \(\delta\) and \(\delta^\star\) are congruent by Definition 4. ◻

Proof of Proposition 10. The complete reason \(\Gamma = \forall \delta \cdot \Delta\) can be written as a DNF \(\tau_1 + \ldots + \tau_n\) where \(\tau_i\) are the prime implicants of \(\Delta\) which satisfy \(\tau_i \subseteq \delta\) [26]. Hence, the prime implicants of \(\Gamma\) are subsets of instance \(\delta\). We can obtain the prime implicates of \(\Gamma\) by converting DNF \(\tau_1 + \ldots + \tau_n\) into a CNF and then removing subsumed clauses (since the DNF is monotone). Hence, the prime implicates of \(\Gamma\) are also subsets of instance \(\delta\). ◻

Proof of Proposition 11. Let \(\Gamma\) denote the complete reason \(\forall \delta \cdot \Delta\). We first prove the following lemma.

Lemma 4. If \(\gamma = \{s_1,\ldots,s_n\} \subseteq \delta\), then \(\Gamma \models s_1+\ldots+s_n\) iff \(\delta\setminus\gamma \not \models \Delta\).

Proof of Lemma 4. Suppose \(\gamma = \{s_1,\ldots,s_n\}\) is a subset of instance \(\delta\).

\({\Rightarrow}\) Suppose \(\Gamma \models s_1+\ldots+s_n\). Then \({\bar{s}}_1,\ldots,{\bar{s}}_n \models \neg \Gamma\) and hence \(\delta\setminus\gamma,{\bar{s}}_1,\ldots,{\bar{s}}_n \models \neg \Gamma\). Let \(\delta^\star\) be an instance consistent with term \(\delta\setminus\gamma,{\bar{s}}_1,\ldots,{\bar{s}}_n\). Then \(\delta^\star \models \neg \Gamma\) and \(\delta\cap\delta^\star = \delta\setminus\gamma\). Since \(\delta^\star \models \neg \Gamma\), instances \(\delta\) and \(\delta^\star\) are not congruent by Proposition 9 and hence \(\delta\cap\delta^\star \not \models \Delta\) by Definition 4. Hence, \(\delta\setminus\gamma \not \models \Delta\).

\({\Leftarrow}\) Suppose \(\delta\setminus\gamma \not \models \Delta\). We will show \(\Gamma \models s_1 + \ldots + s_n\) by contradiction. Suppose \(\Gamma \not \models s_1 + \ldots + s_n\). Then \(\Gamma, {\bar{s}}_1, \ldots, {\bar{s}}_n\) is consistent so there must exist an instance \(\delta^\star\) such that \(\delta^\star \models \Gamma, {\bar{s}}_1, \ldots, {\bar{s}}_n\). Since \(\delta^\star \models \Gamma\), instances \(\delta\) and \(\delta^\star\) are congruent by Proposition 9 and hence \(\delta \cap \delta^\star \models \Delta\) by Definition 4. Since \(\delta \cap \delta^\star \subseteq \delta \setminus \gamma\), then \(\delta \setminus \gamma \models \Delta\), a contradiction. Hence, \(\Gamma \models s_1 + \ldots + s_n\). ◻

We are now ready to prove the proposition.

\({\Rightarrow}\) Suppose \(\gamma = \{s_1,\ldots,s_n\}\) is a prime implicate of \(\Gamma\). By Proposition 10, \(\gamma \subseteq \delta\), so \(\gamma\) is a minimal subset of \(\delta\) such that \(\Gamma \models s_1+\ldots+s_n\). By Lemma 4, \(\gamma\) is a minimal subset of \(\delta\) such that \(\delta\setminus\gamma \not \models \Delta\) so it is a contrastive explanation by Definition 5.

\({\Leftarrow}\) Suppose \(\gamma = \{s_1,\ldots,s_n\}\) is a contrastive explanation. By Definition 5, \(\gamma\) is a minimal subset of instance \(\delta\) such that \(\delta\setminus\gamma \not \models \Delta\). By Lemma 4, \(\gamma\) is a minimal subset of \(\delta\) such that \(\Gamma \models s_1 + \ldots + s_n\). Hence, \(\gamma\) is a prime implicate of \(\Gamma\) by Proposition 10. ◻

Proof of Proposition 12. The cases \(\top\), \(\bot\) and \(x_i\) follow directly from Definition 6. For the other two cases, we first observe the following. A monotone NNF can be converted to a CNF which includes all prime (and shortest) implicates of the NNF as follows: \(\mathrm{\small cnf}(\bot) = \{\{\}\}\), \(\mathrm{\small cnf}(\top) = \{\}\), \(\mathrm{\small cnf}(x_i) = \{\{x_i\}\}\), \(\mathrm{\small cnf}(\alpha \wedge \beta) = \mathrm{\small cnf}(\alpha) \cup \mathrm{\small cnf}(\beta)\) and \(\mathrm{\small cnf}(\alpha \vee \beta) = \{i \cup j \mid i \in \mathrm{\small cnf}(\alpha), j \in \mathrm{\small cnf}(\beta)\}\). This immediately gives \(\mathrm{\small iml}(\alpha \wedge \beta) = \min(\mathrm{\small iml}(\alpha),\mathrm{\small iml}(\beta))\). If \(\alpha\) and \(\beta\) share no variables (\(\vee\)-decomposability), then \(i \cap j = \emptyset\) for \(i \in \mathrm{\small cnf}(\alpha)\) and \(j \in \mathrm{\small cnf}(\beta)\), which leads to \(\mathrm{\small iml}(\alpha \vee \beta) = \mathrm{\small iml}(\alpha) + \mathrm{\small iml}(\beta)\). ◻

Proof of Proposition 13. \(\mathrm{\small prune}(\Delta)\) is obtained by removing edges from \(\Delta\) so it must be monotone and \(\vee\)-decomposable given that \(\Delta\) satisfies these properties. The second part of the proposition can be shown directly by induction on the NNF structure while utilizing the conversion to CNF as shown in the proof of Proposition 12. ◻

Proof of Proposition 14. For each node \(\alpha\) in NNF \(\mathrm{\small prune}(\Delta)\), we have \(|\mathrm{\small snr}(\alpha)| \leq M\). This follows because on Line 5, we have \(|\mathrm{\small snr}(\alpha_1 \vee \ldots \vee \alpha_n)| = \prod_{i=1}^n |\mathrm{\small snr}(\alpha_i)|\) since we are computing a Cartesian product. Moreover, on Line [snr:ln:and] with \(I = \{i \mid \mathrm{\small iml}(\alpha_i)=\mathrm{\small iml}(\Delta)\}\), we have \(|\mathrm{\small snr}(\bigwedge_{i \in I} \alpha_i)| \geq \max_{i \in I}(|\mathrm{\small snr}(\alpha_i)|)\) since we are computing a union. The Cartesian product computation on Line 5 takes \(O(|\mathrm{\small snr}(\alpha_1 \vee \ldots \vee \alpha_n)|) = O(M)\) time and space. The union computation on Line [snr:ln:and] takes \(O(\sum_{i \in I} |\mathrm{\small snr}(\alpha_i)|) = O(|I| \cdot M)\) time and \(O(|\bigcup_{i \in I} \mathrm{\small snr}(\alpha_i)|) = O(M)\) space. Suming these complexities over all nodes in the NNF, we get a time complexity of \(O(M \cdot E)\) and a space complexity of \(O(M \cdot N)\). ◻

Proof of Proposition 15. We will show this by induction on the structure of the decision tree. The complete reason for a decision tree is given in Equation ?? , which show next for reference: \[\Gamma^c[T] = \left\{ \begin{array}{ll} \top, & if \(T\) is labeled with class \(c\) \\ \bot, & if \(T\) is labeled with class \(c' \neq c\) \\ \displaystyle \bigwedge_{j} (\Gamma^c[T_j] \vee {\ell}_j), & if \(T\) has edges \(\xrightarrow[]{ X,\:S_j}\!T_j\) \end{array} \right.\] We will use \(L[T]\) to denote the number of leaf nodes in tree \(T\) which are labeled with classes other than \(c\). We will also use \(\#\![T]\) to denote the number of prime implicates for NNF \(\Gamma^c[T]\). What we need to show is that \(\#\![T] \leq L[T]\).

The base cases are for leaf nodes of the decision tree. If leaf node \(T\) is labeled with class \(c\), then \(L[T] = 0\) and the complete reason is \(\top\) which has no prime implicates so \(\#\![T] = 0\) and the proposition holds. If leaf node \(T\) is labeled with class \(c' \neq c\), then \(L[T]=1\) and the complete reason is \(\bot\) which has a single prime implicate \(\{\}\) so \(\#\![T] = 1\) and the proposition holds. Consider now an internal node \(T\) with edges \(\xrightarrow[]{ X,\:S_j}\!T_j\) which has the complete reason \(\bigwedge_{j} (\Gamma^c[T_j] \vee {\ell}_j)\). Since \({\ell}_j\) is either a literal or \(\bot\) (by Proposition 7), and since \({\ell}_j\) does not appear in \(\Gamma^c[T_j]\) if it is a literal (by Proposition 8), the prime implicates for \(\Gamma^c[T_j] \vee {\ell}_j\) are obtained by disjoining each prime implicate for \(\Gamma^c[T_j]\) with \({\ell}_j\). Hence, the number of prime implicates for \(\Gamma^c[T_j] \vee {\ell}_j\) equals the number of prime implicates for \(\Gamma^c[T_j]\), \(\#\![T_j]\). Moreover, since the complete reason is monotone, the prime implicates for \(\bigwedge_{j} (\Gamma^c[T_j] \vee {\ell}_j)\) are obtained by taking the union of prime implicates for each \(\Gamma^c[T_j] \vee {\ell}_j\) and removing subsumed implicates from the result. Hence, \(\#\![T] \leq \sum_j \#\![T_j]\). By the induction hypothesis, \(\#\![T_j] \leq L[T_j]\). We now have \(\#\![T] \leq \sum_j L[T_j] = L[T]\) which proves the proposition. ◻

References↩︎

[1]
Ribeiro, M. T.; Singh, S.; and Guestrin, C. 2016. "Why Should I Trust You?": Explaining the Predictions of Any Classifier. In KDD, 1135–1144. ACM.
[2]
Ribeiro, M. T.; Singh, S.; and Guestrin, C. 2018. Anchors: High-Precision Model-Agnostic Explanations. In AAAI, 1527–1535. AAAI Press.
[3]
Narodytska, N.; Kasiviswanathan, S. P.; Ryzhyk, L.; Sagiv, M.; and Walsh, T. 2018. Verifying Properties of Binarized Deep Neural Networks. In Proc. of AAAI’18, 6615–6624.
[4]
Ignatiev, A.; Narodytska, N.; and Marques-Silva, J. 2019. Abduction-Based Explanations for Machine Learning Models. In Proceedings of the Thirty-Third Conference on Artificial Intelligence (AAAI), 1511–1519.
[5]
Chan, H.; and Darwiche, A. 2003. Reasoning about Bayesian Network Classifiers. In UAI, 107–115. Morgan Kaufmann.
[6]
Shih, A.; Choi, A.; and Darwiche, A. 2018. A Symbolic Approach to Explaining Bayesian Network Classifiers. In IJCAI, 5103–5111. ijcai.org.
[7]
Shih, A.; Choi, A.; and Darwiche, A. 2019. Compiling Bayesian Network Classifiers into Decision Graphs. In AAAI, 7966–7974. AAAI Press.
[8]
Shi, W.; Shih, A.; Darwiche, A.; and Choi, A. 2020. On Tractable Representations of Binary Neural Networks. In KR, 882–892.
[9]
Audemard, G.; Koriche, F.; and Marquis, P. 2020. On Tractable XAI Queries based on Compiled Representations. In KR, 838–849.
[10]
Huang, X.; Izza, Y.; Ignatiev, A.; Cooper, M. C.; Asher, N.; and Marques-Silva, J. 2021. Efficient Explanations for Knowledge Compilation Languages. CoRR, abs/2107.01654.
[11]
Choi, A.; Xue, Y.; and Darwiche, A. 2012. Same-decision probability: A confidence measure for threshold-based decisions. Int. J. Approx. Reason., 53(9): 1415–1428.
[12]
Wang, E.; Khosravi, P.; and den Broeck, G. V. 2021. Probabilistic Sufficient Explanations. In IJCAI, 3082–3088. ijcai.org.
[13]
Ignatiev, A.; Narodytska, N.; and Marques-Silva, J. 2019. On Validating, Repairing and Refining Heuristic ML Explanations. CoRR, abs/1907.02509.
[14]
Ignatiev, A.; Narodytska, N.; Asher, N.; and Marques-Silva, J. 2020. From Contrastive to Abductive Explanations and Back Again. In AI*IA, volume 12414 of Lecture Notes in Computer Science, 335–355. Springer.
[15]
Garfinkel, A. 1982. Forms of Explanation: Rethinking the Questions in Social Theory. British Journal for the Philosophy of Science, 33(4): 438–441.
[16]
Lewis, D. 1986. Causal Explanation. In Lewis, D., ed., Philosophical Papers Vol. Ii, 214–240. Oxford University Press.
[17]
Temple, D. 1988. The contrast theory of why-questions. Philosophy of Science, 55(1): 141–151.
[18]
Lipton, P. 1990. Contrastive Explanation. Royal Institute of Philosophy Supplement, 27: 247–266.
[19]
Wachter, S.; Mittelstadt, B. D.; and Russell, C. 2017. Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPR. CoRR, abs/1711.00399.
[20]
van der Waa, J.; Robeer, M.; van Diggelen, J.; Brinkhuis, M.; and Neerincx, M. 2018. Contrastive explanations with local foil trees. arXiv preprint arXiv:1806.07470.
[21]
Miller, T. 2019. Explanation in artificial intelligence: Insights from the social sciences. Artif. Intell., 267: 1–38.
[22]
Mittelstadt, B.; Russell, C.; and Wachter, S. 2019. Explaining Explanations in AI. Proceedings of the Conference on Fairness, Accountability, and Transparency.
[23]
Goyal, Y.; Wu, Z.; Ernst, J.; Batra, D.; Parikh, D.; and Lee, S. 2019. Counterfactual Visual Explanations. In Chaudhuri, K.; and Salakhutdinov, R., eds., Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, 2376–2384. PMLR.
[24]
Verma, S.; Dickerson, J.; and Hines, K. 2020. Counterfactual explanations for machine learning: A review. arXiv preprint arXiv:2010.10596.
[25]
Mothilal, R. K.; Sharma, A.; and Tan, C. 2020. Explaining machine learning classifiers through diverse counterfactual explanations. Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency.
[26]
Darwiche, A.; and Hirth, A. 2020. On the Reasons Behind Decisions. In ECAI, volume 325 of Frontiers in Artificial Intelligence and Applications, 712–720. IOS Press.
[27]
Darwiche, A.; and Marquis, P. 2021. On Quantifying Literals in Boolean Logic and Its Applications to Explainable AI. J. Artif. Intell. Res., 72: 285–328.
[28]
Choi, A.; Shih, A.; Goyanka, A.; and Darwiche, A. 2020. On Symbolically Encoding the Behavior of Random Forests. CoRR, abs/2007.01493.
[29]
Gergov, J.; and Meinel, C. 1994. Efficient Boolean Manipulation With OBDD’s can be Extended to FBDD’s. IEEE Trans. Computers, 43(10): 1197–1209.
[30]
Bryant, R. E. 1986. Graph-Based Algorithms for Boolean Function Manipulation. IEEE Trans. Computers, 35(8): 677–691.
[31]
Darwiche, A. 2011. New Canonical Representation of Propositional Knowledge Bases. In IJCAI, 819–826. IJCAI/AAAI.
[32]
Huang, J.; and Darwiche, A. 2007. The Language of Search. J. Artif. Intell. Res., 29: 191–219.
[33]
Beame, P.; Li, J.; Roy, S.; and Suciu, D. 2013. Lower Bounds for Exact Model Counting and Applications in Probabilistic Databases. In UAI. AUAI Press.
[34]
Beame, P.; and Liew, V. 2015. New Limits for Knowledge Compilation and Applications to Exact Model Counting. In UAI, 131–140. AUAI Press.
[35]
Bollig, B.; and Buttkus, M. 2019. On the Relative Succinctness of Sentential Decision Diagrams. Theory Comput. Syst., 63(6): 1250–1277.
[36]
Bova, S. 2016. SDDs Are Exponentially More Succinct than OBDDs. In AAAI, 929–935. AAAI Press.
[37]
Crama, Y.; and Hammer, P. L. 2011. Boolean Functions - Theory, Algorithms, and Applications, volume 142 of Encyclopedia of mathematics and its applications. Cambridge University Press.
[38]
Huang, X.; Izza, Y.; Ignatiev, A.; and Marques-Silva, J. 2021. On Efficiently Explaining Graph-Based Classifiers. CoRR, abs/2106.01350.
[39]
Audemard, G.; Bellart, S.; Bounia, L.; Koriche, F.; Lagniez, J.-M.; and Marquis, P. 2021. On the Explanatory Power of Decision Trees. CoRR, https://arxiv.org/pdf/2108.05266.pdf.
[40]
Barceló, P.; Monet, M.; Pérez, J.; and Subercaseaux, B. 2020. Model Interpretability through the lens of Computational Complexity. In NeurIPS.
[41]
Vanschoren, J.; van Rijn, J. N.; Bischl, B.; and Torgo, L. 2013. OpenML: Networked Science in Machine Learning. SIGKDD Explorations, 15(2): 49–60.
[42]
Shih, A.; Choi, A.; and Darwiche, A. 2018. Formal Verification of Bayesian Network Classifiers. In PGM, volume 72 of Proceedings of Machine Learning Research, 427–438. PMLR.
[43]
Frank, E.; Hall, M. A.; Holmes, G.; Kirkby, R.; Pfahringer, B.; Witten, I. H.; and Trigg, L. 2010. Weka-A Machine Learning Workbench for Data Mining. In Data Mining and Knowledge Discovery Handbook, 1269–1277. Springer.
[44]
Quinlan, R. 1993. C4.5: Programs for Machine Learning. San Mateo, CA: Morgan Kaufmann Publishers.

  1. See, e.g., [2], [11], [12] for some approaches that can be viewed as approximating sufficient reasons and [13] for a study of the quality of some of these approximations.↩︎

  2. There is an extensive body of work in philosophy, social science and AI that discusses contrastive explanations and counterfactual explanations; see, e.g., [15][25]. While the definitions of these notions are sometimes variations or refinements on one another, they are not always compatible.↩︎

  3. [26] introduced two linear-time operations on Decision-DNNFs: consensus and filtering. These operations implement universal literal quantification as shown in [27]. Decision-DNNFs are \(\wedge\)-decomposable NNFs in which disjunctions have the form \((x \wedge \alpha) \vee ({\bar{x}} \wedge \beta)\).↩︎

  4. One can compute the prime implicates of a monotone NNF by simply converting it to a CNF and then removing subsumed clauses. Similarly, one can compute the prime implicants of a monotone NNF by converting it to a DNF and removing subsumed terms. See, e.g., [37].↩︎

  5. More precisely, nris Algorithm [alg:snr] with two exceptions. First, the NNF is not pruned on Line [snr:ln:and] so the union is over all \(\alpha_i\). Second, subsumption checking is applied after Line [snr:ln:and] to ensure that all computed implicates are subset-minimal.↩︎