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.
Choosing a classifier
| Model | How it decides | Strengths | Watch out for |
|---|---|---|---|
| k-nearest neighbours | vote of closest examples | simple, no training | needs scaled features, slow on large sets |
| Logistic regression | weighted sum of features | calibrated probabilities, explainable | linear boundaries only |
| Support vector machine | widest-margin boundary, kernels for curves | strong on small, clean datasets | tuning, poor probability estimates |
| Random Forest | many trees vote | robust default, feature importance | large models, extrapolates poorly |
| Gradient boosting (XGBoost, LightGBM) | trees fixing each other's errors | usually best on tabular features | overfits small data without care |
| 1D / 2D CNN | learned filters on raw signals or spectrograms | no hand-crafted features | needs 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 → | Healthy | Unbalance | Misalignment | Bearing | Recall |
|---|---|---|---|---|---|
| Healthy | 188 | 4 | 3 | 5 | 94% |
| Unbalance | 6 | 91 | 3 | 0 | 91% |
| Misalignment | 2 | 11 | 85 | 2 | 85% |
| Bearing | 9 | 0 | 1 | 90 | 90% |
| Precision | 92% | 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.