Work P4 Demo

Foreshock

Bearing-fault detection from vibration data, inspired by aircraft health monitoring.

features per window
16
samples per window
2,048
bearing conditions
4

Signal path

  1. Accelerometer 12 kHz vibration signal
  2. Window 2,048 samples, overlapping
  3. Features time, FFT, envelope
  4. RandomForest 16 scaled inputs
  5. Diagnosis fault class and confidence

Where it comes from

Foreshock is inspired by aircraft health-monitoring systems, like the one I built software around at Bell. It is a small, complete predictive-maintenance pipeline for rolling-element bearings, the kind found in motors, pumps, turbines and aircraft accessories.

The signal

When a bearing starts to fail, a tiny defect on one surface strikes the others once per revolution and produces periodic impulses in the vibration signal. How often they repeat depends on which surface is damaged and on the bearing’s geometry. That gives four characteristic fault frequencies: outer race, inner race, rolling element and cage.

Those impulses are weak and buried in noise. Foreshock uses envelope analysis (a Hilbert transform) to demodulate the resonance and expose energy at the fault frequencies, alongside time-domain indicators such as RMS, kurtosis and crest factor, and the raw FFT spectrum.

The pipeline

  1. Load and window. Accelerometer recordings are split into overlapping 2,048-sample windows, each tagged with the recording it came from.
  2. Extract features. Each window becomes 16 features across the time domain, the spectrum and the envelope spectrum.
  3. Classify. A scaler and a RandomForest predict the bearing’s condition, with a confidence score.
  4. Explain. A React app shows the raw waveform, the frequency spectrum, the envelope spectrum and the prediction for any sample or uploaded signal.

Keeping the accuracy honest

The model is trained on the Case Western Reserve University bearing dataset. At a fixed fault size that data is highly separable, so held-out accuracy comes out near 100%.

That number only means something because the train and test split is made by recording, not by window. Overlapping windows from one recording never land on both sides of the split, which is an easy way to inflate this benchmark.

Beyond the classifier

The engine, the Flask API and the React front end are three decoupled layers, and the front end contains no analysis logic.

Around that core, the repo also includes a retrieval-augmented diagnosis layer that runs on a local LLM and has its own evaluation harness, an autoencoder-based health indicator, and a streaming mode over Kafka.

J1 Connector

Open a channel

I'm always open to discussing new opportunities, interesting projects, or just talking tech.

3-pin header · message