3. Feature engineering for industrial time-series and multimodal data

Industrial AI systems rarely consume raw sensor streams directly. A vibration channel sampled at 25.6 kHz, a PLC tag polled every 100 ms, a thermal camera at 30 fps, and a maintenance log entry typed by an operator all describe the same asset, but they arrive at different rates, in different units, and with different failure modes. Feature engineering is the layer that converts this heterogeneous material into a consistent, model-ready representation. In production, this layer is not a one-time notebook exercise — it is a versioned, testable pipeline that must behave identically during training and inference.

This chapter covers the four operations that dominate industrial feature pipelines: windowing, resampling, missing-value handling, and domain-specific transformations. The goal is not to enumerate every possible technique, but to establish the engineering decisions that determine whether a model generalizes to the plant floor.

Windowing: Defining the Unit of Observation

Time-series models do not predict on individual samples; they predict on windows. A window is a contiguous slice of a signal that carries enough information to characterize a state. For a bearing-fault classifier on 25.6 kHz vibration data, a common choice is a 1-second window (25,600 samples) with 50% overlap, yielding a 12.8 kHz effective frame rate for downstream features. For a slow thermal process, a 10-minute window with 1-minute stride may be appropriate.

Three parameters define a windowing scheme:

  • Window length — must span at least one full cycle of the slowest phenomenon of interest. For rotating machinery, this means several shaft revolutions; for a thermal ramp, it means the dominant time constant.
  • Stride (hop size) — controls the trade-off between temporal resolution and computational cost. Overlap increases the number of training samples but introduces correlation between adjacent windows, which inflates validation metrics if splits are not grouped by time.
  • Alignment — whether windows are anchored to a fixed clock (tumbling) or to an event (e.g., a trigger from a PLC). Event-anchored windows are essential for transient detection, where the interesting signal is a short burst after a specific machine action.

A frequent production bug is label leakage through windowing: if a window straddles the boundary between a healthy and a faulty period, its label is ambiguous. The standard mitigation is to enforce a guard band — exclude windows that overlap a state transition by less than a defined margin (e.g., 200 ms) from training.

Resampling: Aligning Clocks and Rates

Multimodal industrial data almost never shares a time base. A practical pipeline resamples everything to a common grid before feature extraction. Two directions matter:

Downsampling (high rate → low rate) requires an anti-aliasing filter. Decimating a 25.6 kHz vibration signal to 1 kHz by simple subsampling folds high-frequency energy into the low band and corrupts spectral features. The correct sequence is low-pass filter at the target Nyquist frequency (500 Hz), then decimate. In Python, scipy.signal.decimate(x, q, ftype='fir') performs both steps.

Upsampling (low rate → high rate) is needed when a slow PLC tag must be joined to a fast sensor stream. Forward-fill is acceptable for setpoints and mode flags, but it is wrong for continuous physical quantities — it creates staircase artifacts that distort derivatives. For those, use linear or spline interpolation, and record the interpolation mask so downstream models can distinguish measured from synthesized values.

For joining asynchronous streams, pandas.merge_asof with a tolerance window is the standard tool. A tolerance of one sample period of the slower stream prevents silently matching a PLC reading from minutes earlier.

Missing Values: Causes Determine Treatment

Industrial missing data is not random. It has at least four distinct causes, and each demands a different response:

CauseSignatureAppropriate handling
Sensor dropout / comms lossContiguous NaN blocks, often with a fixed durationMark as invalid; interpolate only if gap < 2× dominant time constant
Machine stoppedZero or constant value, not NaNAdd a binary is_running flag; do not impute
Out-of-range / saturationValue pinned at sensor limitClip and flag; treat as missing for statistical features
Sampling jitterIrregular timestampsResample to uniform grid before any windowing

The default mistake is to call fillna(method='ffill') and move on. This erases the distinction between "the machine was off" and "the sensor failed," which are very different operational states. A robust pipeline emits, alongside each imputed value, a companion indicator channel. Tree-based models can then learn to condition on missingness itself, which is often predictive — a sensor that drops out under high vibration is a signal, not noise.

Common pitfall: Imputing with the global mean computed over the entire dataset leaks future information into training. Always compute imputation statistics on the training split only, and persist them as part of the feature pipeline artifact.

Domain-Specific Transformations

Generic statistical features (mean, std, min, max) are a starting point, but industrial signals reward domain knowledge. For rotating machinery, the most informative features are often in the frequency domain and tied to known kinematics.

Consider a bearing with a known geometry running at a measured shaft speed fr. The characteristic defect frequencies — BPFO, BPFI, BSF, FTF — are computed from the bearing geometry and fr. A powerful feature is the amplitude at these frequencies and their harmonics, extracted via envelope analysis: band-pass the signal around a resonance, compute the Hilbert envelope, then take the FFT of the envelope. This converts a weak, high-frequency bearing impact into a low-frequency, easily detectable modulation.

For thermal and process data, domain transformations include:

  • Rate of change — first derivative over a fixed interval, which often precedes threshold alarms.
  • Deviation from setpoint — the difference between a measured variable and its controller setpoint, more informative than the absolute value.
  • Cumulative sums — for slowly drifting quantities like tool wear or filter loading.

For multimodal fusion, the key transformation is temporal alignment plus cross-modal aggregation. A thermal image at time t must be paired with the vibration window that covers t, and with the most recent maintenance event. The output is a single feature vector per window, with each modality contributing its own block of features.

Industrial Feature Pipeline: From Raw Streams to Model-Ready Windows Vibration 25.6 kHz, continuous PLC Tags 100 ms poll, setpoints Thermal Camera 30 fps, 640×480 Maintenance Log Event-driven, text Resample & Align anti-alias → decimate merge_asof, tolerance Missing-Value Handling classify cause impute + indicator flag Window & Transform 1 s / 50% overlap envelope, Δ, deviation Feature Vector per Window time + freq + cross-modal + missingness Guard Band: exclude windows overlapping state transitions prevents label leakage at healthy ↔ faulty boundaries typical margin: 200 ms or 2× dominant time constant

Putting It Together: A Reproducible Pipeline Contract

The operations above must be packaged so that training and inference produce identical features. A practical contract for an industrial feature pipeline includes:

  1. Input schema — channel names, units, nominal sample rates, and physical ranges. Validate on ingest; reject or flag out-of-range values before they reach feature code.
  2. Resampling spec — target rate, anti-alias filter order and cutoff, interpolation method per channel type (continuous vs. discrete).
  3. Missing-value policy — per-channel rules keyed to the cause taxonomy, plus the indicator channels emitted.
  4. Window spec — length, stride, alignment anchor, guard band.
  5. Transformation list — ordered, with all fitted parameters (filter coefficients, imputation statistics, normalization constants) persisted as artifacts.

When this contract is versioned alongside the model, a feature drift alert becomes actionable: you can diff the pipeline spec between the deployed version and the retrained version and see exactly which parameter changed. Without it, "the model got worse" is an unfalsifiable complaint.

Verification check: Run the pipeline on a held-out raw file twice — once through the training path and once through the inference path. The resulting feature vectors should be bit-identical (or within floating-point tolerance). Any divergence indicates state that leaked outside the persisted artifacts.

The next layer — model architecture and training strategy — assumes these features are trustworthy. In industrial deployments, that assumption is earned by treating feature engineering as production code: versioned, tested, and observable.