## 2 Materials and Methods
### Polymorphic Pattern Representation with Convolutional Filters  
For the purpose of introducing knowledge to convolutional modules, a method for representing patterns, which are defined via regular expressions, employing convolutional filter parameters, was developed. Convolutional filters can be seen as pattern-detecting operators that produce the maximum output for inputs that match filters' weights. It is reasonable to use a cascade of simple filters arranged in conventional convolutional layers to provide a flexible representation of polymorphic patterns of arbitrary length. The first-layer filters could be designed to capture different short patterns that comply with \begin{table}
\begin{tabular}{c c} \hline
**Pattern** & \(m\) \\ \hline \(AAAAAA\) & 0.0002 \\ \(AA\_AA\) & 0.004 \\ \(CC\_[ACT]\_C\) & 0.012 \\ \([ACT]\_...T\) & 0.19 \\ \hline \end{tabular}
\end{table} 
Table 1: Examples of six-element patterns generated from a four-element alphabet and their corresponding \(m\) measures: \(\cdot^{\prime}\) stands for any alphabet element, and \([xy]\) denotes any element of the subset \(\{x,y\}\). Figure 2: Sample regular expressions (top) and a string of symbols comprising the produced polymorphic patterns (bottom) with matches highlighted in the corresponding colors. The symbols ‘()’, ‘(\(\mid\)’, \(\cdot\)’, and ‘\(\mid\)’ denote subsequence repetitions, a set of characters, any character, and an alternative, respectively. The only pattern overlap is highlighted in brown. local rules defined by a given regular expression, whereas subsequent layers could combine these short chunks into longer strings in accordance with the considered rules. The simplicity of defining filter cascades that specialize in detecting specific input patterns enables the simple incorporation of initial knowledge into a structure of convolutional neural networks. For example, to represent patterns generated by the provided sample regular expression provided in Figure 3, the first layer filters need to have a receptive field of size \(w=3\times h=1\times d=4\), where the adopted width (\(w\)) enables capturing three-element strings and the adopted depth (\(d\)) reflects one-hot encoding used for the considered four-letter alphabet (height--i.e., \(h\)--is set to unity as the one-dimensional input is considered). To match symbol-generating rules used by a regex, three different values can be assigned to each weight of a filter. If some symbol is encouraged at a given position of a string, the corresponding filter's weight is set to a value of '1'; if it is forbidden, the corresponding weight is set to '\(-1\)'. Otherwise, the weight is set to '0' if it is neither encouraged nor forbidden. The second-layer filters that merge short segments detected by first-layer filters into the longer chunks require a depth that enables integrating all relevant first-layer detectors. For the example presented in Figure 3, the required depth d = 2 allows for combining results produced by the two three-symbol string detectors (two first-layer filters), into a six-element string detector. The span of the receptive field in the second-layer filters must enable seamless string-stitching, which can be achieved by ensuring sufficient filter width (as shown in Figure 3) or by employing appropriate weight dilation. The rules for setting second-layer filters' weights, which transform outputs of first-layer filters, are the same as presented for the first-layer filters. The method can be scaled both in terms of the number and size of patterns, as well as in terms of rule complexity, by adding new layers of filters. It should be emphasized that the size of filters does not define the exact length of the pattern but only constrains its maximum length, as the proposed methodology allows for patterns that contain any character at each position, including the ends. Therefore, shorter patterns can be injected by filling the trailing positions with 'zeros' (any symbol is allowed).