Learn · 05 · Diagnosis

Diagnosis: fault classification

Once something is unusual, the next question is what. Fault classification learns, from labelled examples, which combinations of features belong to which fault.

Intermediate16 min readInteractive

Classification is drawing boundaries

Every window becomes a point in feature space. A classifier learns boundaries that divide that space into regions, one per fault class. When a new window arrives, the model reports the region it falls in and how sure it is.

Classical baseline · expert rules

"If 2× exceeds 50% of 1×, suspect misalignment. If envelope peaks match BPFO, suspect the outer race." Rules like these encode decades of analyst experience and still work well. Their limits: thresholds are fixed by hand, rules interact awkwardly when two faults coexist, and every new machine type needs new rules.

The explainer uses two features from the feature lab: kurtosis, which reacts to impacts, and the 2× / 1× ratio, which reacts to misalignment. A k-nearest-neighbour (kNN) classifier labels each region by majority vote of the k closest training windows.

kNN decision regions in feature spaceInteractive · click the chart
5 130 Healthy ●Misalignment ■Bearing defect ▲
Prediction at clicked point
–
Leave-one-out accuracy
–
Try it: set k = 1 and the boundary wraps around individual points: the model memorises noise (overfitting). Raise k and the boundary smooths out. Increase the overlap and accuracy falls no matter which k you choose: some faults are not separable with these two features, and the fix is a better feature, not a cleverer model.

Choosing a classifier

ModelHow it decidesStrengthsWatch out for
k-nearest neighboursvote of closest examplessimple, no trainingneeds scaled features, slow on large sets
Logistic regressionweighted sum of featurescalibrated probabilities, explainablelinear boundaries only
Support vector machinewidest-margin boundary, kernels for curvesstrong on small, clean datasetstuning, poor probability estimates
Random Forestmany trees voterobust default, feature importancelarge models, extrapolates poorly
Gradient boosting (XGBoost, LightGBM)trees fixing each other's errorsusually best on tabular featuresoverfits small data without care
1D / 2D CNNlearned filters on raw signals or spectrogramsno hand-crafted featuresneeds thousands of labels, can learn shortcuts

A sensible order of work: start with Random Forest or gradient boosting on 20–50 well-chosen features. Move to CNNs only if you have plenty of labelled data and the tree model has clearly plateaued. See computer vision for maintenance for the CNN route.

Reading a confusion matrix

Accuracy alone hides where a model goes wrong. A confusion matrix counts predictions against truth for every pair of classes.

True ↓ / Predicted →HealthyUnbalanceMisalignmentBearingRecall
Healthy18843594%
Unbalance6913091%
Misalignment21185285%
Bearing9019090%
Precision92%86%92%93%

The diagonal is correct. Two off-diagonal cells matter here. Eleven misalignment windows were called unbalance: both raise low orders, so this is a feature problem, and an axial sensor or phase measurement would help. Nine bearing faults were called healthy (red): those are missed failures, the costliest error in maintenance. You can trade some precision for higher bearing recall by lowering that class's decision threshold.

Evaluate honestly

Published fault-classification papers often report 99%+ accuracy. Real deployments rarely do. The gap usually comes from evaluation shortcuts:

  • Window leakage. Overlapping windows from one recording end up in both training and test sets. Split by recording, by machine or by date.
  • Seeded vs natural faults. A drilled hole in a lab bearing does not look exactly like a fatigue spall. Test on naturally developed damage if you can.
  • New machines. A model trained on one test rig often fails on another. Hold out entire machines to measure transfer.
  • Unknown faults. A classifier must pick one of the classes it knows. Combine it with an anomaly detector and an "unknown" output.

Key takeaways

  • A classifier divides feature space into regions; features determine how separable faults are.
  • Tree ensembles on good features are the strongest default; CNNs need far more labels.
  • Read the confusion matrix, especially missed faults predicted as healthy.
  • Split data by machine or time, and test on natural faults when possible.

Try it in the apps

The Fault Classifier trains kNN, Random Forest and a neural network on simulated vibration, compares them with expert rules, and shows what data leakage does to accuracy.

Open Fault Classifier

Quick quiz