EpiHealth: 2022 Toronto Accelerator Award winner

EpiHealth: 2022 Toronto Accelerator Award Winner
Epi Health

Team members

Bernice Lien, Gabriel Peralta, Ivana Miovcic, Jisu Qian, Selen Calgin, Vladyslava Diachenko

Project summary

Using AI and biometric data from wearable wrist devices, EpiHealth gives people with epilepsy autonomy over their condition.

Keywords

Epilepsy, Machine Learning (ML), Wearable Technology, Artificial Intelligence (AI), 1-D Convolutional Neural Network (1D CNN), Healthcare, Long Short-Term Memory Neural Network (LSTM), Seizure Prediction

Problem

EpiHealth Seizure detection and prediction

A large issue surrounding epilepsy is the unpredictability of seizure onset, which can significantly affect one’s quality of life. On top of dealing with the physical ramifications of the condition, the top three personal challenges of epilepsy have been identified to be a lack of independence, impact on social life, and stigma and discrimination. Epilepsy is also a condition that is difficult to monitor and treat. There are large gaps in epilepsy care and management because seizures are often underreported and physicians and caregivers have difficulty identifying changes in seizure frequency or severity. Our aim is to leverage the power of machine learning to bring a sense of control and autonomy to people with epilepsy.

Our project aims to tackle the main issues surrounding epilepsy. With seizure forecasting, users will be able to assess their risk prior to seizure onset and plan their day accordingly. With seizure detection, users and their healthcare providers can better monitor their condition for increased patient outcomes. We also are working to integrate stress detection and sleep monitoring to further enhance the user’s epilepsy management by warning users of potential triggers. Our vision is to create a complete epilepsy management ecosystem to bridge the gap in epilepsy care, give people with epilepsy autonomy over their condition.

EpiHealth Seizure detection and prediction

List of Technologies

Backend: Python, Pytorch, Long-Short Term Memory Neural Network, 1-Dimensional Convolutional Neural Network, NumPy, Matplotlib, Pandas

Front-end: Figma, Wix, Canva (for slides)

Project development

Brainstorming:

We first came together as a group with a common goal in mind: we all wanted to use AI to make a difference in the field of healthcare. The first step in our project was brainstorming and figuring out which ideas were feasible. This was one of the most challenging parts of the project since we all had many good ideas to contribute. Other ideas that we considered for our AI model were cancer cell recognition, real-time sign language translation, maternal health prediction, and eye-tracking for paraplegic patients. Ultimately, we decided to go with Epilepsy prediction because it could be integrated into an app and we could envision the impact it could have on people living with epilepsy.

Once we chose the topic for our project, the next step was to do research into Epilepsy to learn more about the condition. While looking into the causes of Epileptic seizures we discovered that sleep deficit and stress were common triggers. Since stress was strongly correlated with seizure frequency, we decided to incorporate a stress detection model alongside our seizure prediction model to provide a more complete Epilepsy tracking ecosystem. Our idea for the app was to have an all-encompassing user experience that would track and log symptoms while providing a daily or hourly seizure risk forecast.

When looking into what users wanted from an Epilepsy prediction app, research indicated that patients were looking for an accurate and non-invasive method of prediction. Approximately 70% of epileptic patients approved of a smartphone and watch-based device monitoring system. Other methods such as leg, upper-arm, chest, or head-based systems had less than 50% approval rates from users. We wanted to design an app that would have an active user base so we decided on a smartphone and smartwatch based design model.

Data:

Next, we had to gather data for our model. We were fortunate enough to obtain two separate datasets for seizure forecasting and stress detection. For seizure forecasting, we obtained data from 25 patients through Seer Medical in partnership with the Epilepsy Foundation. The data was measured using the Empatica E4, which is a medical grade wrist-worn device. The device measured biometrics including acceleration (x, y, z), heart rate, blood volume pressure, temperature, and magnitude. The stress detection dataset included measurements from 15 patients obtained by the University of California Irvine. The measurements were taken by the Empatica E4 as well as a chest-worn device.

With our data gathered, it had to be preprocessed before it could be used in our models. Both datasets were resampled to 128Hz, then normalized via MinMaxScaler(-1, 1). The stress dataset was labeled as stress or non-stress. The Epilepsy dataset was labeled as preictal, ictal, and interictal. Preictal is the period before a seizure, which took place an hour before seizure onset. Ictal is the period during the seizure, and interictal is the period of time between seizures, measured 2 hours after a seizure occurs.

EpiHealth Seizure detection and prediction

Implementation

When researching different models we could use for our project, we decided that a Long Short-term Neural Network (LSTM) would work best since we were working with time series data. LSTM’s perform best when it comes to making predictions with background context. We went with a many-to-one Long Short-term Memory architecture since we had multiple inputs from the measurements taken by the medical devices. Our model received 10 minutes of data at a time and its objective was to classify the inputs as either preictal, ictal, or interictal. For the stress detection model, the same 10 minute interval was used except the model classified the input as stress or non-stress. Both models contained 3 LSTM layers connected to a fully connected neural network. The loss function used was a weighted binary cross entropy loss function.

One of our mentors also suggested using a 1-Dimensional Convolutional Neural Network (1D CNN) for our Epilepsy prediction model. Although it was more of a novel approach, using a CNN was easier and faster to train than an LSTM. Like the LSTM model, our CNN model had several inputs to account for all the measurements taken and its goal was to classify the segments as preictal, ictal, or interictal. It featured several layers including a convolutional layer, a max pool layer, two linear layers and a dropout layer. We hoped to be able to use the CNN alongside the LSTM for more accurate predictions.

EpiHealth Seizure detection and prediction

To train and test our models, we used a leave-one-out cross-validation method. Both the epilepsy prediction model and the stress detection model were trained using all but one of the datasets, which was left out to be used as the testing dataset. We chose a leave-one-out cross-validation method since we were working with a smaller dataset and wanted accurate results. In the end, while our LSTM Epilepsy prediction model had an overall accuracy of 82% and our LSTM stress detection model had an overall accuracy of 76%, these models still had severe issues with unbalanced data and were not able to predict preictal segments with high accuracy. Our CNN epilepsy prediction model seems more promising with an accuracy of 81% with an accuracy rate of 52% when correctly classifying preictal segments. We are currently working on further balancing our data to get our models working to the extent that we would like.

Impact and Innovation

There are many seizure logging and tracking apps already on the market such as Epsy, and SeizAlarm which help patients keep track of their Epilepsy symptoms. To make our app stand out and have an impact, we wanted to include seizure prediction. While we were in the middle of creating our project Seer Medical — the company that gave us access to their epilepsy data - announced their own seizure prediction app to be released into the market. Although we were surprised by the news, we decided to continue with the project. To make our app stand out from the rest, we want to use machine learning to track stress and sleep for epilepsy management. We aim to combine existing epilepsy tracking capabilities with accurate seizure prediction methods, as well as integrating sleep and stress tracking for an all-in-one Epilepsy management app.

Challenges

Data Availability

Shortly after we decided on the idea for our project, we started to look into epilepsy datasets. We realized that there was a limited amount of data that was publicly available to use for our project. We were fortunate enough to be granted access to Seer Medical’s Epilepsy dataset, but we only had data from 25 patients to work with. With such a small dataset, we had to be careful about how we trained and tested our models for optimal accuracy.

Data Imbalance

As mentioned previously, a huge issue for our models is the imbalance of data. With interictal and non-stress periods dominating our epilepsy data and stress data respectively, our models seem to be skewed towards the larger dataset. Experimenting with adding weights was not successful, thus our next steps have been to increase the size of the smaller datasets through creating artificial signals.

Processing Power

Another big challenge that we encountered was storing and processing the massive amounts of data required for our models. We were constantly having to upgrade our storage space and RAM since our models required lots of processing power. Thankfully, the AI4Good Lab was very helpful in reimbursing us for the extra space and we had to purchase.

Time management

We had to create our project on a strict timeline of just under a month. With so little time, we had to carefully plan out our weekly goals, attend meetings with our mentors, and deal with setbacks in a timely manner. We all had busy schedules to work around and managing expectations based on our timeline was crucial. With careful planning and some overtime work, we were able to meet our deadlines.

What we learned & accomplishments we’re proud of

The AI4Good Lab provided us with a great series of lectures, inspiring speakers, and mentor guidance. We learned so much about AI and the Lab taught us the technical skills we needed for our project. Events like the mini-hackathon were fun and helped us develop our time management skills. Our mentors were always there for us to help develop our project every step of the way. We spent so much time working on EpiHealth and we are really proud of the final project that we presented on demo day.

Next Steps

We will continue to work on EpiHealth as a team with the additional resources from winning the Toronto Accelerator Award. The next step in our project is to improve our models and increase their accuracy. We tackled a difficult task by trying to solve a time series problem with minimal data and even with weight, the data imbalance was difficult to overcome. To make improvements, we would like to increase the number of features. We would also want to work with experts in the field and have access to more data.

Additionally, we want to include more integrated stress and sleep cycle modeling. Since we know that there is a link between stress, sleep, and seizure onset, including stress and sleep would allow our app to have more accurate predictions. Finally, we would like to include personalized models, allowing each user to have a custom tailored experience with our app.

Our project is still ongoing; if you would like to get in touch with us, please feel free to reach out at epihealth@gmail.com!

Acknowledgements

We would like to extend our gratitude to our TA, Karissa Chan, for sharing her knowledge with us and helping us create this project. We would also like to thank our team mentors Zafarali Ahmed, and Sylvia (Yu-Jia) Shiah for lending us their expertise during our weekly meetings. Finally, we would like to thank the AI4Good Lab for bringing us together and giving us access to the education and resources needed to create our project!