STATSEI14 · PRACTICAL TUTORIAL
Deep Learning Meets ETAS
Practical Hybrid Workflows for Seismic Forecasting
Francisco Plaza-Vega Universidad de Santiago de Chile
13 October 2026 · Chile
How do we turn a seismic question into a deep-learning experiment?
Main idea: A seismic question becomes a deep-learning experiment through explicit choices about information, representation, output and evaluation.
Explain: Use the guiding question to connect the entire tutorial. We begin with seismic observations, define a learning task, introduce how the models combine information, examine research evidence and make the same decisions in a guided practical. ETAS supplies one way to construct a representation. The LSTM remains the core practical example; additional comparisons can use prepared outputs.
Transition: The agenda follows that sequence of scientific decisions, from the question to a weekly occurrence experiment.
Backup: Follow the presentation with the temporal notebook and discussion; use the Transformer comparison if it helps. Adjust the pace to the group.
From seismic questions to a learning experiment
1. Seismic questions and data
What do we observe, and what do we want to estimate?
2. From data to learning tasks
How do we define inputs, targets and representations?
3. Deep-learning building blocks
How do different models use the available information?
4. Lessons from our research
What worked, what was difficult, and what did we learn?
5. Guided practical
How do we build and evaluate a weekly occurrence forecast?
How do we turn a seismic question into a deep-learning experiment?
Main idea: The tutorial follows the decisions needed to turn a seismic question into an experiment.
Explain: First identify the observations and the quantity of interest. Then define an input, target and representation using information available at the time of estimation. Introduce how the neural building blocks combine that information before examining our research cases. Finally, apply the same decisions to a regional weekly occurrence forecast. Discuss the capabilities of deep learning alongside each mechanism, then assess those capabilities using the evidence in the cases.
Transition: Begin with the familiar seismic objects we can observe or construct: signals, catalogues, histories and model-derived maps.
Backup: The core practical is an LSTM comparison with simple references. Transformer and spatial extensions remain optional. The research cases motivate modelling decisions; the practical does not reproduce their experiments.
Seismic questions and data
01
What do we observe, and what do we want to estimate?
What can we learn from seismicity?
Signals record ground motion.
Catalogues describe event times, locations and magnitudes.
Histories and maps organize information across time and space.
The same catalogue can support different tasks. First define what the output should mean.
Map: frozen USGS training catalogue and Natural Earth. Illustrates today’s regional setting.
Main idea: Familiar seismic data objects support different scientific questions.
Explain: Begin with what this audience already knows: recorded ground motion, catalogue events and regional histories. A statistical model can also turn a catalogue into an intensity map. These objects support different tasks: detecting an event, estimating a conditional rate, locating a zone of activity or estimating a weekly probability. We choose the quantity of interest and the information available before deciding how a network will use it.
Transition: The same catalogue can support different learning tasks. Our first decision is what we want the output to mean. Read the next examples through their input and task.
Backup: Map from today’s frozen USGS training benchmark with Natural Earth coastlines. It is not the CSN catalogue used in the published case. Observation is incomplete and catalogue records can change.
Deep learning in seismology: inputs and targets
ConvNetQuake · 2018
Recorded waveforms
Detect events and classify their source region
RECAST · 2023
Past event times and magnitudes
Estimate the next-event time distribution
Delgado et al. · 2025
Features of catalogued events
Classify foreshock, mainshock and aftershock labels
Farfán et al. · 2025
Sequences of daily spatial grids
Forecast gridded seismic activity
Today’s practical: 30 days of history and a seven-day occurrence probability.
Main idea: Read these applications as different input–target problems, before comparing architectures.
Explain each example: Focus on the observations used and the scientific meaning of the output. Model names are signposts; their mechanisms come next.
ConvNetQuake: a CNN detects events and classifies their source region from recorded waveforms. In our practical, those events are already represented in a catalogue.
RECAST: a recurrent GRU summarizes past event times and magnitudes to model the next-event time distribution. Its benchmark is temporal ETAS. We will use daily inputs and a weekly occurrence target instead.
Delgado et al.: event features support classification after spatial and temporal clustering and labeling. Labels such as foreshock, mainshock and aftershock show why target construction belongs to the scientific problem.
Farfán et al.: sequences of daily 4 × 4 Chilean grids support forecasts of gridded activity. Spatial aggregation anticipates the maps and graphs available after our regional exercise.
Transition: The examples differ because their questions, available information and targets differ. Make those choices explicit before selecting an architecture.
Backup: This selection is not a performance ranking. Event classification does not establish prospective warning. RECAST’s temporal benchmark does not establish superiority over spatial ETAS. Grid labels omit fine epicentre and magnitude information. Sources are linked on the slide.
From data to learning tasks
02
How do we define inputs, targets and representations?
Make the question, available information and input–target definition explicit before selecting an architecture.
From a scientific question to a learning task
We define: the question, information available, input and target.
We represent inputs: as a vector, sequence or map.
Represented data → Neural network → Defined output
Compare with a target → Compute a loss → Update weights
Architecture combines information; training adjusts weights.
The output and the loss must match the scientific question.
Main idea: We define the scientific task and representation before selecting an architecture.
Explain: Decide what we want to estimate and what information would be available at that moment. Construct one input and its target, then identify the input’s structure: a vector, sequence or map. Architecture determines how that represented information is combined. A history enters the network, an estimate comes out, and a loss measures its discrepancy from the target. Backpropagation computes gradients, and an optimizer updates the weights. One representation can support several architectures: the same daily history can be flattened for an MLP, scanned by temporal filters or processed recurrently while retaining the target.
Transition: Once the input and target are defined, different architectures provide different ways to combine the available information. Start with nonlinear combinations of a feature vector.
Backup: Validation guides choices and stopping. It does not update weights through backpropagation. Adapted from Units 1 and 2 of the author’s course.
Deep-learning building blocks
03
How do different models use the available information?
Follow input, operation and output. Link each model’s capability to its mechanism.
MLP: combine measured features
A multilayer perceptron learns nonlinear combinations of a feature vector.
Optional extension: the MLP uses 90 values at fixed lag positions. Diagram adapted from the author’s DL course, Unit 2.
Main idea: An MLP combines a vector of measured features through learned layers.
Explain: Follow one connection and then one hidden layer. Weighted combinations and nonlinear activations compose a mapping. This gives the MLP the capacity to learn nonlinear combinations of measured features. In the optional MLP section, flattening the 30 × 3 window gives 90 values, each at a fixed lag position. Whether this capacity helps the scientific task must be evaluated against suitable references.
Transition: The MLP combines values at fixed positions. A CNN adds a different mechanism: a learned local filter reused across positions.
Backup: Flattening preserves fixed lag positions. It does not randomly discard order. The core example is the LSTM, with a Transformer comparison available to support discussion. Diagram provenance: slides/assets/course-adapted/source-map.md.
CNN: learn local patterns with shared filters
The same filter examines different neighborhoods.
Optional extension: CNN1D shares filters across days. Diagram adapted from the author’s DL course, Unit 3.
Main idea: A convolution applies shared filters to local neighborhoods.
Explain: Use the diagram to identify a local receptive field and shared weights. The capacity comes from reusing a learned detector across local neighborhoods. In the temporal tutorial, CNN1D moves filters across days. In the published case, the CNN processes spatial patterns in ETAS-derived maps. The representation determines what a neighborhood means, and evaluation determines whether those local patterns are useful.
Transition: Local filters combine nearby values. An LSTM offers another way to use an ordered history by repeatedly updating a learned state.
Backup: CNN1D is available for optional exploration after the live comparison. The grid or temporal sampling determines what counts as a neighborhood. No kernel arithmetic is needed here. Diagram adapted from Unit 3 of the author’s course.
LSTM: carry information through a sequence
Today’s example: 30 × 3 input → state (16) → Dense + sigmoid → weekly probability
Output: probability of at least one catalogue M ≥ 5 event in the next seven days.
Adapted from the author’s DL course, Unit 4.
Main idea: An LSTM can combine information from earlier and more recent days through a learned state.
Explain: Each blue box contains three daily catalogue features, also called channels: event count transformed as log(1 + count), maximum magnitude excess above 4.5 and event presence. Thirty days form one 30 × 3 input. The LSTM processes that ordered history and builds a final state with 16 values. A Dense layer with a sigmoid converts that state into one probability: at least one catalogue event with M ≥ 5 in the next seven days. Distinguish the 30 observed days, 3 daily features, 16 learned state values and 1 output.
Transition: This is the architecture we will explain in detail in Colab. Its output is one probability. A generative task instead asks for a possible data realization, such as a complete sequence.
Backup: Today’s example uses catalogue events with M ≥ 4.5 to construct the daily features. An empty day has zero count, zero magnitude excess and presence zero. An event exactly at M = 4.5 has zero excess but presence one. The published temporal case uses a different target. Gates and shared weights remain useful background. An optional comparison contrasts recurrence and attention on the same daily tensor.
Generative learning: produce new samples
The output of G is a new data sample, such as a synthetic sequence.
GAN is an adversarial learning scheme; G and D may use different neural architectures.
Later case: mainshock conditions + noise → a possible aftershock sequence.
GAN schematic adapted from the author’s DL course, Unit 5.
Main idea: Generative learning aims to produce data realizations; a GAN trains a generator through an adversarial scheme.
Explain: Follow z into G and stop at the generated sample x̃ = G(z): this is the desired output. The potential contribution is to produce possible realizations of an object, rather than only a point estimate or a class probability. During training, the discriminator compares generated samples with real examples and supplies a signal for improving G. MLP, CNN and LSTM name architectures; a GAN names an adversarial learning scheme whose generator and discriminator can use different architectures. After training, draw new noise and apply G to obtain another possible sample. In the aftershock example, mainshock conditions and noise determine a possible sequence. Generating a sequence and estimating a weekly occurrence probability are different learning tasks.
Transition: We now have the vocabulary to read the research cases in a common order: question, representation, model and output, evidence, and interpretation. Begin with two tasks built from ETAS maps.
Backup: Generative learning describes a task and can use MLP, CNN or recurrent components. A plausible curve alone does not establish a scientifically adequate distribution.
Lessons from our research
04
What worked, what was difficult, and what did we learn?
Read the cases through their question, representation, model and output, evidence and interpretation.
ETAS intensity maps support two learning tasks
Nicolis, Plaza & Salas · Spatial Statistics 42 (2021), 100442 · CSN Chile, 2000–2017
Main idea: The first research case uses one statistical representation to define two neural learning tasks.
Explain: Question: how do the size and location of the daily maximum evolve? Representation: begin with catalogue event times, locations and magnitudes. The study fits temporal ETAS across the area and shares its parameters across 1° × 1° grid cells. Evaluate intensity through time to obtain daily maps. Model and output: take the spatial maximum of each map and use 30 values to predict the next maximum with an LSTM; retain 30 maps and use a CNN to classify which of six latitudinal macrozones contains the next maximum. Evidence: inspect the published temporal result after defining these targets. Interpretation: both branches concern summaries of the ETAS-derived field.
Transition: Before reading inputs or results, establish what the representation measures: process intensity, rather than earthquake magnitude or ground shaking.
Backup: Source: Nicolis, Plaza & Salas (2021), pp. 8–9, https://doi.org/10.1016/j.spasta.2020.100442 . This is a temporal ETAS construction with common area-level parameters applied to grid cells. Do not describe it as a jointly fitted spatial ETAS model. The grid here is schematic. Neither neural target identifies the exact next epicentre.
ETAS intensity describes a conditional event rate
\lambda(t\mid\mathcal H_t)=\mu+\sum_{t_i<t}\text{contribution from event }i
Background + magnitude-dependent contributions that decay with time
Published construction: common ETAS parameters applied across 1° × 1° cells produce a sequence of intensity maps.
A map value is an estimated occurrence rate, not an earthquake magnitude.
Main idea: The ETAS representation is a conditional event rate built from the catalogue history.
Explain: Past events contribute according to their magnitude and elapsed time. The temporal ETAS parameters are estimated for the study area and shared across grid cells. Evaluating this representation each day creates the maps used by the neural branches. A maximum over cells produces a daily scalar, while retaining the cells preserves spatial structure.
Transition: With the representation defined, make the temporal question precise: what is the maximum of the following day’s map?
Backup: Source: Nicolis, Plaza & Salas (2021), pp. 8–9. The displayed temporal formula is conceptual. The paper’s map construction uses common parameters across cells. Process intensity differs from magnitude, shaking intensity and probability. Converting an event rate into an interval probability requires an explicit predictive calculation.
A map maximum becomes one value in the LSTM input
30 daily spatial maxima → LSTM → next-day maximum intensity
Nicolis, Plaza & Salas (2021) · Original published regression task · Diagram illustrates the operation, not measured values
Main idea: The published LSTM performs regression on a sequence of ETAS intensity maxima.
Explain: Find the largest value in one daily map. Repeat for 30 days to create one input vector. The target is the maximum of the following day’s map. The diagram’s heights and highlighted cell are constructed to explain this operation; they do not reproduce a particular date or forecast. This is a model-derived continuous target. Today’s practical instead uses catalogue channels and a weekly occurrence probability.
Transition: Now read the original published test panel as evidence for that specific regression question.
Backup: Source: Nicolis, Plaza & Salas (2021), pp. 8–10, https://doi.org/10.1016/j.spasta.2020.100442 . The temporal ETAS fit uses area-level parameters across 1° × 1° cells. A spatial maximum retains one value and discards the location and the rest of the field. No empirical 30-day sequence is claimed in this constructed illustration.
Published LSTM result: an ETAS-derived test target
M ≥ 6 setting · Table 3
ETAS
0.5475
0.6241
LSTM
0.5296
0.6561
Lower error and higher R² for this reported comparison.
The network tracks a model-derived target; this is not a direct event-probability test.
Nicolis, Plaza & Salas (2021), Figure 5(b) and Table 3 · Original plotting scale retained
Main idea: The original result shows a fitted sequence and its reported test errors for a specific published setting.
Explain: The green curve labelled Observed in the original panel is the ETAS-derived target. The blue curve is the LSTM prediction. Read the curves before the table: the network follows much of the target’s variation, and its reported RMSE is slightly lower than the ETAS comparison in this magnitude-six setting. R² is a regression measure, not a probability calibration result.
Transition: The same maps support a different question if we retain their spatial structure: which macrozone contains the next maximum?
Backup: Source: Nicolis, Plaza & Salas (2021), Figure 5(b), p. 9, and Table 3, p. 10. Exact M ≥ 6 values: LSTM MSE 0.2804, MAE 0.2136, RMSE 0.5296 and R² 0.6561; ETAS MSE 0.2998, MAE 0.3484, RMSE 0.5475 and R² 0.6241. The source panel’s vertical scale is ambiguous; retain it and do not reinterpret negative plotted values as raw conditional rates. Do not infer dates or associate the panel with the preceding constructed example. At threshold five, ETAS has lower MSE, MAE and RMSE. The paper does not establish that ETAS estimation excluded all test information. These qualifications prevent a claim of uniform neural superiority.
CNN: locate the next map maximum in one of six macrozones
The target is one macrozone containing the next day’s maximum ETAS intensity.
Nicolis, Plaza & Salas (2021), Table 2 · Natural Earth geography · Marker and probabilities are illustrative
Main idea: The CNN classifies the location of a maximum within six predefined latitudinal macrozones.
Explain: Keep the complete spatial map on each of 30 days. The CNN outputs six probabilities that sum to one. The next day’s map supplies one target class: the macrozone containing its maximum. In the constructed example, that maximum is in zone 3. The displayed probability vector is chosen for teaching and is not a fitted prediction. The LSTM asks how large the maximum will be; the CNN asks which macrozone contains it.
Transition: The ETAS case shows how changing the represented information changes the learning task. The next case expands the desired output to an entire possible aftershock sequence.
Backup: Source: Nicolis, Plaza & Salas (2021), Table 2, p. 9, https://doi.org/10.1016/j.spasta.2020.100442 . The geographic figure is reconstructed from the six printed latitudinal bounds, numbered from south to north, and Natural Earth geometry. It is not a source-paper forecast map. The source Table 2 has a 0.01° discrepancy between the fifth and sixth intervals, retained in the diagram data. These six mutually exclusive classes differ from the six marginal cell-occurrence targets in today’s optional map and graph notebooks. They do not identify the exact next epicentre, earthquake magnitude or shaking intensity.
Generative exploration of aftershock sequences
The intended output is a possible sequence conditioned on a mainshock.
Jara Muñoz (2025) · Undergraduate thesis in Statistical Engineering · Universidad de Santiago de Chile
Main idea: The undergraduate thesis explores conditional generation of possible aftershock sequences.
Explain: Question: can a model produce possible aftershock sequences under specified mainshock conditions? Representation: mainshock location, magnitude and depth describe the conditions, and the output contains 224 intervals of 90 minutes over 14 days within 100 km. An occupied interval stores its maximum magnitude; 2.5 marks absence. Model and output: the thesis explores cGAN, WGAN-GP and TGAN, using noise to permit different generated sequences under the same conditions. Illustration: the visible sequence is constructed only to explain the encoding. Interpretation: it is neither an observed catalogue sequence nor the output of a fitted generator; a generated distribution must be assessed through the properties we need it to preserve.
Transition: Move from the representation to evidence: a separate, later manuscript provides an original observed/generated pair for inspection.
Backup: Thesis source: Jara Muñoz (2025), title page and pp. 46–51 (printed pp. 40–45). Mainshock longitude, latitude, magnitude and depth plus derived longitude on a 0–360 scale form five conditioning attributes. The latter is derived, not a fifth independent physical measurement. TGAN is an attention-based generator. The thesis and the later manuscript are separate versions with different evaluations. The shared constructed example has maximum 5.1; it will make binary labels transparent later without representing a fitted result.
An observed and generated sequence: one manuscript case
GANT · case B
━━ Observed reference
━━ Generated sequence
Vertical axis: interval maximum magnitude (Mw).
2.5 marks absence.
Compare occurrence, peak magnitude and timing, as well as the shape of the curve.
2026 manuscript under review, Figure 4 · One case from the primary random split · Original PI = −136% for this case
Main idea: A visible pair exposes the properties that a sequence-level score can conceal.
Explain: This is an original observed/generated pair from the manuscript, separate from the preceding constructed example. Both curves share 224 intervals over 336 hours. Identify the long absence periods, the observed isolated peak and the generated activity. An occupied interval stores a maximum magnitude, not an event count. The dark curve is the observed reference; the coral curve is GANT output. Read the original PI annotation as a measure for this one case.
Transition: The next evidence addresses an aggregate property of the representation: occupancy in the separate temporal evaluation.
Backup: Source: Plaza-Vega, Jara, Nicolis & Salinas (2026), manuscript under review, Figure 4, lower-right panel. Case B belongs to the primary random-split experiment. Its PI is −136%, using the original mean-reference denominator. It is neither the random-split aggregate score nor the temporal mean-baseline skill of −13.8%. The cropped panel omits the shared y-axis and legend, which are explicitly supplied on this slide. Empty-bin 2.5 is not an observed magnitude; occupied bins discard within-bin multiplicity. Do not merge this case with the subsequent blocked evaluation or the thesis experiments.
GANT temporal evaluation: too many occupied intervals
GANT overproduces occupied intervals while underrepresenting intervals with M ≥ 5.
2026 manuscript under review · Temporal evaluation · Percentages of intervals, not total event counts
Main idea: This GANT configuration does not reproduce two important occupancy properties in the temporal evaluation.
Explain: Read the bars as proportions of all intervals. The generated representation contains far more intervals above the absence marker: 77.43% versus 9.27%. Yet intervals reaching M ≥ 5 are less frequent: 0.40% versus 1.22%. These are distinct errors. A single curve-level loss does not reveal both, and the findings concern this model, representation and evaluation.
Transition: A different question needs a different target: does an observed sequence contain at least one event above a magnitude threshold? That reformulation uses observed outcomes to define labels for separate classifiers.
Backup: In the manuscript’s temporal GANT evaluation, an occupied interval has a value >2.5. Overall occupancy is 9.27% observed and 77.43% generated. Occupancy with M ≥ 5 is 1.22% observed and 0.40% generated. These proportions describe occupied intervals, whose stored maxima discard event multiplicity. Temporal GANT mean-baseline skill is −13.8%. Original PI uses a mean reference, not last-observation persistence. Keep thesis, illustrative cases and blocked results separate. These findings do not establish failure of all generative models.
Observed sequences define magnitude-threshold labels
Mainshock features → classifier → probability of at least one qualifying aftershock
Manuscript under review · 14 days, 100 km · Observed outcomes define labels; the displayed sequence is constructed
Main idea: The manuscript’s classification branch uses observed sequences to define a probability target.
Explain: Question: what is the probability of at least one qualifying aftershock? Representation: mainshock predictors describe the input, while observed catalogue sequences define labels over 14 days within 100 km. Model and output: logistic regression, Random Forest, Gradient Boosting or XGBoost estimate that probability. Illustration: the constructed sequence makes the labels visible—its maximum is 5.1, so a threshold of five gives label one and a threshold of six gives zero. The classification results follow on the next slide. Interpretation: generated GAN sequences are not classifier inputs, and these are separate binary tasks at each threshold, not multiclass magnitude prediction or a demonstrated improvement to the generator.
Transition: With input and target defined, examine what the reported classification evidence supports under different evaluation schemes.
Backup: Source: Plaza-Vega, Jara, Nicolis & Salinas (2026), manuscript under review, submission version dated 27 April, pp. 4–9 and 18–21. The manuscript uses non-strict magnitude-threshold notation while inherited classification code uses a strict comparison. The constructed maximum 5.1 yields the displayed labels under either convention and therefore does not resolve or hide that source discrepancy. The separate occupancy table on s15 has a confirmed M ≥ 5 definition. The constructed sequence is neither an actual observation nor a fitted GAN output. Do not attribute classification scores to GANs or LSTMs. The temporal analyses split examples by mainshock date, and target windows crossing partition boundaries were not fully purged.
Code verification: The original manuscript repository uses y > threshold in code/analyze_temporal_blocked_validation.py, line 82, and code/analyze_geographic_blocked_validation.py, line 127. Temporal assignment by mainshock date is in code/analyze_temporal_blocked_validation.py, lines 405–411; chronological GANT row splitting is in code/prepare_temporal_blocked_gant_data.py, lines 133–163. Saved metadata confirms target horizons crossing boundaries. This establishes overlapping horizons, not the size of any repeated-event leakage. The separate occupancy calculation uses >= 5.0 in code/build_revision_support_tables.py, lines 480–482.
Classification performance depends on the evaluation
Reported target (Table 9): at least one Mw ≥ 6 aftershock within 14 days and 100 km.
Random split
Random Forest
0.816
Temporal split
Gradient Boosting
0.672
Geographic split
Random Forest
0.642
Each row selects the best model in its own evaluation. Models and evaluation samples differ.
These AUCs measure discrimination. They do not establish calibrated probabilities.
Plaza-Vega, Jara, Nicolis & Salinas (2026), manuscript under review · Table 9 · Magnitude-threshold classification
Main idea: The evaluation protocol matters to the interpretation of classification performance.
Explain: Table 9 concerns at least one aftershock at magnitude threshold six within the encoded 14-day, 100-km horizon. It reports the best classifier under each validation scheme. The random-split result is 0.816 for Random Forest; the temporal result is 0.672 for Gradient Boosting; the geographic result is 0.642 for Random Forest. These are not three evaluations of one fixed fitted model. They indicate more limited discrimination under the blocked schemes in these experiments. ROC-AUC summarizes ranking across thresholds and does not assess calibration of the reported probabilities.
Transition: The cases reveal open questions about representation and evaluation. An ETAS-informed generator is one proposed next experiment, for which results are still needed.
Backup: Source: submission manuscript Table 9, p. 17. The printed target is at least one Mw ≥ 6 aftershock. Inherited classification code uses a strict threshold, as documented on s16. Preserve the different selected models and samples when discussing these values. The study’s target windows crossing temporal partition boundaries were not fully purged. Classifier outputs arise from mainshock features supervised by observed sequence labels. GAN outputs are not the classifier inputs. The magnitude-threshold notation discrepancy described on the preceding slide remains a source limitation. Operational warnings would require additional evaluation and probability calibration evidence.
Research hypothesis: ETAS-informed generation
History available at the origin → ETAS-derived information → Conditional generator
Possible role: supply a conditioning variable or a constraint on generated sequences.
Question: does that addition improve occurrence, magnitude and temporal structure under a fixed evaluation?
This is a proposed research direction. No hybrid results are shown here.
Future work discussed in the manuscript · The tutorial’s illustrative activity score is a separate feature experiment
Main idea: ETAS-informed generation remains a hypothesis that requires its own experiment.
Explain: A statistical process model might supply information to condition a generator or constrain a generated sequence. This is a possible design choice, not an achieved result in the manuscript. A comparison would fit ETAS to the available continuous catalogue, map its information to the same 14-day, 100-km outcome and encoding, and retain an unchanged generative reference. It would evaluate occurrence, magnitude and temporal structure under the same protocol.
Transition: Across these studies, the recurring decisions concern the question, representation, output and evidence. The practical will make those same decisions explicit in a smaller regional forecasting experiment.
Backup: The manuscript discusses ETAS and hybrid ETAS–machine-learning work as future directions on p. 21. No empirical ETAS–GAN performance is claimed. Any ETAS fit and derived information must respect the information available at each origin. A fitted ETAS intensity is a conditional event rate; the illustrative truncated activity score in the tutorial has a different status. A future two-part neural model for occurrence and conditional magnitude also remains unvalidated.
Guided practical
05
How do we build and evaluate a weekly occurrence forecast?
Apply those modelling decisions to a regional weekly occurrence probability, with the LSTM as the core example.
The practical applies the same modelling decisions
Shared decisions: question → representation → model and output → evidence.
Spatial Statistics
ETAS maps and daily maxima
Intensity maximum and its macrozone
Generative study
Mainshock conditions and noise
A possible binned aftershock sequence
Classification study
Mainshock predictors; observed outcome labels
Occurrence or exceedance probability
Today’s practical
Daily catalogue channels
Weekly occurrence probability
Now: 30 days of catalogue history → probability of at least one M ≥ 5 event in the next seven days.
Core: references, LSTM and probability evaluation. Optional: Transformer and spatial comparisons.
Main idea: The practical applies the same scientific decisions, with a new and explicit regional occurrence target.
Explain: Across these studies, the key decisions were how to represent available information, define an output with scientific meaning, select a model and evaluate the result. The table shows how those decisions lead to different tasks. We will now make them explicit using 30 days of catalogue history to estimate the probability of at least one M ≥ 5 event during the following seven days. The practical’s continuity with the studies lies in this modelling process, rather than in reproducing their targets or results.
Transition: First turn the catalogue into three daily features and inspect one input and its future label. Then fit simple references and the LSTM, and interpret its probability scores. Optional comparisons can extend the discussion.
Backup: Today’s task does not reproduce the research studies. The guided sequence is one example, references, LSTM fitting and evaluation. Transformer results can be read from prepared outputs. CNN maps offer a spatial contrast. Introduce Graph + LSTM through its input and output; its full fitting procedure is optional further exploration. Keep prepared results available if setup or fitting stalls.
From the catalogue to three daily features
For each day, summarize catalogue events with M ≥ 4.5 inside the study region.
Event count
log(1 + N_t )
How many input events occurred
Maximum magnitude excess
Maximum magnitude − 4.5; zero if empty
How far the maximum exceeds 4.5
Event presence
1 if N_t > 0 ; otherwise 0
Whether any input event occurred
30 consecutive days (rows) × 3 daily features (columns) → one LSTM input
Illustrative day: two input events, maximum M = 5.2 → [1.10, 0.70, 1] before standardization.
Input: 30 past days, M ≥ 4.5 → output: probability of at least one M ≥ 5 event in the next seven days.
The table shows values before standardization. The network uses means and standard deviations from training histories only. Features are also called channels.
Main idea: Three daily catalogue features form the columns of one 30-day input matrix.
Explain: For each day, count catalogue events with M ≥ 4.5 inside the study region: this is N_t. The first feature is the natural logarithm log(1 + N_t). The second subtracts 4.5 from that day’s maximum input magnitude, assigning zero on an empty day. The third is one when N_t is positive and zero otherwise. Two qualifying events and a maximum of 5.2 give [log(3), 5.2 − 4.5, 1], approximately [1.10, 0.70, 1] before standardization. Repeat for 30 consecutive past days to obtain rows × columns = 30 × 3. Features and channels refer to those same three columns. The output is the probability of at least one catalogue M ≥ 5 event in the next seven days; its observed label is zero or one.
Transition: How should these input histories and future labels be divided for learning and evaluation?
Backup: Region: 28–34°S, 69–74°W. Forecast origins are Mondays. Arrays use examples × days × features. The MLP, CNN1D, LSTM and Transformer share the same 30 × 3 history in the temporal comparison. Presence is redundant with count: it equals one whenever count is positive. It distinguishes an empty day from a day with an event exactly at M = 4.5 if one examines magnitude excess alone, because both have zero excess. No performance gain from adding presence has been demonstrated here. Training histories determine each feature’s standardization mean and standard deviation; the numerical example precedes that transformation. The example is constructed for explanation. ComCat mixes magnitude scales. The thresholds are teaching choices, not proof of completeness. The target does not specify exact location, shaking or damage.
Evaluate using the temporal order of the problem
Today we compare validation probabilities using Brier score, log loss and calibration.
Train 2001–2016 · Validation 2017–2020 · Test 2021–2025 was inspected previously and is excluded from this comparison.
Main idea: The current temporal tutorial compares validation performance only.
Explain: Training determines weights and normalization. Validation controls early stopping and supplies today’s probability diagnostics. The older test interval was already inspected during course development and is excluded from the current comparison. Target weeks cannot cross a partition boundary.
Transition: Compare the LSTM with training prevalence and logistic regression. A Transformer can optionally process the same history.
Backup: Training 2001–2016, validation 2017–2020, historical test 2021–2025. Earlier experiments retain their own test results. The revised frozen ComCat catalogue does not reconstruct historical availability. Validation used for stopping is development evidence. A sigmoid does not guarantee calibration.
Guided experiment: from one example to an LSTM probability
30 days × 3 catalogue channels → LSTM → weekly probability
Build one example: identify the input window, forecast origin and label.
Fit references and the LSTM: read compile, fit and predict beside the model.
Evaluate: compare Brier score, log loss and calibration.
Does the LSTM improve on training prevalence and logistic regression in this experiment?
Main idea: The core exercise connects one input example to reference models, LSTM fitting and probability evaluation.
Explain: Inspect one 30 × 3 history and its future label. Fit training prevalence and logistic regression as references, then read the LSTM definition beside compile, fit, predict and its scores. State what the probabilities refer to before comparing losses. Sixteen recurrent units define the small teaching configuration; they are not a demonstrated optimum.
Transition: Open the temporal notebook and inspect one example. If useful after interpreting the LSTM, use the next slides for an optional Transformer comparison.
Backup: Prioritize one input window, references, LSTM fitting and interpretation. Prepared outputs preserve discussion if setup or fitting stalls. The Transformer reuses the same 30 × 3 tensor and evaluation, but its full live execution is optional. CNN maps provide a spatial contrast. Introduce Graph + LSTM through its input and output; its full workflow is optional exploration.
Optional comparison: a Transformer on the same history
Same history and target. A different way to combine information across days.
Current temporal tutorial · 2,257 trainable parameters versus 1,297 for LSTM · One fixed, small configuration
Main idea: Attention combines the same observed days differently from an LSTM state.
Explain: If the pace allows a brief comparison, show the temporal notebook’s Transformer using prepared outputs. Each day is projected to 16 features and receives a learned 16-value day-position embedding. Two attention heads, each with key dimension 8, combine positions. Residual additions and layer normalization surround attention and the 16-to-16 feed-forward sublayer. Average pooling and a sigmoid produce the weekly probability.
Transition: Compare the probabilities under the unchanged evaluation.
Backup: The Transformer first projects each day and adds a learned position vector. Projection: 64 parameters, learned positions: 480, attention: 1,088, two normalizations: 64, feed-forward: 544, output: 17. Total: 2,257 trainable parameters versus 1,297 for LSTM. No dropout is applied. All input positions precede the origin, so within-history attention does not expose the target. Capacity differs between architectures. Attention weights alone do not establish causation.
Validation performance for the weekly occurrence task
Training prevalence
0.188
0.563
Logistic regression
0.204
0.614
LSTM
0.182
0.548
Transformer (optional)
0.188
0.562
Lower is better. The LSTM has the lowest losses in these individual fits. Read calibration alongside them.
These are development results from one region and one validation period.
One fit per neural model, seed 7 · 208 validation weeks · Display rounded to three decimals
Main idea: A probability score summarizes the errors of one fitted model on the validation weeks.
Explain: Inspect the model summary, prepared predictions and calibration. The displayed neural scores each come from one fit with seed 7. Training prevalence and logistic regression each have one result. Logistic regression receives all 90 lagged channel values. Both neural models receive the same 30 × 3 input. In this seed-7 run, the LSTM has lower Brier and log loss than the Transformer and both references. The Transformer and constant reference have similar losses. Compare both scores without assuming that added complexity improves them.
Transition: Which conclusions do these scores support, and which require a new experiment?
Backup: The guided temporal comparison contains 208 validation weeks. A single seed does not measure sensitivity to initialization. Repeating each architecture with seeds 7, 17 and 27 examines that sensitivity under a fixed data and evaluation protocol. Validation also selects stopping, so these scores support model development. An independent assessment requires data that have not influenced model decisions. Use prepared results if live fitting stalls.
What can this result tell us about the problem?
Reading the validation results
Compare each model with training prevalence.
Read Brier, log loss and calibration together.
Questions for the next experiment
Which representation and target preserve useful structure?
What information is available in the catalogue?
Would more data, capacity or a different training budget change the result?
Useful deep learning depends on how we represent the phenomenon and formulate the task.
Validation also controls early stopping. One seed does not measure initialization sensitivity.
Main idea: A score difference does not explain its cause.
Explain: Connect the comparison to our cases. Spatial Statistics supplied a fitted representation. The generative and classification studies exposed the consequences of choosing an output definition. Here, each model has one declared fit on the same history. An observed score difference describes those settings; it does not explain why the models differ.
Transition: Invite questions about the result. A brief spatial example can show how retaining locations changes the input and output before closing the discussion.
Backup: This comparison cannot isolate representation, information availability, sample size, optimization or capacity as a cause. It does not establish that attention is unsuitable for seismicity. Validation is development evidence, and the historical test was already inspected. New claims need a documented protocol and appropriate fresh evaluation.
Spatial extension: Graph + LSTM
Graph connections share spatial information; the LSTM summarizes each node’s history.
Main idea: Graph + LSTM keeps the same six cells as the map example and separates spatial from temporal operations.
Explain: Point to the six geographic cells, which are nodes rather than individual earthquakes. Each node contains 30 days of three catalogue features. Within a day, graph convolution combines features over fixed rook adjacency. A shared LSTM processes the sequence for each node, and a sigmoid head produces one weekly occurrence probability per cell. Several cells can be positive in the same week, so these marginal probabilities need not sum to one.
Transition: These examples suggest possible research questions about representation, available information and evaluation, rather than a universal ranking of architectures.
Backup: This slide introduces input and output. The complete Graph + LSTM notebook is optional further exploration. Geographic adjacency is a modelling choice and does not establish physical triggering. The implementation includes the focal node in the neighborhood average and learns a separate self-transformation. Compare identity adjacency under unchanged inputs and protocol to investigate the role of cross-node messages. Map and graph scores concern the same cell-level target and should not be ranked against regional occurrence scores.
What did we learn, and what would we test next?
What information did our daily channels preserve or discard?
What did the LSTM comparison with simple references establish?
Which research question would you explore next with maps, graphs or an activity score?
Deep learning offers flexible tools. Their scientific value depends on the question and the evidence.
Main idea: Scientific usefulness depends on the question and the evidence supporting the model.
Explain: Invite questions and interpretations of the LSTM comparison with simple references; include the Transformer if discussed. Distinguish the observed loss from a proposed explanation. Discuss what spatial information was lost when the catalogue was pooled over the region.
Transition: For anyone interested in continuing independently, Further exploration offers references and optional comparisons involving maps, graphs, recurrent-state size or the ETAS-inspired feature experiment.
Backup: Keep baselines, a stated hypothesis and the evaluation protocol. Comparing 8, 16 and 32 recurrent units examines capacity while holding the other settings fixed. An ETAS-inspired feature changes the representation while retaining the LSTM. Participants with less Python experience can use prepared outputs and guided reading.
Appendix · MLP: combine values at fixed lag positions
Input: 30 days × 3 channels. Output: one weekly occurrence probability.
from tensorflow import keras
inputs = keras.Input(shape= (30 , 3 ))
fixed_lags = keras.layers.Flatten()(inputs)
hidden = keras.layers.Dense(16 , activation= "relu" )(fixed_lags)
probability = keras.layers.Dense(1 , activation= "sigmoid" )(hidden)
model_mlp = keras.Model(inputs, probability)
Flatten gives 90 values at fixed lag positions; Dense learns nonlinear combinations.
Temporal notebook · Same catalogue channels and M ≥ 5 occurrence target over the next seven days
Main idea: The MLP learns from the same history as the LSTM through a different architecture.
Explain: One example has 30 rows and three channels. Flatten places its 90 values in a fixed order. The hidden layer combines those values, and a sigmoid returns one weekly probability. The lag positions remain identifiable; flattening does not shuffle the history. Unlike a convolution, the Dense layer does not share one local filter across days.
Transition: The CNN1D applies shared filters to neighbouring days in the same input.
Backup: Architecture from scripts/linear_tutorial_sources/temporal.json, cell linear-temporal-041. Only names and the explicit input shape have been shortened. The channels are log(1 + count), maximum magnitude excess above 4.5 and an event indicator. The full notebook sets seed 7, estimates scaling from training histories, then compiles, fits and predicts with the stated chronological protocol. The 16 hidden units are a fixed teaching choice, not a demonstrated optimum. See ../tutorials/temporal.qmd .
Appendix · CNN1D: share filters across neighbouring days
Input: 30 days × 3 channels. Output: one weekly occurrence probability.
from tensorflow import keras
inputs = keras.Input(shape= (30 , 3 ))
local = keras.layers.Conv1D(
16 , kernel_size= 3 , padding= "same" , activation= "relu" )(inputs)
combined = keras.layers.Conv1D(
16 , kernel_size= 3 , padding= "same" , activation= "relu" )(local)
summary = keras.layers.GlobalAveragePooling1D()(combined)
probability = keras.layers.Dense(1 , activation= "sigmoid" )(summary)
model_cnn1d = keras.Model(inputs, probability)
Conv1D scans time. A spatial CNN uses Conv2D to scan map neighbourhoods.
Temporal notebook · Width-three filters use all three channels; pooling summarizes responses across days
Main idea: This CNN operates over the temporal axis rather than over geography.
Explain: Each width-three filter examines neighbouring days and all input channels. The second convolution combines the local responses. Global average pooling summarizes those responses before the sigmoid produces a weekly occurrence probability. Inputs, labels and partitions match the temporal LSTM example; the way information is combined changes.
Transition: The next reference shows the LSTM architecture together with the common supervised fitting steps.
Backup: Architecture from scripts/linear_tutorial_sources/temporal.json, cell linear-temporal-045. Names are shortened and shape is written explicitly; both 16-filter layers, kernel size three, same padding, ReLU and global average pooling are retained. The full notebook uses the stated seed, training-only scaling and stopping rule. The spatial notebook at ../tutorials/maps.qmd uses Conv2D over maps and returns six marginal cell-occurrence probabilities; that is a different target from the six mutually exclusive macrozone classes in the published study. This slide’s CNN1D has one regional output.
Appendix · the LSTM steps
Input: 30 days × 3 channels. Output: one weekly occurrence probability.
inputs = keras.Input(shape= (30 , 3 ))
state = keras.layers.LSTM(16 )(inputs)
probability = keras.layers.Dense(1 , activation= "sigmoid" )(state)
model_lstm = keras.Model(inputs, probability)
model_lstm.compile (optimizer= "adam" , loss= "binary_crossentropy" )
history_lstm = model_lstm.fit(
X_train, y_train, validation_data= (X_val, y_val),
epochs= 20 , batch_size= 64 , callbacks= [stopping_lstm], shuffle= False )
p_lstm = model_lstm.predict(X_val).ravel()
brier = np.mean((p_lstm - y_val) ** 2 )
Define the model · compile · fit · predict · evaluate probabilities
Abbreviated reference for the guided practical. The same compile, fit, predict and probability-evaluation workflow applies to the supervised MLP and CNN1D examples; each requires its own model, stopping callback and fitted history. These steps do not replace the alternating GAN updates. The notebook sets seed 7 and prepares training-only scaling. Beside compile, it defines stopping_lstm with patience 3 and restored best weights. The notebook specifies Adam learning rate 0.001 explicitly. Validation selects stopping rather than updating weights through gradients. Each operation appears next to the model it concerns. https://keras.io/api/layers/recurrent_layers/lstm/ .
Appendix · conditional GAN: two networks, different outputs
G: conditions + noise → sequence. D: sequence + conditions → real/fake score.
Generator G
from tensorflow import keras
from tensorflow.keras import layers
noise = keras.Input(shape= (16 ,), name= "noise" )
conditions = keras.Input(
shape= (5 ,), name= "conditions" )
g = layers.Concatenate()([noise, conditions])
g = layers.Dense(64 , activation= "relu" )(g)
g = layers.Dense(128 , activation= "relu" )(g)
generated = layers.Dense(
224 , activation= "tanh" )(g)
generator = keras.Model(
[noise, conditions], generated, name= "G" )
Discriminator D
sequence = keras.Input(
shape= (224 ,), name= "sequence" )
d = layers.Concatenate()([sequence, conditions])
d = layers.Dense(128 , activation= "relu" )(d)
d = layers.Dense(64 , activation= "relu" )(d)
real_score = layers.Dense(
1 , activation= "sigmoid" )(d)
discriminator = keras.Model(
[sequence, conditions], real_score, name= "D" )
G produces 224 scaled values. D’s real/fake score is not an occurrence probability.
Small, untrained teaching example · Reduced conditional-GAN architecture; no thesis replication or performance claim
Main idea: Conditional generation requires a generator and a discriminator with distinct outputs.
Explain: The five conditioning values describe the mainshock; 16 random values supply variation. Concatenation combines both inputs. The generator’s Dense layers produce 224 values with tanh. The discriminator combines a sequence with the same conditions and returns a real-versus-generated score. Read the Python blocks from left to right. Constructing these networks does not train them or reproduce the thesis experiment.
Transition: Training alternates between improving the discriminator and improving the generator through the discriminator.
Backup: The structure follows code/train_vanilla_cgan.py, lines 122–158 and 205–232; scaling follows code/prepare_data.py, lines 120–137, in the audited aftershock project. The smaller widths and noise dimension shown here are teaching choices; no trained model or metric is claimed. The five conditions are longitude, latitude, mainshock magnitude, depth and derived longitude on a 0–360 scale. The derived longitude is not an independent physical measurement. Conditions and sequences require MinMax scaling to [−1, 1], fitted on training data only. Inverse-transform generated values before reading magnitudes or the absence marker 2.5. The sequence representation comprises 224 intervals of 90 minutes, covering 14 days within 100 km; occupied intervals store maximum magnitude. D’s sigmoid is a real/fake classification score under adversarial training, not the probability of an earthquake or an aftershock exceedance. Network construction alone establishes no distributional adequacy.
Appendix · GAN training alternates two updates
Pseudocode: the update logic below is explanatory, not executable Python.
for each batch of observed sequences and mainshock conditions:
draw noise; generated = G(noise, conditions)
keep G fixed
D_loss = BCE(1, D(observed, conditions))
+ BCE(0, D(generated, conditions))
update only D weights to reduce D_loss
draw fresh noise; generated = G(noise, conditions)
keep D weights fixed, but pass gradients through D
G_loss = BCE(1, D(generated, conditions))
update only G weights to reduce G_loss
After training: choose conditions, draw noise and use G to produce a candidate sequence.
BCE = binary cross-entropy · D learns labels real = 1 and generated = 0; G is updated toward D’s real label
Main idea: GAN training alternates the objective and the network whose weights are updated.
Explain: In the discriminator step, observed sequences carry label one and generated sequences label zero. Hold the generator fixed and update only D. Then draw fresh noise, hold D’s weights fixed and pass gradients through D to update G toward label one. This feedback changes the generator even though its desired output is a sequence rather than a binary label. Generation after training uses G and new noise.
Transition: Return to the scientific checks: do generated samples preserve occurrence, magnitude and temporal structure?
Backup: Explanatory pseudocode based on the alternating updates in code/train_vanilla_cgan.py, lines 205–232. It omits optimizer setup, gradient-tape syntax, batching and validation details. No opaque training helper is assumed and no fitting is performed on these slides. During the D update, generator weights must not change; during the G update, discriminator weights must not change while its differentiable operations still transmit gradients. This is a reduced vanilla conditional-GAN explanation, not the WGAN-GP or attention-based generator training procedure. Conditions and sequences use training-only scaling, and generated values require inverse transformation before scientific interpretation.
Appendix · quantities and scientific meaning
Process intensity
At what conditional rate do events occur?
Magnitude
How large is an event?
Shaking intensity
What motion or effects occur at a location?
Risk
What consequences may occur given exposure and vulnerability?
Today’s output is a probability of a defined occurrence event.
The published title and original workflow labels require this distinction. ETAS intensity is an event rate. A probability for an interval needs a predictive calculation, not relabeling a rate. None of today’s probability scores is a shaking or damage estimate.
Appendix · ETAS-inspired feature experiment
r_t(s)=\sum_{t-L\le t_i<s}10^{\alpha(M_i-M_0)}
\left(1+\frac{s-t_i}{c}\right)^{-p},\quad s\le t.
Illustrative: α=1, c=1 day, p=1.1, L=30 days.
Controlled comparison: both LSTMs use the same available history.
Representation: log1p(score) is an additional daily channel.
Optional representation experiment. The illustrative index is not a fitted ETAS rate.
This feature experiment compares the representation while holding the LSTM fixed. The optional LSTM/Transformer comparison changes architecture while retaining the same input. The history is truncated separately at each origin and the daily endpoint includes only strictly earlier events. A fitted ETAS extension needs a documented estimation sample, units, observation model and forecast construction. For the optional 14-day task, both variants use L=14. The binary target is at least one catalogue event M>=5 in [t,t+7 days).
Appendix · original generative examples
2026 manuscript under review · Original PI annotations use a mean-reference denominator · Illustrative cases
Use only if discussion requires the original sequence examples. These panels are not the blocked-evaluation occupancy comparison. The absence marker is 2.5; occupied-bin maxima discard multiplicity. Original PI is a mean-baseline measure rather than last-observation persistence. Do not merge illustrative case values with the aggregate temporal evaluation or thesis results.
Appendix · evidence and availability
Chronological, purged targets
Future target intervals do not cross partitions.
Training-only normalization
Later inputs do not set scaling parameters.
Frozen revised catalogue
Data bytes and provenance are reproducible.
Historical catalogue vintages
Not reconstructed.
Reproducibility and historical information availability are separate requirements.
Magnitude, location and inclusion may have changed after an event. The updated field is not first publication and cannot reconstruct original versions or label-adjudication delays. Dependent weeks, one regional split and a small number of seeds limit generalization. The guided temporal tutorial reports validation only, with seed 7 once per neural model. The separate repeated comparison retains seeds 7, 17 and 27. The earlier activity-score run uses one seed and the earlier Transformer pilot uses three. Those earlier experiments retain their own test results, which are not a fresh evaluation for the current tutorial. A source or architecture’s reported score should not be transferred to a different target.
Appendix · sources and further reading
The context papers address distinct learning tasks and do not provide a ranking of architectures. Plaza-Vega, Jara, Nicolis & Salinas (2026) is a manuscript under review. The LSTM teaching diagram follows the course adaptation of the many-to-one diagram attributed to Raschka (2019). The references page provides foundational deep learning and data/software sources.