How srovins/wesad works
Project Type and Purpose
• This is a machine‐learning pipeline for “Stress Detection from Multimodal Wearable Sensor Data” using an autoencoder to extract latent features, followed by classical classifiers (SVM, MLP) for 3-class stress classification.
• It is not a full-stack web app but rather an experimental research/analysis project: data ingestion, preprocessing, feature extraction, model training, and result analysis.
File Structure
• Top-level scripts:
• merge_subj_data.py — loads raw WESAD data, filters and merges sensor streams
• extract_ae_latent_features.py — builds/trains autoencoder, extracts and saves latent features
• ae_feature_extractor.py — contains autoencoder architecture definitions and training logic
• DataPreprocessing.py — (if present) additional cleaning or filtering utilities
• Jupyter notebooks for exploratory analysis and classification experiments:
• ExploratoryDataAnalysis.ipynb
• CNN_Baseline.ipynb, Model1-DNN.ipynb, SVM_classifier.ipynb, MLP_classifier.ipynb
• Data folders:
• data/WESAD/ — raw sensor files
• data/ — generated pickles (merged signals)
• features/train & features/test — latent feature datasets (leave-one-subject-out folds)
• trained_models/ — saved autoencoder encoder weights by fold
• No web server or external API; dependencies are standard Python data science/ML libs (NumPy, Pandas, scikit-learn, TensorFlow/Keras).
README for Insights
• The project flow is clearly defined in 3 ordered steps: data merge/preprocess → AE feature extraction → classifier training + analysis.
• No deployment or microservices; this is a batch/offline pipeline.
Main Components & Interactions
a. Data Ingestion and Preprocessing
• Component: “Raw WESAD Data” (external data source)
• Process: merge_subj_data.py
• Output: merged pickles (subj_merged_*.pkl, merged_chest_fltr.pkl) in data/
b. Autoencoder Feature Extraction
• Component: ae_feature_extractor.py + extract_ae_latent_features.py
• Sub-components:
– AE Model Definition (encoder, decoder)
– Training Engine (LOSOV folds)
– Feature Extraction Module
• Output: latent feature pickles in features/train/ and features/test/
c. Classifier Training & Evaluation
• Components (notebooks):
– SVM_classifier.ipynb
– MLP_classifier.ipynb
– (optional CNN_Baseline.ipynb, Model1-DNN.ipynb)
• Inputs: latent feature pickles
• Outputs: classification results, performance metrics, plots
d. Model Artifacts
• trained_models/c/*.h5 — saved encoder weights by fold
Architectural Patterns & Principles
• Modular pipeline: clear separation of data preparation, feature engineering, and modeling stages.
• Reproducibility: scripts produce deterministic output files; notebooks consume them.
• Leave-one-subject-out (LOSOV) cross-validation pattern, enforced at AE and classifier stages.
• Data-centric design: persistent pickle files as “data at rest” between stages.
Technologies & Frameworks
• Python scripting (merge_subj_data.py, extract_ae_latent_features.py)
• Jupyter Notebooks for analysis and classifier prototyping
• TensorFlow/Keras for autoencoder design and training
• scikit-learn for SVM, MLP classifiers
• Pandas/NumPy for data handling, pickle for serialization
Detailed Recommendations
• “Raw WESAD Data” block on the far left, annotated with the URL of the dataset.
• Then a “Autoencoder Pipeline” container:
• Split into AE Training (encoder/decoder) and Latent Feature Extraction.
• Output to two data stores: features/train and features/test.
• To the right, place two analysis modules: SVM Notebook and MLP Notebook, both consuming the feature stores and producing evaluation plots/tables.
• Underneath, illustrate the trained_models/c folder, showing that encoder weights are persisted for replication.