Skip to content

This repository contains the supplementary code to "Calibration, validation, and evaluation of machine learning thermobarometers in metamorphic petrology: an application to biotite and outlook for future strategy" by Hartmeier et al. (2025).

License

Notifications You must be signed in to change notification settings

Philipsite/ml-biotite-thermobarometry

Repository files navigation

ml-biotite-thermobarometry

This repository contains the supplementary code to "Calibration, validation, and evaluation of machine learning thermobarometers in metamorphic petrology: an application to biotite and outlook for future strategy" by Hartmeier et al. (2025).

Contents

The data and figures in the manuscript can be reproduced using the jupyter notebooks in th is repository. The most important results and their corresponding notebook are listed here.

00: Data analysis

01: Fit natural biotite

Data:

  • Biotite data from mineral assemblage sequences, based on the database of Pattison and Forshaw (2025, in review).

    • Biotite data set: Used to calibrate the thermobarometer.
    • Biotite data set, reduced to analyses with measured Na: Used in feature engineering.
    • Biotite data set, latest version of Pattison and Forshaw (v2025-February). Used to test whether recent updates to the database have resulted in a significant change in model performance.
  • K-fold data. CSVs of 5-fold training and validation splits used during cross-validation.

    • K-fold biotite data: Used to calibrate the thermobarometer.
    • K-fold biotite data, latest version of Pattison and Forshaw (v2025-February). Used to test whether recent updates to the database have resulted in a significant change in model performance.
  • Training logs, log files of training and validation performance for all models calibrated.

  • Saved models, trained models saved in tensorflow's SavedModel format.

02: Pre-training on biotite generated using phase equilibrium modelling

Data:

  • Training logs, log files of training and validation performance for all models calibrated.

  • Saved models, trained models saved in tensorflow's SavedModel format.

  • Data sets generated using phase equilibrium modelling are available upon request.

03: Transfer learning

Data:

  • Training logs, log files of training and validation performance for all models calibrated.

  • Saved models, trained models saved in tensorflow's SavedModel format.

04: Validation & model selection

05: Systematic performance analysis (testing)

Data:

  • Test dataset
  • Compositional maps (hdf5 format) are available upon request.

06: Explainability

A note on reproducibility

As the initial parameterisation and gradient descent optimisation are stochastic processes, the training of a neural network is not fully reproducible.

Therefore, it is not recommended to re-run the scripts used to train the models, as this will overwrite the original calibration of the neural network used in the work presented here. The purpose of these scripts is solely to document the training procedure and can be copied as a template to fit other new neural networks.

To experiment with the models calibrated here, they can be loaded from the saved_models directories provided.

Installation / Dependencies

The code in this repo is depending on Keras2 and will no longer work with keras >3.x. Therefore tensorflow is limited to v2.15.0 as this was the the final release before the launch of Keras 3.0.

This introduces some important hard dependencies itself:

  • NumPy is limited to <2.0, which then imposes
  • Python <3.12, tested with 3.11 (recommended).

The full dependencies are specified in the pyproject.toml and poetry.lock file. Checkout poetry to make use of the lock file to reproduce the virtual env used to generate all results presented here exactly.

CAUTION: The poetry installation of tensorflow, seems to fail silently. The installation using poetry install runs without error, but tensorflow will not be installed and cannot be called. As a work around tensorflow was installed afterwards using pip.

source .venv/bin/activate
pip install tensorflow==2.15

followed by (to install the ml_tb project locally)

poetry install

About

This repository contains the supplementary code to "Calibration, validation, and evaluation of machine learning thermobarometers in metamorphic petrology: an application to biotite and outlook for future strategy" by Hartmeier et al. (2025).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published