Skip to content

Commit cb983bc

Browse files
committed
docs: add Quick Start section — training data, model deployment, CMS integration
1 parent 42acb42 commit cb983bc

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

guidance-for-predictive-maintenance/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,70 @@ These uploads trigger the following process:
279279
Relevant metrics for the alerts processing workflow, including Lambda invocations, SQS message counts, and DLQ
280280
statistics, can be monitored through CloudWatch dashboards.
281281

282+
## Quick Start: Training Data & Model Deployment
283+
284+
### 1. Generate Training Dataset
285+
286+
Generate 6 months of realistic tire telemetry for 50 vehicles with injected anomalies:
287+
288+
```bash
289+
python3 scripts/generate_training_data.py
290+
```
291+
292+
Output: `data/training/tire_telemetry_full.parquet` (721K records, 17.5 MB)
293+
294+
**Anomaly types injected:**
295+
| Type | Rate | Description |
296+
|------|------|-------------|
297+
| Slow leak | 8% | Gradual pressure loss (0.3–1.2 PSI/day) |
298+
| Puncture | 4% | Sudden pressure drop, rapid continued loss |
299+
| Valve failure | 3% | Intermittent pressure loss/recovery |
300+
| Overinflation | 2% | Pressure 5–10 PSI above normal |
301+
302+
**Features per record:** `pressure`, `temperature`, `tread_depth`, `speed`, `ambient_temp`, `latitude`, `longitude`, `delta_pressure`, `delta_temp`, `label`
303+
304+
**Realistic patterns included:**
305+
- Seasonal temperature effects on pressure (Gay-Lussac's law)
306+
- City-specific climate (Dallas, Atlanta, Chicago, Phoenix, Seattle)
307+
- Rear tire load differential
308+
- Natural tread wear over time
309+
- Sensor noise
310+
311+
### 2. Train & Deploy Model
312+
313+
```bash
314+
# Create SageMaker role and S3 bucket (one-time)
315+
aws iam create-role --role-name cms-sagemaker-execution-role \
316+
--assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"sagemaker.amazonaws.com"},"Action":"sts:AssumeRole"}]}'
317+
aws iam attach-role-policy --role-name cms-sagemaker-execution-role --policy-arn arn:aws:iam::aws:policy/AmazonSageMakerFullAccess
318+
aws iam attach-role-policy --role-name cms-sagemaker-execution-role --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess
319+
aws s3 mb s3://cms-tire-prediction-ACCOUNT-REGION --region REGION
320+
321+
# Train and deploy
322+
python3 scripts/train_model.py \
323+
--region us-east-2 \
324+
--role-arn arn:aws:iam::ACCOUNT:role/cms-sagemaker-execution-role \
325+
--bucket cms-tire-prediction-ACCOUNT-REGION \
326+
--deploy
327+
```
328+
329+
This will:
330+
- Upload normalized training data to S3
331+
- Train a SageMaker Random Cut Forest model (~3 min)
332+
- Deploy a real-time inference endpoint (~5 min)
333+
- Save normalization stats and anomaly threshold to SSM Parameter Store
334+
335+
**SSM Parameters created:**
336+
- `/tire-prediction/prod/normalization-stats` — feature normalization stats
337+
- `/tire-prediction/prod/anomaly-threshold` — anomaly score threshold
338+
- `/tire-prediction/prod/endpoint-name` — SageMaker endpoint name
339+
340+
### 3. CMS Integration
341+
342+
See [CMS Integration Guide](docs/CMS_INTEGRATION.md) for connecting the Connected Mobility telemetry pipeline to the prediction endpoint.
343+
344+
The CMS adapter (`source/lambda/cms_adapter.py`) transforms CMS canonical telemetry (`tire_pressure_fl`, `tire_pressure_fr`, etc.) into the per-tire format expected by the model, and pushes prediction alerts back to the CMS maintenance-alerts table.
345+
282346
## Deployment Prerequisites
283347

284348
### Clone the Repository

0 commit comments

Comments
 (0)