## 4 Discussion  
In this work, a general method for adaptive detection and reinforcement is introduced. We call it TOREADA (from TOpological REinforcement Detection Algorithm) and we explain here, in short, the role of the term \"topology\". In addition to the formal description in Section 2, a more intuitive insight might be helpful. Our major assumption, or axiom, is that the events that are to be detected form upon appropriate parameterization of a connected continuous manifold. An ad hoc detector setting, or the detection manifold, may partially cover the \"true\" event manifold, therefore resulting in false positive (FP) detections and false negative (FN) detections in the detected nonevents and the undetected true events, correspondingly. Therefore, the reinforcement process, or learning paradigm, is associated with deforming the detection manifold so that it can possibly cover as precisely as possible the true event manifold. To do so, two complimentary transformations are introduced: embedding and envelope. The embedding step expands the detection manifold to an \"embedding\" one that contains the former. All events that fall into the larger, embedding manifold form the training set of events. In this way, if the detector is not initially detecting certain true events, they may still fall into the training set. The second stage constructs an envelope around all classified true positive events. This step will form a \"tighter\" manifold within the embedding one that will possibly help to reject false positive detections. Finally, the envelope manifold is taken as the new, updated detection manifold. Subsequently, the process is iteratively repeated according to the appropriate schedule. Figure 11: Statistical distributions of sensitivity (the **left** column of the plots) and specificity (the **right** column of the plots) for the same data as shown in Figure 10. Vertical axes represent the quantities; the labels on the horizontal axes indicate the various maximal seizure lengths. The boxplot features are the same as those of Figure 6.  
The two steps of embedding and envelope forming are by far not unique. Taking a too-wide embedding manifold around the current detection one, for example, may speed up the process of reducing the FN events, but at the same time it may introduce too many FP events, which would make the assessment of the true events quite complicated. A very tight envelope may reduce the FP detections but may also counteract the embedding process and, consequently, slow down the reduction in undetected true events. We also left outside the scope of this work the procedure of validating the detected events. Here, both supervised and automated labeling are possible, using for the latter the clustering algorithm, as proposed, for example, in our previous work [11]. Including this form of automated validation into the simulation tests will be a subject of our future research. Another extension of the current work may involve simulation of the optical flow output signals and not just the resulting epistactor. This provides the possibility of testing our real-world adaptive algorithm, also presented in [11], that also involves the adaptive reinforcement of the frequency interval relevant for the particular seizure-generating system. We remind the reader that our objective here was to concentrate on the steps described by Equations (5) and (6). Another hypothesis used here is that seizure events are characterized by an epimarker that, during a seizure, takes values from a different distribution than during \"normal\" periods. More specifically, we assumed that the ictal distribution favors higher values. As this is a highly nonparametric assumption, we implemented the simulation model with a couple of thresholds and couple of probabilities in order to explore various levels of separation between the states. In a more general scenario, the epimarker may define a seizure event not by its value but by some features of its distribution statistics.