A personalized earbud for non-invasive long-term EEG monitoring

Objective. The primary objective of this study was to evaluate the reliability, comfort, and performance of a custom-fit, non-invasive long-term electrophysiologic headphone, known as Aware Hearable, for the ambulatory recording of brain activities. These recordings play a crucial role in diagnosing neurological disorders such as epilepsy and in studying neural dynamics during daily activities. Approach. The study uses commercial manufacturing processes common to the hearing aid industry, such as 3D scanning, computer-aided design modeling, and 3D printing. These processes enable the creation of the Aware Hearable with a personalized, custom-fit, thereby ensuring complete and consistent contact with the inner surfaces of the ear for high-quality data recordings. Additionally, the study employs a machine learning data analysis approach to validate the recordings produced by Aware Hearable, by comparing them to the gold standard intracranial electroencephalography recordings in epilepsy patients. Main results. The results indicate the potential of Aware Hearable to expedite the diagnosis of epilepsy by enabling extended periods of ambulatory recording. Significance. This offers significant reductions in burden to patients and their families. Furthermore, the device’s utility may extend to a broader spectrum, making it suitable for other applications involving neurophysiological recordings in real-world settings.


Introduction
Epilepsy is a neurological disorder characterized by recurrent seizures [1].Seizures are distinguished by their temporal variability, wherein the frequency, location, and manifestation of seizures may fluctuate over time [2].A notable example of this temporal variability is the seizure laterality shift, in which an individual's seizures transition from originating in one cerebral hemisphere to the other.Further, the timing of seizures may also be affected by external factors, such as changes in medication, sleep patterns, stress levels, and hormonal fluctuations [1].
Electroencephalography (EEG) has long been the standard of care for monitoring cerebral activity, and critical in clinical practice for detecting seizures [3].
However, given their paroxysmal nature, seizures and interictal epileptiform discharges often prove elusive to record with EEG, even under continuous patient monitoring [4,5].Scalp EEG is a widely used diagnostic tool for epilepsy, allowing for the detection and characterization of abnormal electrical activity in the brain.Unfortunately, as important as it is, current outpatient EEG monitoring is limited to approximately three days [6,7], as traditional scalp EEG electrodes cannot be maintained for longer intervals.Longer-term monitoring requires inpatient hospitalization, where EEG technologists can monitor the EEG tracings and repair electrodes when needed in this setting.However, inpatient monitoring is expensive, inconvenient for patients and families, and not readily available outside of major metropolitan areas.Additionally, patients frequently do not have seizures or interictal activity during inpatient monitoring, prompting future hospital readmissions [8].The need to expand our capability for long-term EEG monitoring is critical not only because seizures are paroxysmal by nature, but also because the occurrence of seizures with different foci of onset (such as bitemporal onset) does not follow a normal distribution [9].Seizures may occur from a single focus for several days or even weeks before any are seen from a distinct independent focus.In some patients, seizures are rare enough that multiple inpatient admissions are insufficient to capture their seizures.Increasing the duration of EEG monitoring may identify additional epileptogenic foci and may thereby contribute to our understanding of why certain patients who are thought to have clearly delineated seizure foci may at times not obtain seizure freedom after the resection or ablation of the purported epileptogenic zone.
Ambulatory EEG, which is the use of scalp EEG in a naturalistic, home setting over longer periods of time, has been shown to be more sensitive in detecting seizures than traditional, in-office 20 min recordings, particularly in persons with epilepsy whose seizures are difficult to predict or occur infrequently [6].However, this traditional method has several limitations.The results obtained from traditional EEG tests might not fully capture or accurately represent the patient's neurological state during their normal daily activities [10].In addition to the unwieldy bundle of wires and data logger hardware used in scalp recordings, one of the most significant limitations is the duration of recording, which is limited by skin breakdown that can occur from chronically adhered wet electrodes [11].Recording integrity also reduces over time as the fidelity of scalp EEG recordings cannot be maintained without frequent, sometimes daily, repairs.
The limitations of scalp EEG have led scientists to pursue lower-profile, long-wear ambulatory EEG technologies, such as in-ear electrode devices.Prior studies have successfully shown the effectiveness of capturing in-ear EEG data using a variety of sensor interfaces.Some examples include sensors pressed into viscoelastic ear plugs ('foamies') [12], custom ear shells with embedded sensors worn within the ear canal and concha made from 3D scanned silicone ear impressions [13], and multiple-night sleep studies using similar custom shells with embedded sensors [14].In [15], a multi-modal system encompassing a behind-the-ear EEG device, along with ECG and accelerometry, was investigated for its potential in seizure detection.This integrated approach showed promise and [16] utilized behind-the-ear EEG in addition to ECG and photoplethysmogram to propose a monitoring system for epileptic users, however they observed the loss of EEG information in ambulatory settings, a shortfall further compounded by the absence of seizure detection outcomes.Turning to the specific realm of behind-the-ear EEG, the study in [17] considered seizure detection based on behindthe-ear EEG and reported that the obtained sensitivities were too low for practical use, however this work illuminated the complementary role of ECG in enhancing the seizure detection process.Meanwhile [18], showcased the capacity of behind-the-ear EEG for visual recognition of ictal EEG patterns as well as being used in a seizure detection algorithm.However, they reported that the ictal EEG data used in their study were recorded with the hospital system using Ag/AgCl electrodes.Further [19], presented the use of a commercial EEG device to record behind-theear EEG to evaluate seizure detection algorithms in hospitalized patients.Finally, the authors of [20] conducted a feasibility study to demonstrate the safety of recording long-term ear-EEG in patients with Alzheimer's disease, stopping short of extending these findings to the development of a seizure detection algorithm.The above studies show successful capture of EEG data from within the ear or behindthe-ear which in some cases compared favorably to scalp EEG monitoring.However, these studies were built around bench-top electronic prototypes which are not scalable solutions for personalized long term ambulatory EEG monitoring.In contrast to these labbased in-ear EEG studies, this study demonstrates the design and manufacture of an ambulatory in-ear EEG monitor using scalable, commercially available 3D scanning, computer-aided design (CAD) modeling, and 3D printing processes and techniques used for designing and manufacturing hearing aids and custom high-end in-ear monitors thus, demonstrating the potential for long-term comfort and wearability needed for in-ear EEG devices.The Aware hearable is designed to conduct continuous monitoring of brain activity, record data on the device for long-term analysis, and provide valuable information pertaining to seizure patterns, triggers, and the efficacy of treatment, all in a non-invasive, ambulatory form factor.The long-term comfort and wearability of the device is particularly useful for individuals who experience infrequent or hard-to-predict seizures.Aware also offers the advantage of being applicable to a wider range of patients, including those who do not meet the criteria for costly surgically implantable monitoring and stimulation devices such as responsive neurostimulation [21].The Aware in-ear hearable is built using the same methods and practices as hearing aids and custom in-ear headphones, allowing for a sleek custom pro-consumer product design.Through discussions with subject matter experts and test subjects, it is believed that a future integrated system within a small wearable form-factor that unobtrusively blends into a users' daily wear and activities, making an EEG recording device more accessible both physically and in appearance compared to traditional scalp-worn electrodes, may lead to reduced social stigma of wearing a medical device and increase user acceptance for long-term data collection.This design approach aligns with current trends in wearable technology, ensuring the device blends seamlessly into the user's daily life and social roles without attracting unwanted attention [22].
It is worth noting that other wearable devices are used for seizure detection, such as wearable sensors and smartwatches [23][24][25][26][27].These technologies leverage the various sensors found in these devices, such as accelerometers and gyroscopes, to detect seizures and alert the wearer as well as the caregiver.However, despite their convenience and non-invasive nature, they are worn at the extremities, making them prone to motion artifact, and are not as effective as EEG signals in detecting seizures that do not trigger substantial motor activity [28].The Aware hearable, due to its dry electrodes placed within the ear canal with proximity to the brain, has an edge over these wearable devices in capturing seizures as EEG signals are considered the most effective signal for seizure detection, providing a direct measure of the electrical activity of the brain.While EEG is known to be highly susceptible to motion artifacts, which is a major concern for mobile EEG research, utilizing a 3D stereolithography digital model generated from United Sciences' 'eFit' 3D ear scanner allows placement of the dry electrode sensors at the bony region of the ear canal known as the second bend, where the auditory canal passes through the skull wall.Utilizing the second bend allows the Aware hearable to fit and 'lock' into place with the subject's unique ear anatomy, thereby reducing motion artifact and ensuring the best possible signal integrity.The primary objective of this study is to advance the field of chronic EEG recordings by examining the viability and interpretability of EEG data obtained from sensors within the ear canal, particularly due to their proximity to the temporal lobes-the most epileptogenic regions of the brain [29].This is conducted in a clinical setting using the Aware in-ear hearable with embedded dry electrodes, manufactured through commercial processes.Supporting this [30], indicates that ear-EEG can enhance source localization in temporal brain regions.Furthermore [31], demonstrates that ear-EEG is especially sensitive to sources in the temporal cortex, owing to the proximity of the ear electrodes to these regions.During this study, the Aware earbuds were worn by subjects who had just undergone invasive, intracranial EEG implantation, and had both ictal and interictal EEG patterns observable on previously obtained scalp EEG.These subjects had an array of up to 20 electrode probes implanted into various regions of their brains based on their pre-implantation hypothesis, including the temporal lobe.The subjects were asked to wear the Aware hearable earbuds beginning 24-48 h after their implant procedure.For consistency, the earbuds were inspected daily and placed into the subjects' ears by a technician.

Earbud
To manufacture each set of Aware hearables, a proprietary non-contact eFit 3D ear scanner was utilized (United Sciences, Atlanta, GA) to 3D scan the unique anatomy of each subject's ear canal and concha where the hearable would be inserted.Originally developed for custom hearing protection and later commercialized into the hearing aid and custom headphone industries to replace industry-standard silicone impressions, the eFit scanner utilizes a patented [32] ring-laser scanner to scan the subject's ear, creating a near-perfect 3D scan of their ear, without any of the imperfections or pressure-induced distortion to the ear canal caused by the silicone impression process.Through stringent testing, the eFit scanner has shown greater volumetric accuracy and repeatability between ear scans than traditional silicone impression practices, with volumetric accuracy within 90 µm, allowing for a comfortable custom-fit with complete consistent contact with the inner surface of the ear canal, resulting in high-quality data recordings.
Each customized device housing along with dry electrode contact points were modeled in a CAD software specific for earmold modeling (www.cyfex.com), 3D printed using a biocompatible photoreactive acrylate thermoset photopolymer (https:// etec.desktopmetal.com/),coated with a hypoallergenic light-polymerizing single-component lacquer (www.otoplastik.dreve.de),and electroless nickel plated with silver/silver chloride (Ag/AgCl) for the dry electrodes, allowing the device to precisely and comfortably fit to the individual surfaces of the subject's ear and optimize the electrophysiologic signal quality (figures 1-3).The ear shells were designed with pass-through vent ports to allow for normal hearing.Three-dimensional (3D) CAD modeling (traditionally from a 3D scan of a physical silicone ear-mold impression) and 3D printing have been utilized for decades for the design and manufacture of custom hearing aids.The new technique of 3D scanning the ear in its natural state with the noncontact eFit scanner enables full digital efficiency to this workflow.Novel to this study is the comparison of in-ear EEG to intracranial recordings, under the premise of demonstrating the use of 3D scanning and modeling techniques to design the custom fit dry electrode shape allowing for control of contact pressure for lower artifact with high comfort wearability.The goal of this research is to verify in-ear EEG as a potential means of capturing long-term ambulatory   EEG data in a non-clinical environment with future use in consumer and medical devices.

Hardware
The earbuds were hardwired to a small datalogger that was located adjacent to the subject's main in-room datalogger, with wires running along the electrode bundle leading from the subjects' implant sight.The Aware hearable datalogger was built with an Arduino-compatible, 8-channel interface utilizing a 32-bit PIC32MX250F128B microcontroller with ChipKIT UDB32-MX2-DIP bootloader (www.microchip.com),with an ADS1299 digitizer (www.ti.com), sampling at 250 Hz.Battery life was not a focus of this study.To ensure uninterrupted data collection, a freshly charged external 10 000 mAh rechargeable battery pack was swapped daily during the morning skin inspection routine Raw data files are collected on a removable microSD card in .TXT format in 24 h increments.The TXT files were downloaded to a secure laptop and converted to European Data Format (EDF) containing one uninterrupted digitized polygraphic recording for visual analysis using EDFbrowser (www.teuniz.net).

Sensors/electrodes
The earbuds feature eight electrodes combined, four in the left ear and four in the right ear as shown in table 1.Each electrode is connected to an OPA2378 amplifier (www.ti.com) within the ear shell and is hardwired to the inputs on the data logger.The system is actively grounded using a conventional driven right leg (DRL) contact to the body with the right posterior canal electrode connected as reference and the right anterior canal 1 electrode connected as the non-amplified BIAS input.Similar to its use in ECG, DRL is sometimes employed in EEG systems to reduce common-mode interference.By actively driving the right leg electrode, the system aims to create a common reference point that helps cancel out interference common to both the active electrodes and the reference electrode.This technique contributes to the overall noise reduction in the EEG signal, allowing for a more accurate representation of brain electrical activity.
With the seven electrode inputs and one BIAS input, the remaining open channel was connected to a manual trigger switch used to send a digital signal pulse between the Aware data logger and NatusTM bedside data logger system.This pulse served as a timestamp to align the Aware and Intracranial Montage recordings for post analysis.Each morning during rounds, the earbuds were removed for skin inspection, the rechargeable battery was replaced, and the system restarted.

Subjects
In accordance with Emory University institutional review board protocols, informed consent was obtained from all participants in this study, and the study was conducted in accordance with the guidelines for ethical research.The enrollment criteria for the use of Aware for seizure detection included subjects 18 years of age and older who were admitted to the Epilepsy Monitoring Unit at Emory University Hospital for invasive, iEEG monitoring, and had both ictal and interictal EEG patterns observable on previously obtained scalp EEG.The study was initially limited to subjects with temporal lobe epilepsy, and recruitment was later opened to include those with non-temporal lobe epilepsy.However, there were certain exclusion criteria that needed to be considered, which included the inability to safely tolerate the use of Aware due to conditions such as antecedent skin breakdown or recent injury to the ear, participation in any other device trial that would preclude the use of Aware, and prior scalp EEG study with sufficient background abnormalities as to prevent observation of a posterior dominant rhythm or sleep spindles.
Subjects were instructed to document their subjective experience of tolerability in a comfort diary that utilized a visual face scale, with accompanying descriptions, to report any discomfort or inconvenience associated with using Aware (see appendix A).Additionally, a daily skin inspection log was meticulously kept assessing for any adverse skin reactions or breakdowns.The subjects were asked to wear the Aware device for a minimum of 20 h per day and were given the discretion to remove the device at any time, as well as instructed to remove the device during any participation in other research studies.Seven subjects were enrolled, with four undergoing data collection and analysis (two male, mean age = 41.5 years, ±9.47).Subject 101 expressed greater post-op discomfort, and while initially wearing the hearable for several multi-hour increments at the start of the study, chose to discontinue with the study before any usable seizure data was collected.Subject 103 had their iEEG cancelled and therefore no data was collected.All seizures necessary for clinical purposes for subject 105 were captured and the subject was subsequently explanted before their Aware hearable data collection study could be implemented.

Data collection
The Aware earbuds captured EEG data over 413 h of wear-time across four subjects, recorded seizures lasting in duration between 30 s to over five minutes, and several subjects wore the hearable for consecutive 24 h intervals throughout the study including during sleep.While the high-quality EEG recordings from Aware allowed the interpreting epileptologist to detect most electrographic seizures, traditional visual analysis methods are inadequate for the sheer volume of EEG data generated by devices such as Aware.This necessitates the implementation of a quantitative approach to data analysis, specifically machine learning techniques, which have been demonstrated to be effective in identifying patterns in EEG data indicative of seizures and sleep states [33][34][35][36][37][38].

Manual data annotation
The EEG signal captured by Aware, in addition to the concordant iEEG signal obtained via NatusTM equipment (see appendix B), were reviewed by a board-certified Epileptologist.EDFbrowser was used to review the Aware data.Awake and asleep epochs were identified on iEEG via visual analysis.A minimum of 30 min of awake and 30 min of asleep EEG data was analyzed to determine the presence of epileptiform discharges, as well as to evaluate the normal sleep architecture.All seizures documented in the electronic medical record during the iEEG recording coinciding with Aware use were reviewed by the Epileptologist to determine if they were detected by the hearable.Seizures analyzed were anatomically correlated with either a post-operative MRI, postoperative CT or 3D reconstruction utilizing a preoperative MRI and post-operative CT to explore differences in detection between the iEEG and Aware.

Data analysis
To validate the EEG recordings from the Aware hearable, we developed a machine learning classification pipeline to classify between different physiological states using the Aware hearable EEG recordings.We formulated a seizure detection problem where the classification task was to differentiate between ictal and non-ictal states using the EEG recordings.We utilized intracranial EEG data obtained from clinical data acquisition systems (NatusTM) to benchmark our classification pipeline.We applied our pipeline to classify between sleep and awake states for additional validations of the Aware hearable EEG recordings.The classification pipeline was comprised of 4 stages: Preprocessing, feature extraction, and model training and evaluation.

Preprocessing
The raw hearable data, comprising eight electrodes (as detailed in table 1), was utilized in the analysis.CH1-CH7 were EEG data signals, and CH8 was a TTL-sync signal and was excluded from further processing.Based on the design of the hardware, CH6 was selected as the reference electrode and subtracted from the other electrodes.We chose the right posterior canal electrode as the reference electrode because we found in our experiments that it is less prone to motion artifact potentially due to its location at the first bend within the ear.The remaining six channels were first filtered to remove the line noise and its harmonics (at 60 and 120 Hz) and then filtered by a bandpass filter (0.5-100 Hz) using a one-pass, zero-phase, non-causal bandpass filter.Following the visual examination of the filtered signals, we saw that one subject (Subject107) had excessive artifacts present on electrodes CH4 and CH7, likely due to

Vector type Comprising electrodes
Long vector CH1-CH5, CH3-CH5 Short vector CH1-CH2, CH1-CH3, CH2-CH3 deformation of the exterior ear pinna caused by pressure from the patient's head bandage overwrap.We decided to exclude data from these specific electrodes for all participants to maintain uniformity and integrity in the data analysis process.To emphasize the disparities in cerebral activity between various locations, we created a montage utilizing the remaining electrodes, namely CH1, CH2, CH3, and CH5 (table 2).The idea of short and long vectors is based on unilateral and bilateral (cross-head) channel derivation, respectively [18,19].In prior studies, it has been observed that in addition to unilateral (short) channels, including bilateral cross-head (long) channels exhibit a higher significance in detecting epileptic activities.This observation is attributed to the inherent asymmetry characteristic of focal seizures [34].
Our neurologist annotated the ictal segments on both the Aware data and the concurrent iEEG signals (see manual data annotation).For each ictal segment, we selected a corresponding window of equal duration and one hour preceding the onset of the seizure as the non-ictal segment.We labeled ictal segments with 1 and non-ictal segments with 0. Subsequently, we concatenated the non-ictal and ictal segments and standardized the entire signal.The signals were then segmented into one-second intervals with no overlap.

Feature extraction
In the evolving field of seizure detection, the selection of appropriate features for classification purposes is pivotal.The features listed in table 3 are rooted in the historical context of EEG analysis and have been validated by numerous studies for their effectiveness in distinguishing seizure activity from normal brain activity.The line length (LL), an operational simplification of Katz's fractal dimension, has been shown to be an efficient feature for seizure onset detection  [48] Hjorth complexity, A measure to understand the complexity and structure of a signal.[38,39].Complementing the time-domain analysis, the frequency-domain features-delta, theta, alpha, sigma, beta, and gamma-represent power spectral densities within their respective frequency bands.These bands are integral to EEG interpretation.Delta waves, for instance, are known to be prominent during deep sleep stages and have been observed to change during seizure episodes, particularly in temporal seizures [40].Theta and alpha waves, associated with drowsiness and relaxed wakefulness respectively, also exhibit alterations during seizures [41].Sigma waves, though less commonly emphasized, can offer additional insights into seizure dynamics, especially considering their normal presence during sleep spindles [42].Beta waves, linked with active cognitive engagement, have been reported to increase phase-amplitude coupling with gamma waves during seizures, offering a potential biomarker for seizure detection [43].Alterations in gamma activity have been correlated with the onset and spread of seizure activity, making it a potential feature for seizure detection algorithms [44].Lastly, Hjorth complexity extends the analysis by offering a measure of the signal's overall volatility and unpredictability, which is inherently higher during seizures.This parameter adds depth to the feature set by encapsulating the dynamic nature of EEG signal changes during epileptic events [45].In this study, we utilized each 1 s segment to extract time and frequency domain features as outlined in table 3.

Model training and evaluation
In this study, the epileptologist conducted a comprehensive review of the Aware dataset, encompassing the recordings from all four subjects.Each instance of seizure activity was identified and labeled within the dataset.Subsequently, the validity of these identified seizure episodes was corroborated through reviewing iEEG data.Table 4 summarizes the total recording hours, number of samples in ictal (interictal) and sleep (awake) states, alongside the seizure counts for each subject.
In the process of preparing our dataset for model training and evaluation, we partitioned it into two subsets: 80% allocated for training and 20% reserved for testing.To ensure that the distribution of classes remains consistent across both subsets, we employed stratified sampling.We used Logistic Regression and Random Forest classification models in our classification pipeline.Prior to inputting the features into the classifiers, we performed normalization to ensure the data was of uniform scale.Subsequently, we utilized the test data to assess the efficacy of the trained models.We employed accuracy, sensitivity, false positive rate (FPR), and receiver operating characteristic (ROC) curve as evaluation metrics [46].Our seizure detection pipeline is depicted in figure 4.

Results
We tested the physiological validity of the Aware hearable EEG recordings, in the context of seizure detection and sleep classification applications.Inclusion of sleep detection results in our seizure detection study is founded on the premise that discerning the state of wakefulness or sleep during seizure events can enhance diagnostic accuracy and inform tailored treatment strategies.For instance, identifying whether seizures predominantly occur during sleep can guide more targeted medication regimens, such as administering doses primarily before bedtime and minimizing unnecessary medication exposure during wakefulness [47].Figures 5(A)-(D) provide a detailed illustration contrasting seizure versus interictal conditions, as well as sleep versus awake states.In this illustrative example, the signals are derived from Subject106, selected randomly for demonstration purposes.This depiction encompasses preprocessed data only from the electrodes used for the classification tasks.
To demonstrate the efficacy of our seizure detection pipeline, we used the data pertaining to eight patients from the Kaggle seizure detection competition [49], as a benchmark.This provided us with a rigorous test of the performance of our approach.The Kaggle seizure competition data consists of training and testing data for both human and canine subjects.The training data consists of 1 s clips of EEG recordings labeled as either 'ictal' for seizure data or 'interictal' for non-seizure data.Data is described in more detail in [49].In order to address the high dimensionality of the Kaggle data, which exceeded 6 channels, an additional preprocessing step was implemented involving the use of principal component analysis (PCA) [50].Specifically, the first 6 components of PCA were selected for further analysis.We curated a balanced dataset by selecting an equal number of samples for ictal and interictal classes.The efficacy of our seizure detection pipeline is demonstrated by the performance of a trained Random Forest algorithm on the Kaggle test data, as depicted in figures 6(A)-(D).The mean accuracy among all subjects was found to be 0.79, with a standard deviation of 0.13.This indicates that the seizure detection accuracy of the studied subjects is consistently above the chance level [51], with a relatively low level of variance.The area under the ROC curve (AUC) was determined to be 0.93.
Additionally, in order to provide a reliable benchmark for our method, we utilized the iEEG data that was collected concurrently with Aware signals.As with the Kaggle data, we employed PCA to address the high dimensionality of the iEEG data.The results of seizure detection, including accuracy, sensitivity, FPR for each recording session, and ROC curve on aggregated data are depicted in figures 7(A)-(D).On average, the accuracy of our random forest and logistic regression models was 0.88 and 0.80, respectively, with standard deviations of 0.1 and 0.17.Similarly, the mean sensitivity of these models was 0.88 and 0.81, with standard deviations of 0.1 and 0.17.The mean FPR of the logistic regression and random forest models was 0.11 and 0.21, with standard deviations of 0.12 and 0.18.The ROC curve for the seizure detection results obtained through combining data from all sessions, with the AUC of 0.97.The results of our seizure detection analysis using the Aware hearable data are depicted in figures 8(A)-(D), including accuracy, sensitivity, FPR for each recording session, and ROC curve on combined data.The average accuracy of our random forest and logistic regression models was found to be 0.86 and 0.80, respectively, with standard deviations of 0.13 and 0.20.The mean sensitivity of these models was 0.91 and 0.83, with standard deviations of 0.12 and 0.26.The mean FPR of the logistic regression and random forest models was 0.18 and 0.21, with standard deviations of 0.15 and 0.18.The ROC curve for the seizure detection results obtained by pooling data from all sessions, with the AUC of 0.99.
In addition to the seizure detection test, we applied our machine learning classification pipeline to classify between sleep and awake states from the Aware data.Our epileptologist annotated sleep segments using a combination of iEEG data and video recordings.As with the seizure detection task, we selected a corresponding window of equal duration from the awake state for each sleep segment in order to facilitate comparison and analysis.The accuracy of sleep detection analysis utilizing Aware data is depicted in figures 9(A) and (B).Our random forest model outperforms the logistic regression model, with an average accuracy of 0.96 compared to 0.82.This is further supported by the smaller standard deviation of 0.03 for the random forest model compared to 0.16 for the logistic regression model.The AUC for sleep detection was 0.99.An independent samples ttest was conducted to evaluate the statistical distinction in classification accuracies derived from Aware data and iEEG data.The calculated t-statistic was 0.07, accompanied by a p-value of 0.93.These results indicate the absence of a statistically significant difference in the 'accuracy' metric between the two data sets.Consequently, we fail to reject the null hypothesis, which postulates equivalence in the performance of the classification accuracies across the two modalities.
Regarding tolerability, most subjects reported varying degrees of comfort throughout their stay (appendix A), which was confounded by the subjects having concurrent indwelling intracranial electrodes in place throughout the study, which are a universal source of discomfort.The overall mean tolerance was 3.98, suggesting that, on average, the subjects experienced a degree of discomfort marginally below the midpoint of the scale.It is imperative to consider that the participants were implanted with intracranial electrodes, a factor that might have affected the reported discomfort.The standard deviation was 1.12 which reflects a moderate variation in the tolerability scores across the subjects.

Discussion
Previous research has established the potential of ear-EEG as a viable tool for seizure detection.This technology has demonstrated efficacy both as a standalone modality and as a component within a multi-modal system.In this study, we sought to determine the feasibility of using the Aware hearable manufactured from hearing aid industry standard materials and practices and equipped with embedded electrodes to record EEG signals from the ear canals.To this end, we collected EEG data from both left and right ears and compared it to data obtained using gold standard iEEG.Our results indicated that the ear canal recordings were suitable for detecting seizures and discriminating between wakefulness and sleep.The Aware hearable demonstrated the viability of using a non-invasive longterm electrophysiologic earbud device for extended periods of time in a clinical setting, thus potentially translating to ambulatory settings which would significantly reduce costs and burden to patients and families.
Of note, the Aware hearable was not able to detect seizures that were deep and limited in propagation (Subject 104).This is a known limitation of scalp EEG [52], which the Aware hearable most closely resembles.A similar comment can be made about the instance where Aware failed to lateralize the seizure (Subject 102); propagation of ictal patterns is what is visible on scalp EEG, which can appear as bilateral signals.In contrast, iEEG electrodes have only limited spatial resolution, and if the implant does not cover the initiating nodes, it can give falsely lateralizing information; the discordance regarding lateralization in Subject 106 could be due to this or due to how the seizure propagated before being seen on the surface.The other limiting factor in this analysis is that epileptiform discharges observed on iEEG are often not observable on scalp (and presumably Aware), however, there were no epileptiform spikes identified via the hearable despite all enrolled subjects demonstrating interictal epileptiform discharges on prior scalp studies (same for sleep spindles and posterior dominant rhythms).It is possible that this discrepancy is due to the limited spatial sampling of the hearable.Future trials of the Aware study might consider the adoption of scalp EEG instead of iEEG.This consideration stems from the notion that both scalp EEG and the Aware system utilize more comparable methods for EEG signal acquisition.Furthermore, the use of scalp EEG is generally less complex and more accessible compared to iEEG.
Comfort level is highly personal, and several users showed no issues wearing the earbuds for 20+ hours a day for the length of their study.In our analysis of the EEG data obtained using Aware, we employed a combination of preprocessing, feature extraction, and classical machine learning techniques to classify the data.Our choice of classical machine learning algorithms was informed by the fact that they tend to perform better than deep learning algorithms when the available data is small.This is because classical machine learning algorithms make use of hand-crafted features and apply simpler models that are designed to be more robust with smaller datasets.
As previously demonstrated in the literature, treebased models often outperform deep learning models on tabular data [53].There are several reasons for this phenomenon.For instance, tree-based models are more adept at handling high-dimensional datasets and interactions between features than deep learning models.This is because tree-based models can learn simple, interpretable decision rules based on a few key features, rather than attempting to learn complex, non-linear relationships across all features like deep learning models do.Additionally, tree-based models tend to be less sensitive to noise and outliers in the data, which can be problematic for deep learning models [54].Furthermore, tree-based models are often easier to train and tune, particularly when the data is small or imbalanced.Given these considerations, we chose to employ random forest classifiers in our analysis.These classifiers are a type of ensemble learning algorithm that combines the predictions of multiple decision trees to achieve improved performance [55].In the domain of seizure detection using ear-EEG, various studies have yielded promising results using machine learning classifiers.Nielsen et al [15] details the use of a support vector machine (SVM) classifier applied to multimodal data, achieving a sensitivity spectrum of 84% to 100%.Another study reported sensitivities between 77% and 82% when utilizing an SVM classifier with behind-the-ear EEG data [17].Further research highlighted in [18] has echoed these findings, with sensitivities ranging from 83% to 100% using similar methods.Diverging from SVM classifiers [19], achieved a mean sensitivity of 90.4% with an autoencoder-based model.
Our research contributes to this evolving field with a seizure detection system that not only aligns with the high sensitivity benchmarks previously reported but, in some instances, surpasses them.With a mean sensitivity of 91%, our system stands as a testament to the efficacy of using in-ear-EEG for long-term seizure monitoring.
Overall, our clinical results corroborate with prior studies that ear canals should serve as a potential viable alternative for recording EEG signals in ambulatory settings [56], and that the Aware hearable demonstrates this feasibility using scalable commercial manufacturing processes, with potential implications for the fields of neurology and brain computer interface research.One possible application for this technology is the detection of sleep and wake states.To improve detectability of motor seizures that are not visible as a detectable pattern from any scalp EEG system, accelerometers may be added to the Aware hearable in future designs.For the future work, we will consider the incorporation of artifact removal algorithms within our preprocessing framework, with the objective of potentially improving the system's overall performance.
We hope that using the Aware hearable device will provide patients a much more comfortable experience with long-term seizure monitoring and detection while affording clinicians and researchers far greater amounts of data than existing non-invasive ambulatory methods allow.

Figure 2 .
Figure 2. Detail of outside (on left) and inside (on right) of right earbud showing dry electrode placement.

Figure 4 .
Figure 4. Flow chart of the proposed seizure detection pipeline.

Figure 5 .
Figure 5. Comparative visualizations of preprocessed EEG data of subject106 captured using the Aware system.Panels (A) and (B) depict EEG activity during interictal and seizure states, respectively, while panels (C) and (D) exhibit recordings obtained during periods of wakefulness and sleep.

Figure
Figure Results of seizure detection on Kaggle iEEG_PCA data.(A) Accuracy: logistic regression (LR) results were used as the baseline.Random Forest (RF) showed superior results compared to LR in all cases (B) sensitivity (C) false positive rate (FPR): the trained RF had a lower FPR than the baseline.(D) ROC curve for aggregated Kaggle iEEG_PCA data: for readability only results for RF model are shown.

Figure 7 .
Figure 7. Results of seizure detection on iEEG_PCA data.(A) Accuracy: logistic regression (LR) results were used as the baseline.Random forest (RF) showed superior results compared to LR, in 4 out of 5 cases.(B) Sensitivity: LR had higher sensitivity than the trained RF in 4 out of 5 cases.(C) False positive rate (FPR): except for one case, the trained RF had a lower FPR than the baseline.(D) ROC curve for aggregated iEEG_PCA data: for readability only results of RF model are shown.

Figure 8 .
Figure 8. Results of seizure detection on Aware hearable data.(A) Accuracy: logistic regression (LR) results were used as the baseline.(B) Sensitivity (C) false positive rate (FPR) (D) ROC curve for aggregated Aware hearable data: for readability only results of RF model are shown.

Figure 9 .
Figure 9. Sleep detection utilizing Aware hearable data (A) accuracy (B) ROC curve for the trained random forest.

Table 3 .
List of features.

Table 4 .
Summary of sample size per subject.