## 2 Materials and Methods
### Regular Expression Reconstruction  
To search for unknown polymorphic patterns that are embedded in sequences comprising runs of random symbols together with known, possibly polymorphic strings, we initialize our algorithm with knowledge provided in the form of a cascade of appropriately preset filters, as explained in the previous subsection. Several additional filters with parameters to be learned from data are also placed in convolutional layers of the proposed algorithm to detect unknown patterns. A structure of the convolutional pattern detectors can be bundled in the form of the position-weight tensor \(R\)[22] of the following form:  
\[R=\left[\left[\begin{array}{cccc}\left[ \begin{array}{cccc}\theta_{11A}& \theta_{12A}&\theta_{13A}\\ \theta_{11C}&\theta_{12C}&\theta_{13C}\\ \theta_{11G}&\theta_{12G}&\theta_{13G}\\ \theta_{11T}&\theta_{12T}&\theta_{13T}\\ \vdots\\ \left[\begin{array}{cccc}\theta_{n1A}&\theta_{n2A}&\theta_{n3A}\\ \theta_{n1C}&\theta_{n2C}&\theta_{n3C}\\ \theta_{n1G}&\theta_{n2G}&\theta_{n3C}\\ \theta_{n1T}&\theta_{n2T}&\theta_{n3T}\\ \end{array}\right]\end{array} \right]\odot\left[ \begin{array}{cccc}\gamma_{1, 1}\\ \gamma_{1,2}\\ \gamma_{1,3}\\ \vdots\\ \left[\begin{array}{cccc}\theta_{n1A}&\theta_{n2A}&\theta_{n3A}\\ \theta_{n1C}&\theta_{n2C}&\theta_{n3C}\\ \theta_{n1G}&\theta_{n2G}&\theta_{n3C}\\ \theta_{n1T}&\theta_{n2T}&\theta_{n3T}\\ \end{array}\right]\end{array} \right]\odot\left[ \begin{array}{cccc}\gamma_{m,1}\\ \gamma_{m,2}\\ \gamma_{m,3}\\ \vdots\\ \left[\begin{array}{cccc}\theta_{n1A}&\theta_{n2A}&\theta_{n3A}\\ \theta_{n1C}&\theta_{n2C}&\theta_{n3C}\\ \theta_{n1G}&\theta_{n2G}&\theta_{n3G}\\ \theta_{n1T}&\theta_{n2T}&\theta_{n3T}\\ \end{array}\right]\end{array} \right]\odot\left[ \begin{array}{cccc}\gamma_{m,2}\\ \gamma_{m,3}\\ \vdots\\ \gamma_{m,n-2}\\ \gamma_{m,n-1}\\ \gamma_{m,n}\end{array} \right] \tag{2}\]  
\(\theta_{xyz}\) a value in \(x^{th}\) filter, \(y^{th}\) position, and \(z^{th}\) channel of \(1^{st}\) layer \(\gamma_{x,y}\) a value in \(x^{th}\) position, \(y^{th}\) channel of \(2^{nd}\) layer filter  
where the symbol \(\odot\) denotes component-wise multiplication, i.e.,  
\[\left[ \begin{array}{cccc}\theta_{11A}&\theta_{12A}&\theta_{13A}\\ \theta_{11C}&\theta_{12C}&\theta_{13C}\\ \theta_{11G}&\theta_{12G}&\theta_{13G}\\ \theta_{11T}&\theta_{12T}&\theta_{13T}\\ \theta_{21A}&\theta_{22A}&\theta_{23A}\\ \theta_{21C}&\theta_{22C}&\theta_{23C}\\ \theta_{21G}&\theta_{22G}&\theta_{23G}\\ \theta_{21T}&\theta_{22T}&\theta_{23T}\\ \vdots\end{array} \right]\odot\left[ \begin{array}{cccc}\gamma_{1}\\ \gamma_{2}\\ \vdots\\ \end{array} \right]=\left[ \begin{array}{cccc}\theta_{1}\\ \theta_{2}\\ \vdots\\ \end{array} \right]\odot\left[ \begin{array}{cccc}\gamma_{1}\\ \gamma_{2}\\ \vdots\\ \end{array} \right]=\left[ \begin{array}{cccc}\gamma_{1}\theta_{1}\\ \gamma_{2}\\ \vdots\\ \end{array} \right] \tag{3}\]  
The first-layer filters \(1..,i...n\), with weights arranged into matrices \(\theta_{i}\) are combined by the second-layer ones (from 1 through \(m\)), with entries \(\gamma_{i,j}\). The constructed PWM provides a basis for identifying a regular expression that emerges from the weights of a trained network. The reconstruction follows the scheme provided in Equation (4), which involves weight normalization, aimed at converting learned weights into probabilities (transformation of R into R\") followed by thresholding, which is expected to produce an unambiguous basis for the reconstruction of the detected regular expression. Here, the symbols \(U\) and \(W\) denote the position-wise minimum of R and the position-wise sum of R\", respectively. \[R^{\prime}=R+2*|U|\quad\text{where}\quad U_{i}=\min_{j\in I}R_{ij},\ i=1,2...n\]  
\[R^{\prime\prime}=R^{\prime}/W\quad\text{where}\quad W_{i}=\sum_{j\in I}R^{ \prime}_{ij},\ i=1,2...n\]  
\[R^{\prime\prime\prime}=f(R^{\prime\prime})\quad\text{where}\quad f(r_{ij})= \left\{ \begin{array}{ll}1&r_{ij}>th_{upper}\\ -1&r_{ij}<th_{lower}\\ 0&\text{otherwise}\end{array} \right.