Expand description
Level-2 (structural) caption generation.
Detects and describes temporal patterns within each sensor channel:
- Trends – monotonically increasing / decreasing / stable segments identified by fitting linear regression over overlapping windows.
- Anomalies – significant peaks, spikes, and valleys found by a prominence-threshold peak detector.
§Algorithm overview
1. Denormalise (T, C) array.
2. Downsample time axis: 1440 → 36 points (factor 40, average pooling).
3. For every channel in every group:
a. Fit linear regression over windows of size 6, 8, 12 data points
(with 50% overlap). Classify each window as increasing / decreasing /
stable using slope and range thresholds.
b. Run prominence-based peak / valley detector on the downsampled signal.
4. Sample up to `max_insights` per category, format with random templates.
5. Concatenate all group captions.Functions§
- generate_
structural_ caption - Generate a level-2 structural caption.