A reproducible bearing-fault classification pipeline using vibration data from the Case Western Reserve University dataset. The current benchmark uses 16 source recordings covering four bearing conditions and four motor loads. It standardizes signals to 12 kHz, extracts 14 engineered time- and frequency-domain features from balanced windows, trains a Random Forest classifier, and compares three evaluation designs.
A random window split can place windows from one source recording in both training and testing. This project therefore reports the random-window baseline alongside recording-grouped cross-validation and leave-one-load-out evaluation. The grouped and unseen-load evaluations explicitly enforce zero source-recording overlap.
| Property | Value |
|---|---|
| Source recordings | 16 |
| Classes | 4 |
| Motor loads | 0, 1, 2, and 3 HP |
| Windows | 800 |
| Windows per recording | 50 |
| Window size | 2,048 samples |
| Window step | 1,024 samples |
| Effective sample rate | 12 kHz |
| Model features | 14 |
Classes:
- normal
- inner-race fault
- ball fault
- outer-race fault
The versioned dataset manifest is stored at data/manifests/cwru_load_benchmark.csv.
Raw .mat files remain local and are excluded from Git.
| Evaluation strategy | Accuracy | Macro F1 | Maximum overlapping source recordings |
|---|---|---|---|
| Random window split | 1.000 | 1.000 | 16 |
| Grouped recording CV | 1.000 | 1.000 | 0 |
| Leave-one-load-out | 1.000 | 1.000 | 0 |
All four held-out motor loads tied at 1.000 accuracy and 1.000 macro F1.
The key methodological result is that grouped recording and leave-one-load-out evaluation both use zero overlapping source recordings, while the random-window baseline contains all 16 source recordings in both training and test data.
Detailed metrics, per-class results, recording-level predictions, confusion matrices, and limitations are documented in docs/leakage_aware_evaluation.md.
- Read the versioned dataset manifest.
- Download and verify 16 MATLAB recordings.
- Resample normal recordings from 48 kHz to 12 kHz.
- Select 50 evenly distributed windows per recording.
- Extract 14 time- and frequency-domain features.
- Train a class-weighted Random Forest with 200 trees.
- Run random-window, grouped-recording, and leave-one-load-out evaluation.
- Aggregate window probabilities into recording-level predictions.
- Generate CSV, JSON, text, and image reports.
- Validate split integrity and committed result artifacts.
Run these commands from the repository root:
python scripts/download_cwru_load_benchmark.py
python scripts/build_cwru_load_features.py
python scripts/run_leakage_aware_evaluation.py
python scripts/generate_leakage_aware_report.py
python src/validate_leakage_aware_results.py
pytest
The automated tests use synthetic signals and temporary MATLAB files, so CI does not need the external CWRU dataset.
results/leakage_aware_evaluation/strategy_comparison.csvresults/leakage_aware_evaluation/fold_metrics.csvresults/leakage_aware_evaluation/window_predictions.csvresults/leakage_aware_evaluation/recording_predictions.csvresults/leakage_aware_evaluation/per_class_metrics.csvresults/leakage_aware_evaluation/analysis_summary.jsondocs/leakage_aware_evaluation.md
The test suite covers manifest parsing, MATLAB loading, sample-rate standardization, window selection, feature extraction, split invariants, recording-level aggregation, report generation, tied-result handling, and reusable validation-toolkit integration.
Run:
pytest
The perfect benchmark scores do not establish production readiness.
- All recordings come from one laboratory test rig.
- The benchmark uses only the 0.007-inch fault diameter.
- Only the 6 o'clock outer-race position is included.
- Normal and fault recordings originated from different sampling configurations.
- Resampling cannot remove every acquisition-domain difference.
- No independent machine or external bearing dataset has been tested.
- No sensor drift, calibration, maintenance-cost, or deployment monitoring study is included.
- Fault-diameter generalization with an unseen severity.
- Time-domain versus frequency-domain feature ablation.
- Comparison with one additional classical model.
- Controlled noise, amplitude-scaling, and filtering tests.
- CPU latency, memory, and saved-model-size benchmarking.
- Comparison with a compact raw-signal model.
The project integrates ml-testing-validation-toolkit for reusable feature-table and model-output checks.
Leakage-specific invariants are implemented directly in this repository because they depend on source-recording and motor-load metadata.

