Seismic Wave Classification
In this this project, we build and compare recurrent neural network architectures for automatically classifying P-wave and S-wave arrivals in seismic waveform data. Using a dataset of 100,000 five-channel time series (500 timesteps each) derived from the PhaseLink seismic dataset, we frame the task as a sequence-to-sequence binary classification problem, where each timestep in a waveform is labeled as either a P-wave or S-wave arrival. A key challenge is severe class imbalance, with P-wave labels making up roughly 97% of all observations and S-waves only about 3%, making minority-class recall a critical evaluation metric alongside overall accuracy.
We implement a custom PyTorch training pipeline, including a dataset class for sequence data and a trainer class that tracks loss, accuracy, precision, and recall for both classes across epochs. Using this framework, we train and evaluate Simple RNN, Unidirectional LSTM, and Bidirectional LSTM models across a range of hidden unit sizes and learning rates to understand how architecture and capacity affect performance on this imbalanced sequence labeling task.
The results show a clear architectural hierarchy: Simple RNNs struggle badly, topping out at an S-wave recall of about 0.43 and proving highly unstable across learning rates due to vanishing gradients. LSTMs substantially outperform RNNs by mitigating this issue through gating mechanisms, with the best unidirectional model reaching an S-wave recall of about 0.77. Bidirectional LSTMs perform best overall, since processing the waveform in both temporal directions lets the model use future context when classifying each point; the top configuration (128 hidden units) achieves 99.29% overall accuracy and an S-wave recall of 0.90, making it the most effective architecture for detecting the rarer, harder-to-identify S-wave arrivals.