Gains:
- Ability to analyze fault symptoms from vibration/temperature data by extracting features with AI
- Ability to design threshold-based and simple machine learning anomaly detection approaches with the help of AI
- Ability to verify the balance of false alarms (false positives) and missed faults (false negatives) and maintenance decisions
The unexpected failure of a bearing on a production line leads to hours of downtime, missed orders, and sometimes collateral damage. Traditional maintenance stops at two extremes: breakdown maintenance (fix it when it breaks—the most expensive surprise) and periodic maintenance (replace by schedule—often premature and wasteful). Predictive maintenance opens the third way: constantly measuring the actual condition of the machine, predicting failure and intervening just in time. Changes in signals such as vibration, temperature, current and sound indicate a malfunction weeks in advance. AI is powerful here: extracting features from signals, detecting anomalies, estimating remaining lifespan. But one false alarm means unnecessary downtime, one missed fault means disaster; Threshold and decision balance are the responsibility of the engineer. In this unit, we cover how to set up predictive maintenance with AI and validate its decisions.
Why Vibration and Temperature?
Faults in rotating machines leave characteristic signatures. When a bearing wears out, a gear cracks, a shaft becomes unbalanced, energy increases at certain frequencies in the vibration spectrum. Temperature is a slow but reliable indicator of friction and load increase. We extract meaningful features from these signals:
attribute
what does it say
Which malfunction?
RMS (effective value)
General vibration energy
General deterioration, imbalance
peak
sudden blows
Bearing defect, notch
Crest factor (peak/RMS)
Pulse content
Premature bearing failure
kurtosis
The "spikiness" of the distribution
Pulse fault symptom
Dominant frequency (FFT)
The frequency at which energy is collected
Specific component failure
Key idea: instead of looking at the raw signal, we monitor fault-sensitive features. AI quickly writes code that calculates these attributes.
import numpy as npdef jitter_attributes(signal, fs): """signal: acceleration sequence, fs: sampling frequency (Hz).""" rms = np.sqrt(np.mean(signal**2)) peak = np.max(np.abs(signal)) crest = peak / rms if rms > 0 else 0 # kurtosis (fourth moment / variance^2) mean = np.mean(signal) kurtosis = np.mean((signal - mean)**4) / (np.var(signal)**2 + 1e-12) # dominant frequency (FFT) spectrum = np.abs(np.fft.rfft(signal)) frequencies = np.fft.rfftfreq(len(signal), 1/fs) dominant_f = frequencies[np.argmax(spectrum)] return {"rms": rms, "peak": peak, "crest": crest, "kurtosis": kurtosis, "dominant_frequency": dominant_f}
Tip: When extracting features to AI, be sure to specify the sampling frequency (fs) and duration of the signal. FFT resolution and Nyquist limit depend on them; If fs is not given, the dominant frequency will be misinterpreted. Additionally, no threshold is meaningful without collecting a "baseline" from the healthy machine.
Threshold-Based and Learning-Based Detection
There are two basic approaches:
Threshold-based: Exceeding a certain limit of an attribute (e.g. RMS) generates an alarm. Simple, transparent and explainable; But getting the threshold right is difficult and one-dimensional.
Learning-based (anomaly detection): It learns the "normal" from healthy working data and marks deviations from it. It captures multidimensional patterns, but requires more data and risks becoming a “black box.”
import numpy as npdef z_score_anomali(value, baseline_avg, baseline_std, threshold=3.0): """Simple statistical anomaly: how many stds away from the baseline?""" z = (value - baseline_avg) / (baseline_std + 1e-12) return abs(z) > threshold, z# Example: RMS average 0.8 on healthy machine, let std be 0.1alarm, z = z_score_anomaly(value=1.25, baseline_avg=0.8, baseline_std=0.1)print(f"z-score: {z:.1f}, alarm: {alarm}") # z=4.5 -> alarm True
Even this simple z-score approach demonstrates a principle: the threshold is derived from the statistics of the healthy machine, it is not chosen arbitrarily. AI may suggest more advanced methods (Isolation Forest, autoencoder), but they all have the same basis: first define "normal", then measure deviation.
False Alarm and Missed Fault Balance
This is the engineering decision at the heart of predictive maintenance. There are two types of errors and their costs are asymmetric:
Error type
Meaning
cost
False alarm (false positive)
Alarm when there is no fault
Unnecessary posture, loss of confidence
Missed fault (false negative)
No alarm when there is a fault
Unexpected malfunction, damage, danger
If you lower the threshold (too sensitive) the missed fault decreases but the false alarm increases; operators stop relying on alarms ("alarm fatigue"). If you increase the threshold, false alarms decrease, but the risk of missing a real fault increases. The right balance depends on the outcome of the failure: missed failure in a safety-critical component (e.g. a crane brake) is unacceptable, there you keep sensitivity high and put up with false alarms.
Caution: A threshold or model accuracy suggested by the AI (e.g. "95% accuracy") may be misleading due to class imbalance. Malfunctions are rare; Even a model that always says "no failure" shows high accuracy but is of no use. Evaluate the model by false alarm rate and missed failure rate rather than accuracy; Your process risk determines this balance.
From Decision to Maintenance: Human Approval
An anomaly detection is not a direct “stop machine” command; It is a decision support signal. Typical flow: anomaly detected → severity and trend assessed → care team confirms (physical check, additional measurement) → planned intervention. AI can suggest the trend and possible cause, but the decision and timing of “this bearing needs to be replaced” remains with the human; because humans see the production plan, spare parts and safety context.
Weak Prompt / Strong Prompt
WEAK: "Is this vibration data defective?" (No baseline, no fs, no context. Unsubstantiated yes/no.) STRONG: "I have 1 second acceleration data of a bearing sampled at 12 kHz. Calculate RMS, crest factor, kurtosis and dominant frequency. I have a 30-day healthy operating baseline (RMS avg=0.8, std=0.1). This measurement Calculate the z-score from the baseline and interpret it according to the 3-sigma threshold. Raise an alarm, but state that this is a decision support signal and not a definitive fault decision. Compare the dominant frequency with the bearing's characteristic fault frequencies."
Mini Case
Maintenance engineer Emre is installing vibration-based monitoring for a fan motor. It prints feature extraction and z-score anomaly code to AI; The system gives an alarm within a few days. But when Emre checks it, the machine turns out to be intact—false alarm. When he examines it, he realizes that he established the baseline with only 2 hours of data, whereas the vibration of the fan normally fluctuates as the load changes. It extends the baseline to 1 week to cover different load conditions and false alarms are stopped. Then he sees a slow upward trend in the crest factor; This indicates early bearing failure before the RMS has yet crossed the threshold. Physical check confirms premature wear of the bearing. Emre changes the bearing in a planned maintenance, and there is no unexpected stoppage. AI quickly calculated the attribute and anomaly; But baseline quality and trend interpretation—eliminating false alarms and catching real failure early—became the engineer's job.
Common Mistakes
- Setting a threshold without collecting an adequate/representative baseline from the healthy machine.
- Interpreting FFT/dominant frequency without specifying the sampling frequency.
- Evaluating the model with "accuracy" and getting misleading results in case of rare malfunction.
- Choosing the threshold arbitrarily, independent of process risk.
- Mistaking the anomaly signal as a direct stop command and bypassing human verification.
- Looking at a single metric and ignoring the trend (slow rise).
In summary
- Predictive maintenance measures the actual condition of the machine and predicts failure.
- Features such as RMS, crest, kurtosis, dominant frequency are extracted from vibration/temperature.
- Threshold and anomaly detection are derived from the baseline statistic of the healthy machine.
- The balance of false alarms and missed faults is adjusted according to the process risk.
- In rare faults, "accuracy" is misleading; false alarm/miss rates are used.
- The anomaly is a decision support signal; The decision and timing of care remains with the person.
Application task
Find or simulate a vibration or temperature time series (a healthy base + a gradually deteriorating section). Print feature extraction (RMS, crest, kurtosis) and z-score anomaly detection code from baseline to AI. Then: (1) set the baseline only from the healthy section and give the sampling frequency, (2) try the threshold for 2-sigma and 4-sigma and compare how the number of false alarms and missed faults changes, (3) plot the attribute trend instead of a single measurement and see if it gives an early warning. Explain which threshold is appropriate for the risk in your scenario and justify why you chose it.