Communication-Efficient Spatial-Temporal Aggregation for sensor fault diagnosis.
CESTA is a research codebase for studying communication-aware fault diagnosis in sensor networks. It provides a reproducible pipeline for raw-data transformation, temporal and spatial-temporal model training, communication-cost evaluation, and run artifact persistence.
The current research focus is a receiver-side learned request mechanism: each sensor node first reasons from local temporal evidence, then selectively requests neighbor information over existing graph edges when communication is expected to improve diagnosis.
Dense spatial-temporal models can improve diagnosis by sharing neighbor context, but they often assume all graph communication is always available and free. CESTA targets the harder edge-oriented setting where radio communication is costly, dynamic, and should be justified by diagnostic value.
The main experimental question is:
Can selective receiver-side communication exceed strong temporal-only macro-F1 while reducing communication energy relative to dense spatial message passing?
See docs/PROPOSAL.md, docs/EXPERIMENT.md, docs/RESULT.md, and PLAN.md for the research motivation, protocol, current results, and remaining milestones.
- Markov-chain injection of realistic sensor faults:
SPIKE,DRIFT, andSTUCK. - Temporal baselines: CNN1D, LSTM, GRU, Transformer, Autoformer, Informer, PatchTST, and ModernTCN.
- Spatial-temporal baselines: ST-GCN and dense CESTA over canonical graph-aware datasets.
- Communication-aware CESTA with receiver-side Gumbel request gating, optional neighbor belief messages, communication-conditioned correction, VOI-style objectives, and CRF sequence decoding.
- Canonical dataset transformation from raw readings, fault injection, Intel connectivity, node positions, dynamic link masks, and edge distances.
- Reproducible run artifacts: manifests, configs, checkpoints, histories, evaluation metrics, predictions, and communication metrics.
- Optuna hyperparameter optimization for reproducible model selection.
- Optional ESP32-S3 Rust firmware for lab sensor collection over MQTT.
- Python 3.11 or newer
uvfor environment management- CUDA-compatible PyTorch is configured through
pyproject.tomlvia the PyTorch CUDA 12.4 index
git clone https://github.com/Sinner/CESTA.git
cd CESTA
uv syncVerify the CLI:
uv run cesta --help
uv run cesta list models
uv run cesta list datasetsThe standard workflow is transform, training, and evaluation.
# 1. Transform raw Intel sensor data into a canonical dataset
uv run cesta transform intel_lab data/raw/Intel/data.txt data/canon/intel_lab --config config/data/intel_fault15.yaml
# 2. Train a temporal baseline
uv run cesta train config/model/gru.yaml data/canon/intel_lab
# 3. Train CESTA
uv run cesta train config/model/cesta.yaml data/canon/intel_lab
# 4. Evaluate a run
uv run cesta evaluate --model runs/cesta/<run_id> --data data/canon/intel_labDiagnosis-focused configurations live under config/model/diagnosis/ and encode the current higher-end research settings for dense, request-gated, residual, and capacity-matched CESTA variants.
CESTA separates the data lifecycle into raw sources and canonical datasets.
- Raw loaders normalize source data into a common sensor-time table.
cesta transformadds synthetic fault labels, graph topology, dynamic communication masks, node positions, and edge distances.- Window preparation produces chronological train/validation/test splits for temporal or graph-aligned training.
Graph models receive per-window tensors with node masks and edge masks, so missing node readings and unavailable communication links can be handled without requiring complete-case timestamps.
| Family | Models | Notes |
|---|---|---|
| Temporal | cnn1d, lstm, gru, transformer, autoformer, informer, patchtst, modern_tcn |
Strong local-only baselines for fault diagnosis. |
| Spatial-temporal | stgcn, cesta |
Require graph metadata serialized by cesta transform. |
| Communication-aware | cesta |
Supports dense, no-communication, and receiver-side Gumbel request modes. |
CESTA can be configured with graph residual fusion, learned request gates, communication penalties, neighbor belief features, boundary supervision, communication-conditioned correction, structured top-k requests, VOI-style gate loss, and CRF decoding.
Training is config-file-first. Model, optimizer, data-window, split, loss, and communication settings are stored in YAML and validated by Pydantic.
uv run cesta train config/model/lstm.yaml data/canon/intel_lab
uv run cesta train config/model/diagnosis/cesta_diag_70_15_15_dense.yaml data/canon/Intel_fault15Large command surfaces use YAML or JSON config files; smaller utility commands keep direct CLI options. This keeps experiment settings reproducible and avoids hidden command-line state.
Each training invocation creates a new run directory and never overwrites previous runs.
runs/<model>/<utc_ts>_<model>_seed<seed>_<shortsha>/
├── weight.pt
├── config.json
├── history.jsonl
├── manifest.json
├── eval_metrics.json
└── predictions.npz
Communication-aware models also write communication metrics during evaluation when available.
cesta
├── transform # Transform raw data into a canonical dataset
├── train # Train from a YAML/JSON config
├── evaluate # Evaluate a trained run
├── optimize # Run Optuna hyperparameter search
│ └── show # Display study results
└── list # List datasets, models, or metrics
Run uv run cesta <command> --help for command-specific options.
src/CESTA/
├── schema/ # Pydantic configs and manifest schemas
├── batch.py # Runtime batch contracts
├── artifacts.py # Run artifact and checkpoint helpers
├── workflows/ # Reusable train/evaluate orchestration
├── cli/ # Typer CLI
├── injection/ # Markov generator and fault injectors
├── datasets/ # Raw loaders and canonical dataset artifacts
├── models/ # Temporal, spatial, and CESTA model definitions
├── training/ # Trainer, losses, callbacks, objectives
├── evaluation/ # Metrics, evaluator, communication reporting
├── optimization/ # Optuna search spaces and optimizer
├── utils.py # Runtime helpers
└── seed.py # Reproducibility helper
config/ # Data transform, model, and diagnosis YAML configs
docs/ # Proposal, experiment plan, and research notes
firmware/ # ESP32-S3 Rust firmware for optional data collection
notebooks/ # Analysis notebooks
runs/ # Generated experiment artifacts
Use the project tools through uv.
uv run ruff check src/CESTA
uv run ruff format src/CESTA
uv run pyright src/CESTAAfter code changes, run the most targeted validation first, then broaden to ruff and pyright when appropriate.
The optional firmware stack targets ESP32-S3 devices collecting DHT11 readings and publishing JSON payloads over MQTT. See firmware/README.md for build, flash, MQTT, and lab deployment details.
- Implement a
BaseDatasetsubclass insrc/CESTA/datasets/raw/. - Define
name, feature columns, grouping, timestamp handling, loading, and preprocessing. - Register it in
src/CESTA/datasets/raw/__init__.py.
- Add the enum value in
src/CESTA/schema/fault.py. - Implement an injector in
src/CESTA/injection/faults.py. - Register it in
src/CESTA/injection/registry.py. - Add default Markov settings in
MarkovConfig._default_fault_configs()if it should be part of the standard injection profile.
- Implement a
BaseModelsubclass undersrc/CESTA/models/temporal/orsrc/CESTA/models/spatial/. - Declare required metadata such as
graphornode_identitywhen needed. - Add metadata extraction logic in
src/CESTA/models/registry.pyif the constructor needs dataset metadata. - Register the model in
src/CESTA/models/registry.py.
This is an active research repository. APIs and experiment settings may change as hypotheses are tested. Treat docs/PROPOSAL.md, docs/EXPERIMENT.md, docs/RESULT.md, PLAN.md, and checked-in configs as the canonical references for current research intent and experimental protocol.