# A Simple Convolutional Neural Network with Rule Extraction
## 3 Proposed Model
### The Interpretable CNN Architecture  
The interpretable CNN architecture used in this work is illustrated in Table 2. Its layers are: I-C-M-H-O, with a DIMLP subnetwork included in layers M-H-O. Rule extraction is performed after the training of a CNN with layers I-C-M-O. Note that the CNN with layers I-C-M-H-O is not trained. Specifically, the weight matrix between layers M and O of the trained CNN is transferred to layers H and O of the CNN with layers I-C-M-H-O. Because of the Identity function between M and H, network I-C-M-H-O approximates network I-C-M-O to an arbitrary precision that depends on the number of stairs of the staircase activation function. Hence, rules can be generated from the DIMLP subnetwork. Yet, rule antecedents are related to layer M representing filter values. From that layer, discriminative combinations of words represented in the input layer have to be determined (see below). Figure 6 depicts an example going from a tweet to a rule. First, each word of a sentence is provided to the input layer as horizontal vectors of numbers. Subsequently, these vectors are convolved by the convolutional layer; note that each rectangle on this layer represents a convolution filter. After convolution, the max-pooling layer takes over; its role is to simplify the processed data by retaining maximal values. From this layer to the output layer we have a DIMLP subnetwork. Hence, the extracted rule antecedents represent activation values of the the Max-Pooling layer. For clarity, those which are not represented in the rule at the bottom are left blank. Finally, the correspondence between antecedents and n-grams is shown at the bottom; the algorithm described below allows us to determine them. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Input** & **Conv.** & **Max-Pooling Layer** & **DIMLP Hid. Layer** & **Output** \\ \hline I & C = (C1, C2, C3) & M & H & O \\ \(59\times 300\) & \(1\times 300\times 40\) \(2\times 300\times 40\) \(3\times 300\times 40\) & 120 & 120 & 2 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Interpretable CNN architecture with symbols and sizes. Generally, many rule extraction techniques generate ordered rules, which means that rules are given in a sequential order, with two consecutive rules linked by an \"else\" statement. A long list of ordered rules involve many implicit antecedents that makes the interpretation difficult. Rules generated from the DIMLP subnetwork (M-H-O) are unordered. With this type of rules, the \"else\" statement is absent. Thus, each rule is considered as a single piece of knowledge that can be examined in isolation [38]. Each rule antecedent related to the max-pooling layer is given as \(a<t\), or \(a\geq t\). Since a rule antecedent can be true with one or more n-grams in the input layer, it involves a disjunction of n-grams (one or more n-grams connected by a logical or). Nevertheless, for a given sample and with the use of the \"Max\" function in the M layer, a unique n-gram becomes dominant (the one with the highest activation). Before giving an algorithm that allows us to determine discriminative n-grams for a given sample, let us define several sets and variables:  
* \(G\): Set of n-Grams generated from a dataset;
* \(R\): Set of rules (with respect to layer M);
* \(R_{i}\): A rule in R;
* \(A_{ij}\): An antecedent in \(R_{i}\); specifically \(A_{ij}=(m_{j}<c_{ij})\) or \(A_{ij}=(m_{j}\geq c_{ij})\), with \(m_{j}\) designating a neuron in the M layer and \(c_{ij}\in\Re\);
* \(S_{k}\): A sample covered by \(R_{i}\);
* \(H\): Set of n-Grams generated from \(S_{k}\);
* \(\Gamma\): Set of sought discriminative n-grams \((\Gamma\subseteq H)\);
* \(act(. )\): The activation(s) of a specified neuron in layer M, with respect to one or more inputs in the input layer. It is worth noting that with this CNN architecture the activation of neuron \(m_{j}\) in the M layer depends solely on kernel \(K_{j}\) in the C layer.