This project investigates whether physiological arousal and market context jointly predict risky investment decisions under uncertainty.
-
Affective Economics (AE) — trial-level anticipatory skin conductance response (SCR), stock context (mean return, volatility), and binary investment decisions. https://researchdata.bath.ac.uk/699/
-
WESAD - wearable electrodermal activity (EDA) collected during stress / baseline tasks, used as an external physiological validation dataset. https://www.kaggle.com/datasets/orvile/wesad-wearable-stress-affect-detection-dataset/discussion?sort=hotness
Does anticipatory arousal (measured via SCR/EDA) meaningfully predict investment risk-taking, beyond what market information alone explains?
Key Takeaways
- Physiological features alone achieve ~0.88–0.89 accuracy (logistic regression + MLP). Market context alone performs similarly (~0.88) but does not outperform physiology.
- Combined multimodal features (SCR + market) yield the most stable and highest test accuracy (~0.96) using an MLP.
- WESAD analysis shows that EDA-based arousal features are generalizable across tasks, supporting physiological validity.
- Complete AE preprocessing
- AE SCR + market feature engineering
- WESAD EDA loading and window-based feature extraction
- Logistic Regression baseline
- PyTorch MLP and PhysioEncoder classifier
- Ablation study
- Full visualization suite (SCR trajectories, market signals, distributions, correlations, confusion matrices, loss curves)
Everything can be reproduced through a single Jupyter Notebook.
├── cp322_FINAL.ipynb # Main end-to-end notebook for entire project
├── wesad_loader.py # Helper for reading WESAD subject files
├── DATASET/
│ └── AE_investment_dataset.csv # AE dataset (included)
├── README.md # This file
├── Multimodal Physiological Representation Learning for Predicting Risky Financial Decisions.PDF #our IEEE style Machine Learning analysis paper!
├── google drive/
│ └── WESAD/ # WESAD raw data (download via Kaggle), mounted to your google drive when you run the kaggle.JSON api :)
Link to Canva slidedeck (since file size was > 25mb) https://www.canva.com/design/DAG58HDEzxU/oy_v38EArHar4gdRkseWXg/view?utm_content=DAG58HDEzxU&utm_campaign=designshare&utm_medium=link2&utm_source=uniquelinks&utlId=h4156fa62af
Ensure you have a google account. On the ipynb file within this repository, the easiest way to run the notebook would be to click 'view in colab' and click 'run all' from there!
--
The AE investment dataset is already provided to you within this github repo as a .csv file.
WESAD is too large for GitHub. Download it directly into the colab environment. Step A — Install & configure Kaggle Get your kaggle.json from Kaggle:
- Account → API → Create New Token
- make a new file in your editor called 'kaggle.JSON' and format it as:
{ "username": "YOURKAGGLEUSERNAME",
"key": "YOURKAGGLEAPIKEY"
}
Run the Google Colab IPYNB file as intended by clicking 'run all'. When prompted by section 1.2 with a 'choose file' input, input your kaggle.JSON file from your devices' directory
DATASET/WESAD/
├── S2/
│ └── S2_E4_Data/
│ ├── ACC.csv
│ ├── EDA.csv
│ ├── TEMP.csv
│ └── ...
├── S3/
└── ...
Run the sections sequentially on the Colab file.
The AE dataset was provided in wide format. We:
- Removed missing SCR values
- Reconstructed all trials and sessions
- Converted wide → long format
- Produced a 1,200-row trial-level dataset (30 participants × 40 trials)
We engineered dynamic physiological features, including:
- Raw anticipatory SCR
- Participant-normalized SCR (z-score)
- SCR slope
- Lag features (previous trial SCR)
- SCR deltas (trial-to-trial change)
- Rolling window statistics (3-trial mean, std)
We extracted contextual financial variables:
- Expected return per trial
- Stock fluctuation (volatility)
- Combined contextual signal
Visualizations include:
- SCR time series per participant
- 30-participant SCR overview grid
- Market return and volatility trajectories
- SCR distribution & per-participant averages
- Investment rate per participant
- SCR → P(invest) logistic curve
- Correlation matrix
(See Appendix section in the manuscript.)
We compare three feature sets:
| Model Type | Inputs | Accuracy |
|---|---|---|
| SCR-only | physiological only | ~0.88 |
| Market-only | return + volatility | ~0.88 |
| Combined (MLP) | physiology + market | ~0.96 |
Findings:
- SCR-only ≈ Market-only → physiology is equally predictive
- Combined features yield strongest results
- Market variables alone cannot capture “not invest” behaviour
- Physiological arousal contains unique information about avoidance decisions
Using wesad_loader.py, we extract:
- EDA/SCR
- ECG
- Accelerometer
- Temperature
- Respiration
- Heart rate & IBI
- Metadata and ground-truth emotional labels
We segment continuous EDA into 60-second windows with 30-second overlap.
Extracted features:
- mean
- standard deviation
- max
- min
- slope
A logistic regression baseline on windowed WESAD features achieves:
- Accuracy: ~0.80–0.82
This demonstrates strong discriminability between high and low arousal states and supports the use of physiologically-derived features in the AE dataset.
Run AE → preprocessing → LR code block.
Expected:
- ACC ≈ 0.88
- F1 ≈ 0.94
Run the MLP training block.
Expected:
- ACC ≈ 0.96
- F1 ≈ 0.98
Run the ablation section.
Expected:
- SCR-only ≈ 0.88
- Market-only ≈ 0.88
- Combined ≈ 0.96
Run WESAD preprocessing → logistic regression.
Expected:
- ACC ≈ 0.80–0.82
- AE dataset contains only 30 participants → limited generalization
- WESAD labels are coarse and collected in a different context
- Physiological variability across participants required within-subject normalization
- Time constraints limited hyperparameter tuning
- Only EDA/SCR was modeled, not full multimodal signals (ECG, EMG, etc.)
This project was completed by Group 9 for CP322 (Machine Learning).
A summary of roles is included in the paper and repeated here.
- Selected datasets & research question
- Built GitHub repo & Colab environment
- Full AE preprocessing pipeline
- SCR + market feature engineering
- Visualization suite (all figures, statistical plots, trajectories)
- WESAD loader integration
- MLP model & PhysioEncoder
- Ablation experiments
- Report writing, appendix, and README
- Main manuscript writing (Abstract, Introduction, Methodology, Analysis)
- Modeling support & validation diagnostics
- Experiment replication
- Slide preparation & presentation
- Formatted the final IEEE paper
- Reviewed code on the GitHub repository, completed the Experiments and Results section
This repository provides a complete, reproducible pipeline for analyzing how physiological arousal and market context influence risky financial decisions. All figures, analyses, and models can be reproduced.