Skip to content

a two-step LSTM-TabNet model that first captures temporal dependencies with an LSTM and then uses TabNet for robust feature selection and classification

Notifications You must be signed in to change notification settings

NazimBL/Two-Step-Deep-Neural-Network

Repository files navigation

A Two-Step DNN Approach for Context-Aware Health Monitoring

Paper

This repository contains the source code for a Two-Step Deep Neural Network designed to monitor the health and activities of Hajj pilgrims using wearable sensor data.

The approach combines Long Short-Term Memory (LSTM) networks for temporal feature extraction with TabNet for robust feature selection and classification.


Research Overview

Paper: A Positionally Encoded Transformer for Monitoring Health Contexts of Hajj Pilgrims from Wearable Sensor Data Published In: AMIA Joint Summits on Translational Science Proceedings (2025)
Link: Read on PubMed Central

The "Two-Step" Methodology

This project implements a hybrid architecture to handle the complex, time-series nature of physiological data:

  1. Step 1 (Temporal Extraction): An LSTM processes the raw time-series sequences (e.g., heart rate over time) to capture sequential dependencies and hidden temporal patterns.
  2. Step 2 (Classification): The output embeddings are fed into TabNet (an attentive tabular learning model), which dynamically selects the most relevant features to classify the pilgrim's current state.

This method was evaluated on three distinct prediction tasks:

  • Physical Tiredness: 5 levels (Not tired to Extremely tired).
  • Emotional Mood: 3 states (Negative, Neutral, Positive).
  • Rukun Activity: 16 specific Hajj rituals.

The Dataset

The model utilizes the Hajj Crowd Activity Prediction Dataset (available on Kaggle). It consists of physiological data collected from wearable sensors (e.g., Empatica E4, Zephyr BioHarness) worn by pilgrims during the Hajj.

Key Features used in this code:

  • Physiological: Heart Rate (HR), Heart Rate Variability (HRV), Respiration Rate, Galvanic Skin Response (GSR), Skin Temperature.
  • Motion: Accelerometer data (X, Y, Z), Peak Acceleration.
  • Context: Altitude.

Code Structure & Description

This repository is organized to allow reproduction of the specific experiments described in our research.

File Name Description
PreProcessing.py Data Cleaning & Normalization:
• Performs outlier detection and Z-score normalization on raw sensor data.
• Handles missing values and aggregates data into participant-specific sequences.
• Prepares the input tensors for the LSTM.
TwoStep_physicalTiredLevel_Prediction.py Tiredness Model:
Implements the LSTM+TabNet architecture specifically tuned to classify the 5 levels of physical fatigue.
TwoStep_emotionalMoodLevel_Prediction.py Mood Model:
Implements the architecture to classify emotional states (Negative/Neutral/Positive).
TwoStep_rukun_Prediction.py Activity Model:
Implements the architecture to recognize which of the 16 Hajj rituals (Rukun) the pilgrim is currently performing.

Citation

If you use this code or methodology in your research, please cite the paper below =) :

@article{belabbaci2025positionally,
  title={A Positionally Encoded Transformer for Monitoring Health Contexts of Hajj Pilgrims from Wearable Sensor Data},
  author={Belabbaci, Nazim A and Anaadumba, Raphael and Alam, Mohammad Arif Ul},
  journal={AMIA Joint Summits on Translational Science proceedings},
  volume={2025},
  pages={84--94},
  year={2025},
  publisher={American Medical Informatics Association}
}

About

a two-step LSTM-TabNet model that first captures temporal dependencies with an LSTM and then uses TabNet for robust feature selection and classification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages