Skip to content
This repository was archived by the owner on Sep 22, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,443 changes: 1,443 additions & 0 deletions AI Guardian/AlertSystemGMAI/AlertSystemScript.ipynb

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions AI Guardian/AlertSystemGMAI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Alert System Task – William Jackson

## Overview

Behavioural anomaly detection pipeline using an LSTM autoencoder and simple classifiers.
The autoencoder is trained on supporter behaviour sequences and reconstruction error is used to map anomalies into Low / Medium / High risk.
Random Forest and MLP classifiers are also trained to detect anomalies from the same features.

## Features

- Steps taken
- Calorie intake
- Sleep hours
- Water intake (ml)
- Bathroom visits
- Exercise minutes (if available)
- Meals skipped (if available)

## Contents

- `AlertSystemScript.ipynb` – main notebook (training, scoring, exporting results)
- `artifacts/` – models and outputs
- `guardian_lstm_autoencoder.keras`
- `guardian_behavior_rf.joblib`
- `guardian_behavior_mlp.joblib`
- `scaler.npy`
- `guardian_ae_predictions.csv`
- `guardian_classifier_predictions.csv`
- `top_alerts.csv` – shortlist of medium/high alerts top 30

## How to run (Colab)

1. Upload the dataset with original headers (`patientId, observationEnd, stepsTaken, calorieIntake, sleepHours, waterIntakeMl, bathroomVisits, exerciseMinutes, mealsSkipped`) to `/content/`.
2. Set the dataset path at the top of the notebook:
```python
CSV_PATH = "/content/New AI spreadsheet - Sheet1.csv"
```
3. Run the notebook end-to-end.
4. Outputs will be saved to /content/:

- guardian_ae_predictions.csv
- guardian_classifier_predictions.csv
- top_alerts.csv
44 changes: 44 additions & 0 deletions AI Guardian/AlertSystemGMAI/RUNBOOK_WJ_Alerts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Runbook – William Jackson

## Requirements

- Python 3.9+
- Recommended environment: Google Colab
- Packages needed: numpy, pandas, scikit-learn, tensorflow, matplotlib, joblib

In Colab install with:

```bash
!pip install numpy pandas scikit-learn tensorflow matplotlib joblib
```

## Dataset

File: New AI spreadsheet - Sheet1.csv
Headers required:
patientId, observationEnd, stepsTaken, calorieIntake, sleepHours, waterIntakeMl, bathroomVisits, exerciseMinutes, mealsSkipped

Upload the CSV to /content/ when running in Colab.

## Steps

1. Upload dataset to /content/.
2. Open AlertSystemScript.ipynb.
3. At the top, set the dataset path:
```python
CSV_PATH = "/content/New AI spreadsheet - Sheet1.csv"
```
4. Run the notebook in its entirety
5. Outputs will be saved to /content/:
- guardian_ae_predictions.csv
- guardian_classifier_predictions.csv
- top_alerts.csv (top 30 medium/high alerts)

## Artifacts

The ipynb file Training also creates:

- guardian_lstm_autoencoder.keras
- guardian_behavior_rf.joblib
- guardian_behavior_mlp.joblib
- scaler.npy
Loading