Catalogue cleaning
Reads the PHIVOLCS workbook, rejects impossible hypocentres, collapses duplicate origins and resolves four magnitude scales into one working scale.
18,338 in, 17,667 out
Undergraduate thesis, 2026
A machine learning model that reads the tremors before a Philippine mainshock and estimates how large it will be. Built on 119 years of PHIVOLCS records and mapped fault distances.
17,667 catalogued events 16 models compared Verified against Python
What the study does
Every stage writes a table you can check. Nothing is asserted that the repository cannot reproduce from the raw workbook.
Reads the PHIVOLCS workbook, rejects impossible hypocentres, collapses duplicate origins and resolves four magnitude scales into one working scale.
18,338 in, 17,667 out
Completeness magnitude by maximum curvature and goodness of fit, then the Gutenberg-Richter b-value by least squares and Aki-Utsu maximum likelihood.
b = 0.920, Mc 4.9
Removes the small dependent events that trail a larger one, using the space and time windows of Hirose and colleagues, without deleting the mainshocks being forecast.
2,207 removed
Twenty-two features from the published table plus five that summarise how far the foreshocks sit from the nearest mapped active fault.
27 features per window
Sixteen forecasters across four families, scored first by expanding-window validation and then once on a test partition nothing has touched.
Tree, linear, recurrent, classical
Four trained models exported to run client side, with the feature mathematics reimplemented and checked value by value against the Python original.
1,620 values verified
The record
PHIVOLCS has logged earthquakes along the archipelago since 1907. This study uses the whole retrievable archive: every event with a complete origin time, epicentre, depth and at least one reported magnitude.
Cleaning that archive is where most of the honest work sits. The four magnitude scales are almost never co-reported with moment magnitude, so no defensible conversion could be fitted from this catalogue alone. The working magnitude falls back to the first available scale in the order Mw, Ms, mb, ML, and the paper says so plainly rather than implying a homogeneous record.
The catalogue is also complete only from magnitude 4.0 upward, because that is where PHIVOLCS begins publishing. Each event additionally carries its distance to the nearest active fault, measured against fault lines mapped in QGIS. Two in five sit within 25 km of one.
See how it is processed
Our approach
Every step exists to stop the model learning something it would not know in advance.
Reject impossible records, collapse duplicates, resolve the magnitude scales, and log what each rule removed.
Apply Maeda's method so aftershock swarms cannot masquerade as precursory activity.
Build 27 features from the 14 days and 100 km before each mainshock, target excluded.
Split strictly by time, 60:20:20, refitting every transform inside each fold from training rows alone.
Score once on untouched data, compare against naive baselines, and publish the limits.
Results
Sixteen forecasters ran on identical sequences. A third of them cannot beat simply quoting the historical average.
| Model | RMSE | R squared | Skill |
|---|---|---|---|
| Extra Trees | 0.492 | 0.147 | +23.6% |
| Random Forest | 0.498 | 0.125 | +21.6% |
| ARIMAX | 0.510 | 0.085 | +18.0% |
| Elastic Net | 0.513 | 0.073 | +17.0% |
| k-Nearest Neighbours | 0.514 | 0.068 | +16.6% |
| GRU | 0.551 | -0.069 | +4.2% |
| LSTM | 0.560 | -0.103 | +1.2% |
| Climatology baseline | 0.563 | -0.116 | 0.0% |
| Multilayer Perceptron | 0.585 | -0.206 | -8.0% |
| 1D-CNN | 0.675 | -0.606 | -43.9% |
An Extra Trees ensemble on 27 features cuts squared error by 23.6% against quoting the historical average magnitude. That is real skill. It is also small: the typical error is still about half a magnitude unit, the difference between a tremor and a damaging event.
Adding the distance from each foreshock to the nearest mapped fault lifted the best model from 21.4% to 23.6%. Three of the five fault features rank fifth, sixth and seventh of 27 by permutation importance. The other two measure nothing the model can use, and are reported as such.
A second model was built for the other half of the objective: the chance an earthquake of a given size follows within two weeks. Across nine combinations of magnitude and radius it beat the historical rate in one, by 3.4% Brier skill with a fold-to-fold spread several times that. The panel therefore reports the historical rates, each with its margin of error at 95% confidence.
Those intervals come from a bootstrap that resamples whole years rather than individual anchors. The standard Wilson interval assumes independent trials, and these are overlapping windows cut from one catalogue where a single productive swarm supplies many of them. Dropping that assumption roughly triples the margin of error, from 2.1 to 5.6 percentage points on the headline figure, which is the honest width.
The recurrent networks land barely ahead of the baseline and every tree ensemble beats them. With 428 training sequences of ten timesteps, there is not enough data for a recurrent architecture to pay for its parameters.
Try it
Four trained models from the paper, running in your browser on the events you give them. The panel returns how large a mainshock would be, and separately how often one has actually followed a sequence like this within two weeks.
A recorded sequence loads a real case from the held-out test partition, so you can compare the forecast against what actually happened. Your own lets you type an epicentre, a date and your own list of tremors.
One row per tremor in the 14 days before. Days before counts backward from the forecast moment, so 0.44 means about eleven hours earlier. At least three complete rows are needed before the model can be computed.
The number beside each model is its test error in magnitude units, so lower is better. Press Forecast and the panel returns the expected magnitude, its uncertainty, and the historical chance that anything follows.
Real sequences from the held-out test partition, so the observed outcome is known.
The epicentre of the sequence and the moment you are forecasting from. Regional history and the distance to the nearest mapped fault are both resolved from the catalogue at that point.
| Days before | Magnitude | Lat N | Lon E | Depth km | Remove |
|---|
Loading the trained models.
Why the numbers hold
Every validation sequence postdates every training sequence. A shuffled split is the most common way a seismic forecast turns out to be an artefact.
Imputation, winsorising and scaling are refitted inside each fold from that fold's training rows alone.
Climatology and persistence are scored alongside every model, so skill is measured against something, not asserted.
The browser reimplementation is replayed against Python on 60 held-out sequences: 1,620 feature values and 240 predictions.
One seed, one command, one file. Re-running the analysis reproduces every number on this page and in the document.
What the model cannot do is given its own section rather than buried in a footnote.
Stated plainly
A forecasting paper is only as trustworthy as the list of things it refuses to claim.
The model estimates the magnitude a mainshock would reach given a foreshock sequence already in progress. It forecasts neither the time nor the location of an earthquake, and nothing here is an early-warning capability.
Of 3,261 candidate mainshocks, only 535 had enough catalogued activity in the preceding fortnight to support a forecast at all. The method is silent for the great majority of damaging earthquakes.
Conditional on a mainshock following, its magnitude is forecast with 23.6% skill. Whether one follows at all is another matter: across nine magnitude and radius combinations the probability model beat the historical rate once, marginally. The honest answer to "what is the chance" remains the observed frequency.
Recorded events rise sharply through the 1970s and after, tracking the expansion of the monitoring network rather than a change in the ground. Any temporal trend confounds the two.
Distances are measured to fault lines digitised in QGIS. A fault absent from that layer is invisible to the model, and the browser approximates the assignment from 797 mapped points.
Open and reproducible
Enter a handful of foreshocks, pick a model, and read the forecast with its uncertainty. Everything runs in your browser, nothing is uploaded.
The study
Submitted to the Faculty of the College of Engineering and Architecture, Lyceum of the Philippines University, Cavite, in partial fulfilment of the requirements for the degree of Bachelor of Science in Civil Engineering.
Catalogue source: PHIVOLCS earthquake bulletin, 1907 to 2026. Fault lines mapped in QGIS. Official earthquake advisories come from PHIVOLCS, not from this page.