The practical: build, run and compare

Three guided tutorials, from regional histories to maps and graphs

For the live session, download the temporal notebook with ready-to-run cells, open Colab and upload the notebook. Run the core cells in order through LSTM evaluation, with the temporal guide alongside it. The Transformer follows, and MLP/CNN1D are optional laboratory sections. The frozen data download automatically; no data ZIP upload is needed. The guide also has prepared local outputs. Copying its blocks into a blank Colab remains an alternative for independent study.

Live route: build one example → define reference forecasts → train the LSTM → evaluate its probabilities → compare with a Transformer. The presentation takes 30 minutes and the practical, including its final discussion, takes 30 minutes.

One question at a time. In the session, follow how an LSTM and a Transformer process the same regional history. Each model has its construction, compile, fit, predict and evaluation together. The notebook also includes MLP and CNN1D after the live route. During the laboratory, retain location and predict one weekly probability per cell: maps and graphs use the same six cells, inputs and target windows.

01 · Core tutorial

One regional sequence, step by step

Use 30 days of three regional catalogue channels to estimate the probability of at least one M ≥ 5 event in the following seven days. Follow training prevalence and logistic regression, then build and evaluate an LSTM. Compare with a small Transformer and explore MLP/CNN1D during the laboratory. Each neural model runs once with seed 7.

Learn: fixed lag positions, temporal filters, recurrent state, attention and positional information. Read Brier score, log loss and calibration alongside parameter counts and training time.

Start the temporal tutorial

02 · Spatial extension

Learn from sequences of maps

Retain six geographic cells and build a sequence of daily maps. Predict a separate weekly occurrence probability for every cell using CNN2D + LSTM and ConvLSTM2D.

Learn: space versus time, shared spatial filters, sparse cell targets, marginal probability maps and the limits of geographic binning.

Start the map tutorial

03 · Spatial extension

Connect the same cells as a graph

Use the same cell histories and outcomes, with a fixed graph connecting cells that share an edge. Combine explicit neighbour aggregation with an LSTM shared across nodes.

Learn: adjacency, self-information and neighbour messages, node identity, and how a graph can later support irregular regions.

Start the graph tutorial

How to follow the session

Open the prepared temporal notebook alongside its web guide. Before running the preparation, identify one forecast Monday: the input contains the preceding 30 days and the label records whether at least one M ≥ 5 event occurs in the following seven days. Its three channels are log event count, maximum magnitude excess above 4.5, and event presence.

Session minutes Practical activity
30–34 Open the notebook, run preparation and inspect one 30 × 3 input
34–43 Define the references; build, compile, fit and predict with the LSTM
43–50 Interpret Brier, log loss and calibration
50–57 Compare the LSTM with the compact Transformer
57–60 Discuss one finding and choose a laboratory question

Run the core cells in order and pause at the LSTM probabilities and scores. Each fit is visible next to its model, using the single declared seed 7. The core evaluation does not depend on MLP or CNN1D. Return to the Transformer at minute 50; optional MLP/CNN1D sections and the full table can wait for the laboratory. Prepared outputs make the same evaluation available if setup or fitting stalls. At minute 34, move to those outputs if the environment is not ready; preserve the time for interpretation.

The spatial tutorials are complete extensions for the laboratory or later study. Each can start in its own blank notebook because it includes the same preparation. Their target is per cell, so their scores should not be ranked against the regional scores from Tutorial 1. Within the two spatial tutorials, cell support, normalization, seed 7 and evaluation origins are shared.

What stays fixed

Setting Teaching protocol
Catalogue Frozen, revised USGS records, 2000–2025
Region 28–34°S, 69–74°W
Input threshold / history M ≥ 4.5 / previous 30 days
Target threshold / horizon M ≥ 5 / following seven days
Training / validation 2001–2016 / 2017–2020
Existing test period 2021–2025; already inspected in earlier course work and not evaluated in these tutorials
Spatial support Three latitude bands × two longitude bands; six fixed cells
Seed in the linear walkthroughs 7; one fit per neural model
Separate repeated comparisons Seeds 7, 17 and 27; all retained

Standardization uses training histories only. Target intervals crossing split boundaries are excluded. Validation controls early stopping and supplies the displayed comparison; it is not independent evidence of generalization. Spatial probabilities can be positive in several cells and need not sum to one. They describe catalogue occurrence, not shaking, damage or risk.

Repeated comparisons for the laboratory

The primary guides make one training run visible. To examine sensitivity to initialization, use the separate comparisons for temporal sequences, maps and graphs. They retain seeds 7, 17 and 27. Their means summarize separately scored fits and must not be presented as scores from the linear walkthrough.

The corresponding notebooks are available for temporal sequences, maps and graphs, or together in the comparison notebook pack. Their prepared repeated-comparison results remain separate from the linear results.

Download and continue

Prepared outputs were produced by fresh local CPU kernels. Their measured runtimes describe that machine; a complete execution in an actual Colab session remains unverified. The fixed catalogue does not establish which record versions were available at historical forecast times.