Upload folder using huggingface_hub
Browse files- README.md +110 -1
- config.json +12 -0
- model.pt +3 -0
- scaler.pkl +3 -0
README.md
CHANGED
|
@@ -1,3 +1,112 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- pytorch
|
| 5 |
+
- anomaly-detection
|
| 6 |
+
- health
|
| 7 |
+
- fitness
|
| 8 |
+
- overtraining
|
| 9 |
+
- autoencoder
|
| 10 |
+
- whoop
|
| 11 |
+
library_name: pytorch
|
| 12 |
---
|
| 13 |
+
|
| 14 |
+
# WHOOP Overtraining Detection Model (CONV)
|
| 15 |
+
|
| 16 |
+
This is a CONV autoencoder model trained to detect overtraining patterns in WHOOP fitness data.
|
| 17 |
+
|
| 18 |
+
## Model Description
|
| 19 |
+
|
| 20 |
+
This model analyzes physiological metrics (HRV, resting heart rate, sleep quality, strain, etc.) to identify
|
| 21 |
+
unusual patterns that may indicate overtraining, illness, or injury risk.
|
| 22 |
+
|
| 23 |
+
**How it works:**
|
| 24 |
+
1. The autoencoder learns to reconstruct "normal" physiological patterns
|
| 25 |
+
2. High reconstruction error indicates the pattern is unusual/anomalous
|
| 26 |
+
3. Anomaly scores are computed as standard deviations from normal
|
| 27 |
+
|
| 28 |
+
## Model Architecture
|
| 29 |
+
|
| 30 |
+
- **Type**: CONV Autoencoder
|
| 31 |
+
- **Input**: 7-day sequences of 33 physiological features
|
| 32 |
+
- **Latent Size**: 32
|
| 33 |
+
- **Parameters**: N/A
|
| 34 |
+
|
| 35 |
+
## Performance Metrics
|
| 36 |
+
|
| 37 |
+
| Metric | Value |
|
| 38 |
+
|--------|-------|
|
| 39 |
+
| Test Loss | 0.2008 |
|
| 40 |
+
| Error Mean | 0.1413 |
|
| 41 |
+
| Error Std | 0.0378 |
|
| 42 |
+
| Anomaly Threshold | 0.2113 |
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
import torch
|
| 48 |
+
import joblib
|
| 49 |
+
from huggingface_hub import hf_hub_download
|
| 50 |
+
|
| 51 |
+
# Download model and scaler
|
| 52 |
+
model_path = hf_hub_download(repo_id="iserrano0511/whoop-overtraining-detector", filename="model.pt")
|
| 53 |
+
scaler_path = hf_hub_download(repo_id="iserrano0511/whoop-overtraining-detector", filename="scaler.pkl")
|
| 54 |
+
|
| 55 |
+
# Load checkpoint
|
| 56 |
+
checkpoint = torch.load(model_path, map_location='cpu', weights_only=False)
|
| 57 |
+
scaler = joblib.load(scaler_path)
|
| 58 |
+
|
| 59 |
+
# Create model (you'll need the model.py from the repo)
|
| 60 |
+
from model import create_autoencoder
|
| 61 |
+
|
| 62 |
+
model = create_autoencoder(
|
| 63 |
+
model_type=checkpoint['model_type'],
|
| 64 |
+
input_size=checkpoint['input_size'],
|
| 65 |
+
seq_len=checkpoint['seq_len'],
|
| 66 |
+
hidden_size=checkpoint['hidden_size'],
|
| 67 |
+
latent_size=checkpoint['latent_size'],
|
| 68 |
+
num_layers=checkpoint['num_layers'],
|
| 69 |
+
dropout=checkpoint['dropout']
|
| 70 |
+
)
|
| 71 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
| 72 |
+
model.eval()
|
| 73 |
+
|
| 74 |
+
# Use for inference
|
| 75 |
+
# data should be shape (batch, 7, 33) - 7 days, 33 features
|
| 76 |
+
# scaled using the provided scaler
|
| 77 |
+
with torch.no_grad():
|
| 78 |
+
x_recon, latent = model(data)
|
| 79 |
+
error = ((data - x_recon) ** 2).mean(dim=(1, 2)) # Per-sample MSE
|
| 80 |
+
|
| 81 |
+
# Check for anomalies
|
| 82 |
+
threshold = checkpoint['threshold']
|
| 83 |
+
is_anomaly = error > threshold
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Features Used
|
| 87 |
+
|
| 88 |
+
The model uses 33 engineered features including:
|
| 89 |
+
- **Physiological**: HRV, resting heart rate, respiratory rate, skin temp deviation
|
| 90 |
+
- **Sleep**: Hours, efficiency, deep/REM ratios, sleep debt indicator
|
| 91 |
+
- **Strain**: Day strain, cumulative strain (3d/7d), strain-recovery ratio
|
| 92 |
+
- **Trends**: Rolling 3-day and 7-day averages, day-over-day changes
|
| 93 |
+
|
| 94 |
+
## Limitations
|
| 95 |
+
|
| 96 |
+
- Trained on synthetic WHOOP-style data
|
| 97 |
+
- Best used as a screening tool, not diagnostic
|
| 98 |
+
- Individual baselines vary - results should be interpreted in context
|
| 99 |
+
|
| 100 |
+
## Citation
|
| 101 |
+
|
| 102 |
+
If you use this model, please cite:
|
| 103 |
+
|
| 104 |
+
```
|
| 105 |
+
@misc{whoop-overtraining-detector,
|
| 106 |
+
author = {Your Name},
|
| 107 |
+
title = {WHOOP Overtraining Detection Model},
|
| 108 |
+
year = {2024},
|
| 109 |
+
publisher = {Hugging Face},
|
| 110 |
+
url = {https://huggingface.co/iserrano0511/whoop-overtraining-detector}
|
| 111 |
+
}
|
| 112 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "conv",
|
| 3 |
+
"input_size": 33,
|
| 4 |
+
"seq_len": 7,
|
| 5 |
+
"hidden_size": 64,
|
| 6 |
+
"latent_size": 32,
|
| 7 |
+
"num_layers": 2,
|
| 8 |
+
"dropout": 0.2,
|
| 9 |
+
"threshold": 0.21133320033550262,
|
| 10 |
+
"train_error_mean": 0.1413002759218216,
|
| 11 |
+
"train_error_std": 0.03776929900050163
|
| 12 |
+
}
|
model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f299b4a220670dd420e6e4621be2a659c87b8631bfbd23b2cc93d5ce88378448
|
| 3 |
+
size 159887
|
scaler.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e841dacdf6c68b76e8f90e3effae25577647fb293d6bb24e336de5a99f6bbf4
|
| 3 |
+
size 927
|