Scalable Rule-Based Representation Learning for Interpretable Classification

1 Introduction . Although Deep Neural Networks ( DNNs ) have achieved impressive results in various machine learning tasks ( Goodfellow et al. , 2016 ) , rule-based models , benefiting from their transparent inner structures and good model expressivity , still play an important role in domains demanding high model interpretability , such as medicine , finance , and politics ( Doshi-Velez and Kim , 2017 ) . In practice , rule-based models can easily provide explanations for users to earn their trust and help protect their rights ( Molnar , 2019 ; Lipton , 2016 ) . By analyzing the learned rules , practitioners can understand the decision mechanism of models and use their knowledge to improve or debug the models ( Chu et al. , 2018 ) . Moreover , even if post-hoc methods can provide interpretations for DNNs , the interpretations from rule-based models are more faithful and specific ( Murdoch et al. , 2019 ) . However , conventional rule-based models are hard to optimize , especially on large data sets , due to their discrete parameters and structures , which limit their application scope . To take advantage of rule-based models in more scenarios , we urgently need to answer such a question : how to improve the scalability of rule-based models while keeping their interpretability ? ∗Corresponding authors . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . Studies in recent years provide some solutions to improve conventional rule-based models in different aspects . Ensemble methods and soft/fuzzy rules are proposed to improve the performance and scalability of rule-based models but at the cost of model interpretability ( Ke et al. , 2017 ; Breiman , 2001 ; Irsoy et al. , 2012 ) . Bayesian frameworks are also leveraged to more reasonably restrict and adjust the structures of rule-based models ( Letham et al. , 2015 ; Wang et al. , 2017 ; Yang et al. , 2017 ) . However , due to the non-differentiable model structure , they have to use methods like MCMC or Simulated Annealing , which could be time-consuming for large models . Another way to improve rule-based models is to let a high-performance but complex model ( e.g. , DNN ) teach a rule-based model ( Frosst and Hinton , 2017 ; Ribeiro et al. , 2016 ) . However , learning from a complex model requires soft rules , or the fidelity of the student model is not guaranteed . The recent study Wang et al . ( 2020 ) tries to extract hierarchical rule sets from a tailored neural network . When the network is large , the extracted rules could behave quite differently from the neural network and become useless in most cases . Nevertheless , combined with binarized networks ( Courbariaux et al. , 2015 ) , it inspires us that we can search for the discrete solutions of interpretable rule-based models in a continuous space leveraging effective optimization methods like gradient descent . In this paper , we propose a novel rule-based model named Rule-based Representation Learner ( RRL ) ( see Figure 1a ) . We summarize the key contributions as follows : • To achieve good model transparency and expressivity , RRL is formulated as a hierarchical model , with layers supporting automatic feature discretization , rule-based representation learning in flexible conjunctive and disjunctive normal forms , and rule importance evaluation . • To facilitate training effectiveness , RRL exploits a novel gradient-based discrete model training method , Gradient Grafting , that directly optimizes the discrete model and uses the gradient information at both continuous and discrete parametric points to accommodate more scenarios . • To ensure data scalability , RRL utilizes improved logical activation functions to handle highdimensional features . By further combining the improved logical activation functions with a tailored feature binarization layer , it realizes the continuous feature discretization end-to-end . • We conduct experiments on nine small data sets and four large data sets to validate the advantages , i.e. , good accuracy and interpretability , of our model over other representative classification models . The benefits of the model ’ s key components are also verified by the experiments . 2 Related Work . Rule-based Models . Decision tree , rule list , and rule set are the widely used structures in rule-based models . For their discrete parameters and non-differentiable structures , we have to train them by employing various heuristic methods ( Quinlan , 1993 ; Breiman , 2017 ; Cohen , 1995 ; Wei et al. , 2019 ) , which may not find the globally best solution or a solution with close performance . Alternatively , train them with search algorithms ( Wang et al. , 2017 ; Angelino et al. , 2017 ; Lin et al. , 2020 ) , which could take too much time on large data sets . In recent studies , Bayesian frameworks are leveraged to restrict and adjust model structure more reasonably ( Letham et al. , 2015 ; Wang et al. , 2017 ; Yang et al. , 2017 ) . Lakkaraju et al . ( 2016 ) learns independent if-then rules with smooth local search . However , except for heuristic methods , most existing rule-based models need frequent itemsets mining and/or long-time searching , which limits their applications . Moreover , it is hard for these rule-based models to get comparable performance with complex models like Random Forest . Ensemble models like Random Forest ( Breiman , 2001 ) and Gradient Boosted Decision Trees ( Chen and Guestrin , 2016 ; Ke et al. , 2017 ) have better performance than the single rule-based model . However , since the decision is made by hundreds of models , ensemble models are commonly not considered as interpretable models ( Hara and Hayashi , 2016 ) . Soft or fuzzy rules are also used to improve model performance ( Irsoy et al. , 2012 ; Ishibuchi and Yamamoto , 2005 ) , but non-discrete rules are much harder to understand than discrete ones . Deep Neural Decision Tree ( Yang et al. , 2018 ) is a tree model realized by neural networks with the help of soft binning function and Kronecker product . However , due to the use of Kronecker product , it is not scalable with respect to the number of features . Other studies try to teach the rule-based model by a complex model , e.g. , DNN , or extract rule-based models from complex models ( Frosst and Hinton , 2017 ; Ribeiro et al. , 2016 ; Wang et al. , 2020 ) . However , the fidelity of the student model or extracted model is not guaranteed . Gradient-based Discrete Model Training . The gradient-based discrete model training methods are mainly proposed to train binary or quantized neural networks for network compression and acceleration . Courbariaux et al . ( 2015 , 2016 ) propose to use the Straight-Through Estimator ( STE ) for binary neural network training . However , STE requires gradient information at discrete points , which limits its applications . ProxQuant ( Bai et al. , 2018 ) formulates quantized network training as a regularized learning problem and optimizes it via the prox-gradient method . ProxQuant can use gradients at non-discrete points but can not directly optimize for the discrete model . The RB method ( Wang et al. , 2020 ) trains a neural network with random binarization for its weights to ensure the discrete and the continuous model behave similarly . However , when the model is large , the differences between the discrete and the continuous model are inevitable . Gumbel-Softmax estimator ( Jang et al. , 2016 ) generates a categorical distribution with a differentiable sample . However , it can hardly deal with a large number of variables , e.g. , the weights of binary networks , for it is a biased estimator . Our method , i.e. , Gradient Grafting , is different from all the aforementioned works in using gradient information of both discrete and continuous models in each backpropagation . 3 Rule-based Representation Learner . Notation Description . Let D = { ( X1 , Y1 ) , . . . , ( XN , YN ) } denote the training data set with N instances , where Xi is the observed feature vector of the i-th instance with the j-th entry as Xi , j , and Yi is the corresponding one-hot class label vector , i ∈ { 1 , . . . , N } . Each feature value can be either discrete or continuous . All the classes take discrete values , and the number of class labels is denoted by M . We use one-hot encoding to represent all discrete features as binary features . Let Ci ∈ Rm and Bi ∈ { 0 , 1 } b denote the continuous feature vector and the binary feature vector of the i-th instance respectively . Therefore , Xi = Ci ⊕Bi , where ⊕ represents the operator that concatenates two vectors . Throughout this paper , we use 1 ( True ) and 0 ( False ) to represent the two states of a Boolean variable . Thus each dimension of a binary feature vector corresponds to a Boolean variable . Overall Structure . A Rule-based Representation Learner ( RRL ) , denoted by F , is a hierarchical model consisting of three different types of layers . Each layer in RRL not only contains a specific number of nodes but also has trainable edges connected with its previous layer . Let U ( l ) denote the l-th layer of RRL , u ( l ) j indicate the j-th node in the layer , and nl represent the corresponding number of nodes , l ∈ { 0 , . . . , L } . The output of the l-th layer is a vector containing the values of all the nodes in the layer . For ease of expression , we denote this vector by u ( l ) . There are only one binarization layer , i.e. , U ( 0 ) , and one linear layer , i.e. , U ( L ) , in RRL , but the number of middle layers , i.e. , logical layers , can be flexibly adjusted according to the specific situation . The logical layers mainly aim to learn the non-linear part of the data , while the linear layer aims to learn the linear part . One example of RRL is shown in Figure 1a . When we input the i-th instance to RRL , the binarization layer will first binarize the continuous feature vector Ci into a new binary vector C̄i . Then , C̄i and Bi are concatenated together as u ( 0 ) and inputted to the first logical layer . The logical layers are designed to automatically learn data representations using logical rules , and the stacked logical layers can learn rules in more complex forms . After going through all the logical layers , the output of the last logical layer can be considered as the new feature vector to represent the instance , wherein each feature corresponds to one rule formulated by the original features . As such , the whole RRL is composed of a feature learner and a linear classifier ( linear layer ) . Moreover , the skip connections in RRL can skip unnecessary logical layers . In what follows , the details of these components will be elaborated . 3.1 Logical Layer . Considering the binarization layer needs the help of its following logical layer to binarize features in an end-to-end way , we introduce logical layers first . As mentioned above , logical layers can learn data representations using logical rules automatically . To achieve this , logical layers are designed to have a discrete version and a continuous version . The discrete version is used for training , testing and interpretation while the continuous version is only used for training . It is worth noting that the discrete RRL indicates the parameter weights of logical layers take discrete values ( i.e. , 0 or 1 ) while the parameter weights and biases of the linear layer still take continuous values . Discrete Version . One logical layer consists of one conjunction layer and one disjunction layer . In discrete version , let R ( l ) and S ( l ) denote the conjunction and disjunction layer of U ( l ) ( l ∈ { 1 , 2 , . . . , L − 1 } ) respectively . We denote the i-th node in R ( l ) by r ( l ) i , and the i-th node in S ( l ) by s ( l ) i . Specifically speaking , node r ( l ) i corresponds to the conjunction of nodes in the previous layer connected with r ( l ) i , while node s ( l ) i corresponds to the disjunction of nodes in previous layer connected with s ( l ) i . Formally , the two types of nodes are defined as follows : r ( l ) i = ∧ W ( l,0 ) i , j =1 u ( l−1 ) j , s ( l ) i = ∨ W ( l,1 ) i , j =1 u ( l−1 ) j , ( 1 ) where W ( l,0 ) denote the adjacency matrix of the conjunction layerR ( l ) and the previous layer U ( l−1 ) , and W ( l,0 ) i , j ∈ { 0 , 1 } . W ( l,0 ) i , j = 1 indicates there exists an edge connecting r ( l ) i to u ( l−1 ) j , otherwise W ( l,0 ) i , j = 0 . Similarly , W ( l,1 ) is the adjacency matrix of the disjunction layer S ( l ) and U ( l−1 ) . Similar to neural networks , we regard these adjacency matrices as the weight matrices of logical layers . u ( l ) = r ( l ) ⊕ s ( l ) , where r ( l ) and s ( l ) are the outputs ofR ( l ) and S ( l ) respectively . The function of the logical layer is similar to the notion “ level ” in Wang et al . ( 2020 ) . However , one level in that work , which actually consists of two layers , can only represent rules in Disjunctive Normal Form ( DNF ) , while two logical layers in RRL can represent rules in DNF and Conjunctive Normal Form ( CNF ) at the same time . Connecting nodes inR ( l ) with nodes in S ( l−1 ) , we get rules in CNF , while connecting nodes in S ( l ) with nodes inR ( l−1 ) , we get rules in DNF . The flexibility of logical layer is quite important . For instance , the length of CNF rule ( a1 ∨a2 ) ∧ · · · ∧ ( a2n−1 ∨a2n ) is 2n , but the length of its corresponding DNF rule ( a1 ∧a3 · · · ∧a2n−1 ) ∨ · · · ∨ ( a2 ∧a4 · · · ∧a2n ) is n · 2n , which means layers that only represent DNF can hardly learn this CNF rule . Continuous Version . Although the discrete logical layers have good interpretability , they are hard to train for their discrete parameters and non-differentiable structures . Inspired by the training process of binary neural networks that searches the discrete solution in a continuous space , we extend the discrete logical layer to a continuous version . The continuous version is differentiable , and when we discretize the parameters of a continuous logical layer , we can obtain its corresponding discrete logical layer . Therefore , the continuous logical layer and its corresponding discrete logical layer can also be considered as sharing the same parameters , but the discrete logical layer needs to discretize the parameters first . Let Û ( l ) denote the continuous logical layer , and R̂ ( l ) and Ŝ ( l ) denote the continuous conjunction and disjunction layer respectively , l ∈ { 1 , 2 , . . . , L− 1 } . Let Ŵ ( l,0 ) and Ŵ ( l,1 ) denote the weight matrices of R̂ ( l ) and Ŝ ( l ) respectively . Ŵ ( l,0 ) i , j , Ŵ ( l,1 ) i , j ∈ [ 0 , 1 ] . To make the whole Equation 1 differentiable , we leverage the logical activation functions proposed by Payani and Fekri ( 2019 ) : Conj ( h , Wi ) = n∏ j=1 Fc ( hj , Wi , j ) , Disj ( h , Wi ) = 1− n∏ j=1 ( 1− Fd ( hj , Wi , j ) ) , ( 2 ) where Fc ( h , w ) = 1− w ( 1− h ) and Fd ( h , w ) = h · w. In Equation 2 , if h and Wi are both binary vectors , then Conj ( h , Wi ) = ∧ Wi , j=1 hj and Disj ( h , Wi ) = ∨ Wi , j=1 hj . Fc ( h , w ) and Fd ( h , w ) decide how much hj would affect the operation according to Wi , j . If Wi , j = 0 , hj would have no effect on the operation . Equation 2 can be considered as extensions to t-norm fuzzy logic ( Hájek , 2013 ) . After using continuous weights and logical activation functions , the nodes in R̂ ( l ) and Ŝ ( l ) are defined as follows : r̂ ( l ) i = Conj ( û ( l−1 ) , Ŵ ( l,0 ) i ) , ŝ ( l ) i = Disj ( û ( l−1 ) , Ŵ ( l,1 ) i ) ( 3 ) Now the whole logical layer is differentiable and can be trained by gradient descent . However , the above logical activation functions suffer from the serious vanishing gradient problem . The main reason can be found by analyzing the partial derivative of each node w.r.t . its directly connected weights and w.r.t . its directly connected nodes as follows : ∂r̂ ( l ) i ∂Ŵ ( l,0 ) i , j = ( û ( l−1 ) j −1 ) · ∏ k 6=j Fc ( û ( l−1 ) k , Ŵ ( l,0 ) i , k ) , ∂r̂ ( l ) i ∂û ( l−1 ) j = Ŵ ( l,0 ) i , j · ∏ k 6=j Fc ( û ( l−1 ) k , Ŵ ( l,0 ) i , k ) ( 4 ) Since û ( l−1 ) k and Ŵ ( l,0 ) i , k are in the range [ 0 , 1 ] , the values of Fc ( · ) in Equation 4 are in the range [ 0 , 1 ] as well . If nl−1 is large and most of the values of Fc ( · ) are not 1 , then the derivative is close to 0 due to the multiplications ( See Appendix D for the analysis of ŝ ( l ) i ) . Wang et al . ( 2020 ) tries to use weight initialization to make Fc ( · ) close to 1 at the beginning . However , when dealing with hundreds of features , the vanishing gradient problem is still inevitable . Improved Logical Activation Functions . We found that using the multiplications to simulate the logical operations in Equation 2 is the main reason for vanishing gradients and propose an improved design of logical activation functions . One straightforward idea is to convert multiplications into additions using logarithm , e.g. , log ( ∏n j=1 Fc ( hj , Wi , j ) ) = ∑n j=1 log ( Fc ( hj , Wi , j ) ) . However , after taking the logarithm , the logical activation functions in Equation 2 can not keep the characteristics of logical operations any more , and the ranges of Conj ( · ) and Disj ( · ) are not [ 0 , 1 ] . To deal with this problem , we need a projection function to fix it . Apparently , the inverse function of log ( x ) , i.e. , ex , is not suitable . For the projection function g , three conditions must be satisfied : ( i ) g ( 0 ) = e0 . ( ii ) limx→−∞ g ( x ) = limx→−∞ ex = 0 . ( iii ) limx→−∞ e x g ( x ) = 0 . Condition ( i ) and ( ii ) aim to keep the range and tendency of logical activation functions . Condition ( iii ) aims to lower the speed of approaching zero when x→ −∞ . In this work , we choose g ( x ) = −1−1+x as the projection function , and the improvement of logical activation functions can be summarized as the function P ( v ) = −1−1+log ( v ) . The improved conjunction function Conj+ and disjunction function Disj+ are given by : Conj+ ( h , Wi ) = P ( n∏ j=1 ( Fc ( hj , Wi , j ) + ) ) , Disj+ ( h , Wi ) = 1−P ( n∏ j=1 ( 1−Fd ( hj , Wi , j ) + ) ) ( 5 ) where is a small constant , e.g. , 10−10 . The improved logical activation functions can avoid the vanishing gradient problem in most scenarios and are much more scalable than the originals . Moreover , considering that dP ( v ) dv = P2 ( v ) v , when n in Equation 5 is extremely large , dP ( v ) dv may be very close to 0 due to P2 ( v ) . One trick to deal with it is replacing P 2 ( v ) v with P ( P2 ( v ) ) v for P can lower the speed of approaching 0 while keeping the value range and tendency .

Summary: The authors propose a new classifier - called Rule-based Representation Learner - that learns interpretable non-fuzzy rules. The model consists of 3 main modules:  - the binarization layer - the logical layer(s) - the linear layer.  Further, the authors propose a new training algorithm called Gradient Grafting. The model was tested tested on 13 datasets and compared with six interpretable models and five complex models.