2. End-to-end predictive modeling lifecycle
Industrial predictive modeling is not a single modeling exercise; it is a closed-loop engineering lifecycle. A vibration-based bearing fault detector, for example, only creates value when it moves from a business question to a monitored, retrained, and trusted production service. This chapter walks through the seven stages of that lifecycle and shows how each stage constrains the next.
1. Problem Framing: Define the Decision, Not the Algorithm
Start from the maintenance or process decision the model must support. A useful framing statement specifies the unit of prediction (asset, component, batch, or time window), the prediction horizon (e.g., failure within 72 hours), the action triggered (schedule inspection, reduce load, order spare), and the cost asymmetry between false negatives and false positives. For a pump monitored at 1 Hz vibration and 0.1 Hz temperature, a framing might be: "Predict whether pump P-204 will cross its vibration alarm threshold within the next 7 days, so maintenance can be scheduled during the next planned shutdown."
Translate this into a label definition and a target metric. If unplanned downtime costs 20× a planned intervention, optimize recall at a fixed precision floor rather than raw accuracy. Document the label source (work orders, SCADA alarms, or historian tags) and the label delay, because a 7-day horizon means the most recent week of data cannot yet be labeled.
2. Data Acquisition: Sensors, Gateways, and Historians
Industrial data arrives through a layered path: sensor → PLC/DAQ → edge gateway → historian or message broker → analytics store. Each hop introduces sampling jitter, clock skew, and missing values. Capture and store the raw signal plus metadata: sensor ID, unit, calibration date, sampling rate, and gateway timestamp. A practical acquisition contract for a vibration channel might be:
tag: P204.DE.accel
unit: g
sample_rate_hz: 25600
window_s: 1.0
gateway: edge-gw-03
historian: PI
retention_days: 730
Prefer lossless storage of raw waveforms and derive features downstream. If bandwidth forces downsampling, record the decimation factor and anti-alias filter settings so features remain reproducible.
3. Preprocessing: Cleaning Without Destroying Signal
Preprocessing for sensor data differs from tabular ML. Typical operations include:
- Timestamp alignment: resample all channels to a common grid using interpolation, and record the method.
- Outlier handling: distinguish sensor faults (spikes, stuck values, dropouts) from genuine process events. A stuck value is a fault; a step change may be the fault you want to detect.
- Filtering: apply band-pass filtering appropriate to the asset (e.g., 10 Hz–10 kHz for bearing envelope analysis) and document cutoff frequencies.
- Normalization: per-asset z-score or robust scaling using training-set statistics only, to avoid leakage.
4. Feature Engineering: From Waveform to Discriminative Vector
Raw waveforms are rarely fed directly to classical models. For rotating equipment, time-domain features (RMS, kurtosis, crest factor, peak-to-peak) and frequency-domain features (spectral centroid, band energies, envelope-spectrum peaks at bearing defect frequencies) are standard. For a 1-second, 25.6 kHz vibration window, a compact feature vector might contain 12–30 values per window.
Feature engineering must respect the physics. Bearing defect frequencies (BPFO, BPFI, BSF, FTF) depend on geometry and shaft speed; compute them from nameplate data and instantaneous RPM rather than assuming constant speed. When speed varies, use order tracking or angular resampling so features remain comparable across operating points.
5. Model Training: Validation That Respects Time
Industrial data is temporally ordered and often imbalanced. Use time-based splits (train on older data, validate on newer) rather than random shuffling. For a 7-day horizon, a rolling-origin evaluation is appropriate: train on months 1–6, validate on month 7, then advance the window.
Choose a baseline first — a threshold on RMS or a logistic regression on a few features — then compare against gradient-boosted trees or a 1D CNN on raw windows. Report precision, recall, F1, and the confusion matrix at the chosen operating threshold, plus the lead time distribution (how many hours before failure the alarm fired).
6. Deployment: From Notebook to Edge or Cloud Service
Deployment packages the preprocessing, feature extraction, and model into a reproducible artifact. Two common patterns are batch scoring against the historian and streaming inference at the edge. In both cases, pin library versions, expose a versioned API, and log every prediction with its input window hash, model version, and timestamp.
POST /v1/predict
{
"asset_id": "P-204",
"window_start": "2024-06-01T08:00:00Z",
"features": [0.42, 3.11, 1.87, ...],
"model_version": "gbm-2024.05.3"
}
7. Monitoring: Detect Drift Before the Model Fails
Monitoring covers three layers: data quality (missing rate, out-of-range values), feature drift (population stability index or KL divergence against training distribution), and model performance (precision/recall on newly labeled data, alarm rate). Set alert thresholds and a retraining trigger — for example, retrain when PSI on any top-10 feature exceeds 0.2 for two consecutive weeks, or when recall on the latest labeled month drops below 0.7.
Putting It Together: A Minimal Reproducible Run
Consider a worked example on pump P-204. Inputs: 6 months of 1-second vibration windows at 25.6 kHz, shaft speed from a tachometer, and work-order labels. Steps: (1) resample to a 1-second grid and band-pass 10 Hz–10 kHz; (2) compute RMS, kurtosis, crest factor, and envelope-spectrum energy at BPFO; (3) split by time — train on months 1–4, validate on month 5, test on month 6; (4) train a gradient-boosted tree with class weights; (5) select the threshold that yields ≥0.85 precision and report recall and median lead time; (6) deploy as a batch job scoring hourly; (7) monitor PSI weekly and retrain when it exceeds 0.2.
Expected observable outputs are a confusion matrix on month 6, a lead-time histogram, and a drift dashboard. Typical failure symptoms include: high validation recall but poor test recall (distribution shift), alarms clustered at shift changes (label leakage from operator behavior), and sudden PSI spikes after a sensor replacement (calibration change). Each symptom maps to a specific lifecycle stage — retraining, label audit, or preprocessing recalibration — which is why the lifecycle must be treated as a loop, not a line.