## 1 Introduction  
Recent trends in machine learning indicate an emerging need for methods and models capable of incorporating explicitly formulated knowledge. This is especially important when training data are scarce and a shortage of available information needs to be compensated for with other means. The integration of knowledge and learning is crucial for enabling progress in several challenging domains, such as in the field of medical research and, in particular, in motif detection [1]. Motif detection is one of the most challenging tasks in data analysis due to the polymorphic nature of patterns that can encode genomic information and the scarcity of data, which severely impairs learning feasibility. The present paper is concerned with research on the detection of polymorphic patterns in sequences by utilizing prior knowledge to facilitate this difficult task. The polymorphic sequences considered in this paper are sequences generated by regular expressions with flexible rules, resulting in a high diversity of valid, alternative sequence instances. A particular research question that we attempted to address was the following: having a set of sequences, each comprising several polymorphic patterns, where some of these match known flexible rules (defined via regular expressions), is it possible to determine the presence of previously unknown ones? In what follows, we present a method that enables polymorphic pattern detection in sequences. The key elements of the proposed method are the integration of learning with prior knowledge and the introduction of mechanisms that discourage the learning of concepts that are already known. We assumed that polymorphic pattern-describingrules can be, at least partially, represented as filter cascades of a convolutional neural network. To discourage the learning of known patterns, we defined an appropriate loss component that evaluates the similarity of filter-represented pattern detectors and used this information to guide training. We evaluated the method on a dataset extracted from human genome data and showed that it enabled the statistically significant detection of unknown polymorphic patterns. A significant amount of research has been carried out so far on handling the problem of detecting patterns (motifs) in sequences, among which we can name methods that aim to disentangle patterns to be recognized by convolutional neural networks. [PERSON] et al. [2] proposed a training method for classification models that makes convolutional filters class-specific. They used an additional mask that assigned filters to classes and, then, in two-phase training, optimized that mask. Although this was an interesting approach, its main contribution was the disentanglement of knowledge by minimizing the number of filters sharing class-specific knowledge, thus making a step towards better interpretability. However, it did not expand upon the internal representation of said knowledge. [PERSON] et al. [3] examined representations of genomic motifs in CNNs. They searched for motifs in first-layer convolutional filters, transforming them into position-weight matrices based on the filter's response to specific samples. This work exemplified a common approach in the representation of genomic patterns in filters of convolutional networks. It should be emphasized that this approach focuses on one-layer representation, which constrains the complexity and in-place interaction analysis between the discovered patterns. [PERSON] et al. [4] proposed a method for updating a specific subfilter cascade chosen dynamically during training to produce more diverse convolutional filters and reduce overlap in representation. A more general examination of this problem found solutions like structuring a network to resemble the knowledge base, which could be achieved either manually [5] or through a training process [6]. In the case of relational neural machines (RNMs) [7], knowledge is provided through optimization constraints, thus being a part of the parametric regularization and not the learner structure.