Skip to content
erzurumlu.dev
← All projects

Sismik Analiz.

A negative result is still a finding.

Can past earthquake magnitudes alone predict the next magnitude?

Role
Deep learning model
Scope
4 people
Year
2025
Bi-LSTM R² = 0.10Attention LSTM R² = 0.02
model_comparison.ipynb
Bi-LSTM   R² = 0.10Actual magnitudePredicted magnitude
Attention LSTM   R² = 0.02Actual magnitudePredicted magnitude
Illustrative interface · Sample data

The right question. The right metric.

I examined whether past earthquake magnitudes alone can predict the next magnitude using deep learning.

0earthquake records
0step windows
0PyTorch models
Method and process
Time seriesEarthquake magnitudes in chronological order.
20-step windowsCreate 20-step input sequences.
Two LSTM modelsTrain Bi-LSTM and attention LSTM in PyTorch.
Test-set R²Evaluate with coefficient of determination.

My contribution.

Bi-LSTM and attention LSTM in PyTorch.

Bi-LSTM
20 × 1LSTMDenseŷ
PyTorch · model architecture
Attention LSTM
20 × 1LSTMAttentionŷ
PyTorch · model architecture

This setup cannot predict magnitude.

Both models showed low explanatory power on the test set. Past magnitudes alone do not appear sufficient to predict the next earthquake’s magnitude.

Bi-LSTM · R² = 0.10True magnitude
Attention LSTM · R² = 0.02True magnitude

What I learned.

Preventing data leakage matters more than a flattering score.

Tech stack.

  • Python
  • PyTorch
  • Jupyter
  • Bi-LSTM
  • Attention
Technical notes and project scope

The problem and my role

Earthquake records form a time series, and time-series forecasting has well-known architectures. The question was whether those architectures could predict the next magnitude from past magnitudes alone.

My own notebook in this four-person team is PyTorch-based. The TensorFlow and Bi-GRU work in the team repository belongs to other members; I do not present it as mine.

Implementation decisions

  • I split a 31,915-record dataset into 20-step windows.
  • I built two models in PyTorch: a bidirectional LSTM and an attention-based LSTM.
  • I measured success with R² rather than accuracy — accuracy is a meaningless metric when predicting a continuous value.

Outcome and learning

Bi-LSTM R² = 0.10, attention LSTM R² = 0.02. Both models fail to explain nearly any of the variance. Conclusion: a univariate setup cannot predict earthquake magnitude.

Inflating these numbers would have been easy — overlap the windows and let train and test leak into each other, or swap the metric for accuracy. Either would have produced a handsome chart, and either would have been a lie. Showing that a model does not work is itself a finding; the real engineering is refusing to dress up a null result as a success.