For the training of the RF of 1000 trees, I randomly chose 75% of the data as teaching and the remaining 25% as validation dataset. Firstly, for training of the classification trees, I used all the variables and predictor importance using random oob permutation was calculated. Followingly, were classification trees retrained but using only variables with importance higher than 0.5. A validation dataset was tested and resulted with highly sub-ideal sensitivity of 30.4 % and precision 79.7 %. The variables scoring in variable importance higher than 0.5 are listed below:
o Relative harmonic intensity (2.-5. harmonic) o Event spectral profile
o SD wave to spike amplitude ratio o Approximate Entropy
o Average spike width at half-spike amplitude o Average ratio of wave to spike width at zero line o Average relative spike amplitude
o Average of ratio of:
Wave to spike width at half spike / Wave to spike zero width
40 o SD of ratio:
Wave to spike width at half spike / Wave to spike zero width
However, a look at the proximity matrix of the classification revealed an interesting distribution, where most of the annotated SWDs had very near proximity. Inspired by this, I created a new variable called proximity ratio. Proximity ratio can be expressed for each observation as an average proximity to 100 closest annotated SWDs divided by the average proximity to 500 closest annotated non-SWD candidates.
It can be seen from Figure 17 that annotated SWDs of the teaching dataset are not overlapping with the distribution of other candidates if outliers are excluded. The distribution of the validation dataset in Figure 18 is not that clear and SWDs are significantly overlapping with the other candidates. Both validation and teaching datasets have many outliers in non-SWD group.
Figure 17. Distribution of proximity ratio for teaching dataset. Class 1 states annotated SWDs and class 0 other candidates. Bottom distribution is zoomed from upper one.
Figure 18. Distribution of proximity ratio for testing dataset. Class 1 states annotated SWDs and class 0 other candidates. Bottom distribution is zoomed from upper one.
Next, I further investigated the significance of the results from the teaching dataset.
Every observation from non-SWD group scoring in proximity ratio above 0.3 was reevaluated. The results of this reevaluation are shown in Table 4. According to the judgement of one expert, most of the investigated observations from non-SWD group were actually SWDs. This raised a question on the accuracy of the manual annotation and the match between the experts. It is obvious that a lack of SWD definition leads to this problem and using judgement of only two experts is questionable.
Table 4. Observations scoring > 0.3 in proximity ratio. One expert reevaluated all ‘non-SWD’
candidates with proximity ratio > 0.3. In the table, the data split are into annotated SWDs (Gold standard) and ‘non-SWD’ (candidates that were previously judged as not SWD). The whole group of ‘non-SWD’ within the teaching dataset was re-judged by one expert as true SWDs.
Moreover, the expert also judged the majority of the ‘non-SWD’ observations within the validation dataset as true SWDs.
Validation dataset [%]
Without ‘non-SWD’ 100 77.4
With ‘non-SWD’ 100 85.7
Without ‘non-SWD’ 100 55.6
With ‘non-SWD’ 100 97.4
Precision (one expert judgement) 100 94.2
Amount 54 52
It has to be also acknowledged that RF classification trees were grown using obviously false annotation and this interesting result might be even improved. As RF method is random each time the trees are grown, they might use different decisions and variable importance might differ. Therefore, parameters that were used in the second RF are not definitive and might be corrected. As a result, this study offers the way to achieve correct classification results only if correct annotation is used.
6 Discussion and Conclusions
This study explored an option to classify SWD in the EEG of mice modeling human absence epilepsy using a variety of variables. The variables investigated were time and frequency scaled based on FFT and CWT. They introduced methods of both linear and non-linear dynamics. The variables were either relative or their thresholds were set only to exclude outliers in unphysiological range. Therefore, this approach should be valid for various EEG signals.
The data used were recorded on 9 different animals from 3 different age groups, which to my knowledge has not been done before. The EEG signal differs significantly not only from animal to animal but also due to age. Therefore, classification algorithm made for one set of similarly aged animals might not work for other groups.
The highest achieved sensitivity on the validation dataset was 85.7 % with 97.4 % precision. However, this was estimated using judgement of only one expert and further investigation is needed. In comparison, other studies, mentioned in section 2.3, reached sensitivity above 90 % with very low false positive rate. These studies performed their algorithms on rat EEG, which has significantly different SWDs lasting several seconds in average and are, therefore, also significantly easier to detect.
The proposed algorithm can work as semi-automatic tool requiring human input saving countless of hours by preselecting a small group of candidates sharing SWD-like features. However, this study failed to achieve completely automatic classification.
The lack of definition of the SWD is clearly the main reason for unsatisfactory results.
The proximity ratio showed very interesting distribution comparison and can surely be used in the future for precisely annotated data. For the further studies, each candidate event has to be split into overlapping 4-wave cuts and judged separately and the algorithm needs to be run again. This will ensure that the classification trees grown in RF are correct and include all the possible cases of the observations.
Any human expert can judge thousands of candidates two times in a row without producing matching results. Having bigger dataset, and especially, more experts
annotating the data is the only way to properly annotate SWDs. For the grey zone that has SWD-like features, but with no more than half of the experts agreeing on its classification, will be needed an on-line detection algorithm. A fully automatic algorithm detecting this SWD pattern on-line will allow presentation of immediate feedback, for instance a sound stimulus, to the mouse in an attempt to study the big question whether SWDs result in momentary loss of consciousness. A lack of behavioral or EEG response to the sound when a real SWD is present would speak for such a gap in consciousness.
 (19 September). Dementia. Available: https://www.who.int/news-room/fact-sheets/detail/dementia.
 N. Jin et al, "Increased cortical beta power and spike-wave discharges in middle-aged APP/PS1 mice," Neurobiol. Aging, vol. 71, pp. 127-141, 2018. DOI: S0197-4580(18)30260-4 [pii].
 E. Y. Sitnikova and van Luijtelaar, E. L. J. M, "Electroencephalographic Characterization of Spike-Wave Discharges in Cortex and Thalamus in WAG/Rij Rats," Epilepsia, vol. 48, (12), pp. 2296-2311, 2007. Available:
 J. J. Palop and L. Mucke, "Epilepsy and Cognitive Impairments in Alzheimer Disease," Archives of Neurology, vol. 66, (4), pp. 435-440, 2009. Available:
http://dx.doi.org/10.1001/archneurol.2009.15. DOI: 10.1001/archneurol.2009.15.
 B. C. Dickerson et al, "Increased hippocampal activation in mild cognitive impairment compared to normal aging and AD," Neurology, vol. 65, (3), pp. 404-411, 2005. . DOI: 65/3/404 [pii].
 K. A. Vossel et al, "Incidence and impact of subclinical epileptiform activity in Alzheimer's disease," Ann. Neurol., vol. 80, (6), pp. 858-870, 2016. . DOI:
 J. J. Palop et al, "Aberrant excitatory neuronal activity and compensatory remodeling of inhibitory hippocampal circuits in mouse models of Alzheimer's disease," Neuron, vol. 55, (5), pp. 697-711, 2007. . DOI: S0896-6273(07)00570-3 [pii].
 R. Minkeviciene et al, "Amyloid beta-induced neuronal hyperexcitability triggers progressive epilepsy," J. Neurosci., vol. 29, (11), pp. 3453-3462, 2009. . DOI:
 S. Nayak Chetan and C. Anilkumar Arayamparambil, EEG Normal Waveforms.
Treasure Island (FL): StatPearls Publishing, 2020.
 S. Vanhatalo et al, "DC-EEG discloses prominent, very slow activity patterns during sleep in preterm infants," Clinical Neurophysiology, vol. 113, (11), pp. 1822-1825, 2002. Available: http://dx.doi.org/10.1016/S1388-2457(02)00292-4. DOI:
 S. Vanhatalo et al, "Infraslow Oscillations Modulate Excitability and Interictal Epileptic Activity in the Human Cortex during Sleep," Proceedings of the National
Academy of Sciences of the United States of America, vol. 101, (14), pp. 5053-5057, 2004. Available: https://www.jstor.org/stable/3371817. DOI:
 A. Ikeda et al, "Subdural Recording of Ictal DC Shifts in Neocortical Seizures in Humans," Epilepsia, vol. 37, (7), pp. 662-674, 1996. Available:
 R. B. AIRD and Y. GASTAUT, "Occipital and posterior
electroencephalographic rhythms," Electroencephalography and Clinical Neurophysiology, vol. 11, pp. 637, 1959. Available:
 G. E. Chatrian, M. C. Petersen and J. A. Lazarte, "The blocking of the rolandic wicket rhythm and some central changes related to movement,"
Electroencephalography and Clinical Neurophysiology, vol. 11, (3), pp. 497-510, 1959. Available: http://dx.doi.org/10.1016/0013-4694(59)90048-3. DOI:
 A. R. Gondeck and J. R. Smith, "Dynamics of human sleep sigma spindles,"
Electroencephalography and Clinical Neurophysiology, vol. 37, (3), pp. 293-297, 1974. Available: http://dx.doi.org/10.1016/0013-4694(74)90033-9. DOI:
 G. Worrell and J. Gotman, "High-frequency oscillations and other electrophysiological biomarkers of epilepsy: clinical studies," Biomarkers in Medicine, vol. 5, (5), pp. 557-566, 2011. Available:
http://dx.doi.org/10.2217/bmm.11.74. DOI: 10.2217/bmm.11.74.
 J. Haueisen et al, "The influence of lorazepam on somatosensory-evoked fast frequency (600 Hz) activity in MEG," Brain Research, vol. 874, (1), pp. 10-14, 2000. Available: http://dx.doi.org/10.1016/S0006-8993(00)02534-8. DOI:
 D. F. Scott and R. G. Bickford, "Electrophysiologic Studies during Scanning and Passive Eye Movements in Humans," Science, vol. 155, (3758), pp. 101-102, 1967. Available: http://www.sciencemag.org/cgi/content/abstract/155/3758/101.
 I. Egawa, K. Yoshino and Y. Hishikawa, "Positive Occipital Sharp Transients in the Human Sleep EEG," Psychiatry and Clinical Neurosciences, vol. 37, (1), pp. 57-65, 1983. Available:
https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1440-1819.1983.tb00303.x. DOI: 10.1111/j.1440-https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1440-1819.1983.tb00303.x.
 J. R. Hughes, "Two forms of the 6/sec spike and wave complex,"
Electroencephalography and Clinical Neurophysiology, vol. 48, (5), pp. 535-550,
1980. Available: http://dx.doi.org/10.1016/0013-4694(80)90289-8. DOI:
 F. J. MILLEN and B. WHITE, "Fourteen and Six Per Second Positive Spike Activity in Children," Neurology, vol. 4, (7), pp. 541, 1954. Available:
https://www.ncbi.nlm.nih.gov/pubmed/13176673. DOI: 10.1212/WNL.4.7.541.
 C. PAMPIGLIONE, "The phenomenon of adaptation in human E.E.G.; a study of K complexes," Revue Neurologique, vol. 87, (2), pp. 197, 1952. Available:
 J. Reiher and M. Lebel, "Wicket Spikes: Clinical Correlates of a Previously Undescribed EEG Pattern," The Canadian Journal of Neurological Sciences. Le Journal Canadien Des Sciences Neurologiques, vol. 4, (1), pp. 39-47, 1977.
Available: https://www.ncbi.nlm.nih.gov/pubmed/837263. DOI:
 I. J. Lipman and J. R. Hughes, "Rhythmic mid-temporal discharges. An electro-clinical study," Electroencephalography and Clinical Neurophysiology, vol. 27, (1), pp. 43-47, 1969. Available: http://dx.doi.org/10.1016/0013-4694(69)90107-2. DOI:
 B. Weir, "The morphology of the spike-wave complex,"
Electroencephalography and Clinical Neurophysiology, vol. 19, (3), pp. 284-290, 1965. Available:
 S. Noachtar et al, "A glossary of terms most commonly used by clinical
electroencephalographers and proposal for the report form for the EEG findings. The International Federation of Clinical Neurophysiology," Electroencephalography and Clinical Neurophysiology. Supplement, vol. 52, pp. 21, 1999. Available:
 I. Timofeev and M. Steriade, "Neocortical seizures: initiation, development and cessation," Neuroscience, vol. 123, (2), pp. 299-336, 2004. Available:
 L. Danober et al, "Pathophysiological mechanisms of genetic absence epilepsy in the rat," Progress in Neurobiology, vol. 55, (1), pp. 27-57, 1998. Available:
 E. L. J. M. Van Luijtelaar et al, "Arousal, performance and absence seizures in rats," Electroencephalography and Clinical Neurophysiology, vol. 79, (5), pp. 430-434, 1991. Available:
 A. M. Coenen et al, "Absence epilepsy and the level of vigilance in rats of the WAG/Rij strain," Neurosci. Biobehav. Rev., vol. 15, (2), pp. 259-263, 1991. . DOI:
 A. Lüttjohann, J. Schoffelen and G. van Luijtelaar, "Peri-ictal network dynamics of spike-wave discharges: Phase and spectral characteristics," Experimental
Neurology, vol. 239, pp. 235-247, 2013. Available:
 A. Depaulis, O. David and S. Charpier, "The genetic absence epilepsy rat from Strasbourg as a model to decipher the neuronal and network mechanisms of
generalized idiopathic epilepsies," Journal of Neuroscience Methods, vol. 260, pp.
159-174, 2016. Available:
 E. Sitnikova et al, "Sleep spindles and spike–wave discharges in EEG: Their generic features, similarities and distinctions disclosed with Fourier transform and continuous wavelet analysis," Journal of Neuroscience Methods, vol. 180, (2), pp.
304-316, 2009. Available:
 F. Westerhuis, W. van Schaijk and G. van Luijtelaar, "Automatic detection of spike-wave discharges in the cortical EEG of rats," in Proceedings of the Measuring Behav-Ior ‘96, International Workshop on Methods and Techniques in Behavioral Research, 1996, .
 G. van Luijtelaar et al, "Methods of automated absence seizure detection, interference by stimulation, and possibilities for prediction in genetic absence models," Journal of Neuroscience Methods, vol. 260, pp. 144-158, 2016. Available:
 A. Grossmann, R. Kronland-Martinet and J. Morlet, "Reading and
understanding continuous wavelet transforms," in WaveletsAnonymous Springer-Verlag Berlin Heidelberg, 1990, pp. 2-20.
 A. Ovchinnikov et al, "An algorithm for real-time detection of spike-wave discharges in rodents," J. Neurosci. Methods, vol. 194, (1), pp. 172-178, 2010. . DOI:
 P. Xanthopoulos et al, "A robust spike and wave algorithm for detecting seizures in a genetic absence seizure model," in Sep 2009, pp. 2184-2187.
 P. Van Hese et al, "Automatic detection of spike and wave discharges in the EEG of genetic absence epilepsy rats from Strasbourg," IEEE Trans. Biomed. Eng., vol. 56, (3), pp. 706-717, 2009. . DOI: 10.1109/TBME.2008.2008858 [doi].
 S. K. Mitra, Digital Signal Processing. (4. ed. ed.) Boston [u.a.]: McGraw-Hill, 2011.
 J. O. Smith, Spectral Audio Signal Processing. 2011.
 (). Digital Signal Processing. Available: http://www.bitweenie.com/listings/fft-zero-padding/.
 M. A. Nielsen, Neural Networks and Deep Learning. Determination Press, 2015.
 P. Buteneers et al, "Real-time detection of epileptic seizures in animal models using reservoir computing," Epilepsy Research, vol. 103, (2), pp. 124-134, 2012.
Available: https://www.clinicalkey.es/playcontent/1-s2.0-S0920121112002057. DOI:
 B. Schrauwen, D. Verstraeten and J. Campenhout, "An overview of reservoir computing: theory, applications and implementations," Jan 1, 2007.
 J. L. Jankowsky et al, "APP processing and amyloid deposition in mice haplo-insufficient for presenilin 1," Neurobiology of Aging, vol. 25, (7), pp. 885-892, 2004.
 M. Garcia-Alloza et al, "Characterization of amyloid deposition in the
APPswe/PS1dE9 mouse model of Alzheimer disease," Neurobiology of Disease, vol.
24, (3), pp. 516-524, 2006. Available:
 I. Gureviciene et al, "Characterization of Epileptic Spiking Associated With Brain Amyloidosis in APP/PS1 Mice," Frontiers in Neurology, vol. 10, pp. 1151, 2019. Available: https://search.proquest.com/docview/2320378843. DOI:
 Wim van Drongelen, "6 - continuous, discrete, and fast fourier transform," in Signal Processing for NeuroscientistsAnonymous Elsevier Ltd, 2007, pp. 91-105.
 L. Breiman, "Random Forests," Machine Learning, vol. 45, (1), pp. 5-32, 2001.
Available: https://search.proquest.com/docview/757027982. DOI:
 (). Random Forests. Available:
 (May 18,). Decision tree learning. Available:
 K. Gurevicius, A. Lipponen and H. Tanila, "Increased Cortical and Thalamic Excitability in Freely Moving APPswe/PS1dE9 Mice Modeling Epileptic Activity Associated with Alzheimer's Disease," Cerebral Cortex (New York, N.Y. : 1991), vol.
23, (5), pp. 1148-1158, 2013. Available:
https://www.ncbi.nlm.nih.gov/pubmed/22581851. DOI: 10.1093/cercor/bhs105.
 J. Brankačk et al, "EEG gamma frequency and sleep–wake scoring in mice:
Comparing two types of supervised classifiers," Brain Research, vol. 1322, pp. 59-71, 2010. Available:
https://www.clinicalkey.es/playcontent/1-s2.0-S0006899310002234. DOI: 10.1016/j.brainres.2010.01.069.
 Z. Liang et al, "EEG entropy measures in anesthesia," Frontiers in Computational Neuroscience, vol. 9, pp. 16, 2015. Available:
https://www.ncbi.nlm.nih.gov/pubmed/25741277. DOI: 10.3389/fncom.2015.00016.
 Karl Pearson, "Contributions to the Mathematical Theory of Evolution,"
Philosophical Transactions of the Royal Society of London. A, vol. 185, pp. 71-110, 1894. Available: https://www.jstor.org/stable/90667. DOI: 10.1098/rsta.1894.0003.
 (Nov 29,). 40 years of boxplots. Available:
 C. D. Richard et al, "SWDreader: A wavelet-based algorithm using spectral phase to characterize spike-wave morphological variation in genetic models of absence epilepsy," Journal of Neuroscience Methods, vol. 242, pp. 127-140, 2015.