This repository was archived by the owner on Sep 22, 2025. It is now read-only.
added_lstm_model_alert_system#353
Open
pasanweerawardana wants to merge 1 commit intoGopher-Industries:masterfrom
Open
added_lstm_model_alert_system#353pasanweerawardana wants to merge 1 commit intoGopher-Industries:masterfrom
pasanweerawardana wants to merge 1 commit intoGopher-Industries:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Summary
This PR introduces two major contributions to the Guardian Monitor AI module:
A robust data generation framework for synthetic patient monitoring.
A complete model formation pipeline covering data preparation, feature engineering, exploratory analysis, baseline models, and an advanced LSTM sequence model.
Together, these form a reproducible end-to-end workflow for generating, preparing, and modeling patient health and risk alert data.
🔹 Key Additions
Generates realistic multi-day patient datasets with 10-minute monitoring intervals.
Includes vitals (HR, SpO₂, BP, temperature, resp. rate), wearable signals (steps, accelerometer), and contextual features (activity level, meals, emotions).
Built-in rule-based logic for risk_alert labels, capturing anomalies (e.g., high HR, low SpO₂, abnormal meal/emotion effects).
Produces modular CSV batches for scalable experimentation.
EDA: Distribution checks, correlation analysis, and anomaly detection.
Feature Engineering: Rolling statistics (5-min, 60-min), HRV, step variability, and meal effects.
Data Prep: Scaling, encoding, and patient-level train/test split to avoid leakage.
Baseline Models: Logistic Regression and Random Forest with feature importance analysis.
Advanced Model: LSTM sequence model trained on 10-minute windows (~2 hours context).
Achieved ROC-AUC = 1.0 and PR-AUC ≈ 0.9999 on test data.
Very low false positives/negatives (≈ 4 misclassifications out of ~2000 samples).
Visualization: Training curves (loss, AUC, precision/recall), ROC/PR plots, and confusion matrix heatmap.
🔹 Why This Matters
Establishes a realistic, reproducible dataset for training/testing.
Provides a baseline-to-advanced modeling pipeline for Guardian Alert System development.
Lays the foundation for future experimentation (e.g., longer sequences, CNN-LSTM hybrids, real-time API integration).
✅ Next Steps
Extend generation to larger patient cohorts and longer monitoring periods.
Test alternative architectures (GRU, CNN-LSTM, Transformer).
Integrate trained models into the Guardian Alert System API for real-time monitoring.