Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chapter 3: Classic Machine Learning in Geosciences

This chapter covers classic machine learning (CML) for geoscience: models that learn from feature tables rather than raw waveforms or images. Classic ML is fast to build, cheap to run, and easy to interrogate. That makes it the right place to learn the habits that carry over to deep learning: baselines, honest data splits, and evaluation that matches how a model will actually be used.

The arc of the chapter

  1. Concepts (3.1) — the training-supervision taxonomy: supervised, unsupervised, semi-supervised, self-supervised, reinforcement, and active learning, and where each shows up in geoscience.

  2. Classification and regression (3.2) — the two supervised problem types, a first end-to-end workflow, and the train/validation/test split.

  3. Fitting a line, finding groups (3.3) — least-squares regression and its uncertainty, k-means from its two steps, choosing K with the elbow, and PCA before clustering, on height and weight, Old Faithful, rock chemistry and Pacific Northwest seismic events.

  4. Binary classification (3.4) — event-vs-noise detection, classifier comparison, the metrics that matter when classes are imbalanced (precision, recall, PR curves vs ROC), and two knobs for treating imbalance (class weights, threshold moving).

  5. Multiclass classification (3.5) — four seismic source types, per-class confusion matrices, one-vs-rest ROC, and the class leaderboard exercise.

  6. Logistic regression from scratch (3.6) — the one lesson where the black box is opened: the loss function, gradient descent, automatic differentiation with PyTorch, and a calibration check — reliability diagrams and the Brier score — on the predicted probabilities.

  7. Trees, forests, and boosting (3.7) — decision trees, random forest regression, feature importance and its pitfalls (permutation importance, partial dependence, correlated features), and gradient boosting as the modern tabular default.

  8. Robust training (3.8): what a validation score answers on correlated data. A GNSS forecast on shuffled and future folds, spatial blocks on a soil moisture map, whole events in a ground-motion table, persistence baselines, and an interval that respects correlation.

  9. Ensembles (3.9): averaging, boosting written by hand, and stacking on out-of-fold predictions, with shared errors as the limit of a combination and disagreement between models as a first estimate of epistemic uncertainty.

  10. AutoML (3.10): a small AutoML written with scikit-learn only, how the choice of validation changes its winner, why the best score of a search is optimistic, and an audit of a modeling script written by an AI agent.

  11. Forests in practice (3.11): an active notebook for Session 17, with a ROC curve from ten events, thresholds across two models, forest regression on real soil moisture, and a test beyond the training range.

Dimensionality reduction (PCA, t-SNE) is covered in Chapter 2.12 and is used here as a preprocessing step, not re-taught.

The fair-evaluation thread

A single discipline runs through every notebook in this chapter:

Lesson 3.5 puts this into practice with a class leaderboard: students train a classifier of their choice on a canonical split of a real seismic-source dataset, submit predictions by pull request, and are scored by continuous integration against both the public and the hidden test sets.

Tools

The chapter uses scikit-learn as the workhorse, lightgbm and scikit-learn’s histogram gradient boosting for boosted trees, optuna for hyperparameter search, and pytorch in 3.6 to introduce automatic differentiation. Course datasets come from the mlgeo_synth package (physically motivated synthetic generators), the course data repository, and a curated Zenodo archive of Pacific Northwest seismic events.

Learning outcomes

By the end of this chapter, you will be able to:

Assignments