PowerNap is a comprehensive data analysis project that explores the intricate relationship between sleep patterns, socio-economic factors, and overall well-being. The project leverages a combination of data analysis, machine learning, and an interactive web application to provide users with both macro-level insights into sleep disparities across different communities and micro-level analysis of их personal sleep data.
This project is driven by the understanding that sleep is a critical component of a healthy and productive life. By analyzing sleep data in conjunction with socio-economic data, we can identify and address disparities that may exist, contributing to a more equitable and inclusive society.
- Socio-Economic Mapping: Visualizes the correlation between sleep duration and socio-economic indicators across different geographical areas in the United States.
- Personal Sleep Data Analysis: Allows users to upload their own sleep data (in
.npyformat) for in-depth analysis and visualization. - Sleep Stage Prediction: Utilizes a variety of machine learning models to predict sleep stages from raw EEG data.
- Interactive Web Application: A user-friendly GUI built with Taipy that provides an interactive platform for data exploration and model interaction.
The data analysis and mapping component of this project is handled by an R script (DATATHON2024_DEI.R) that utilizes the following libraries:
tidycensus: To extract ACS data from the US Census.dplyrandtidyr: For data manipulation and processing.ggplot2andsf: For creating insightful and visually appealing maps.
The script merges sleep survey response data from the CDC with socio-economic data from the US Census to create a comprehensive dataset for analysis.
The machine learning pipeline is built in Python (ML.py) and leverages the following libraries:
numpyandpandas: For data manipulation and analysis.mne: For processing and analyzing EEG data.tensorflowandkeras: For building and training Deep Neural Network (DNN) and Convolutional Neural Network (CNN) models.xgboost: For implementing our XGBoost model for sleep stage classification.scipy: For signal processing, including the Fast Fourier Transform (FFT).
The ML pipeline preprocesses raw EEG data by performing an FFT and extracting power in different spectral bands (Alpha, Beta, Delta, Theta, and Sigma waves). This frequency-domain data is then used to train our models to predict sleep stages. Our models achieve an accuracy of 85% on our test set.
The interactive user interface is a web application built with the Taipy framework in Python (dashboard.py). The application allows users to:
- Upload their own sleep data for analysis.
- Visualize both raw and processed sleep data.
- Select and run different machine learning models on their data.
- View and download the results of their sleep stage analysis.
To run the PowerNap web application, you will need to have Python and the required libraries installed. You will also need to manually upload the default data files, p00_n1_NEW_X.npy and p00_n1_NEW_y.npy, to the web-app/taipy/data directory.
Once the data is in place, you can launch the interactive GUI by running dashboard.py from the web-app/taipy directory.
This project uses Git for version control. A git_cheat_sheet.pdf is included in the repository for easy reference to common Git commands.