Welcome to Espresso!

Welcome to Espresso!#

You’ve just come up with a new optimisation algorithm, inversion strategy, or machine learning-based inference framework. Now you want to see how it performs on a real-world problem…

Espresso (Earth science problems for the evaluation of strategies, solvers and optimizers) aims to make this as easy as possible. It provides access to a range of exemplars via a standardized Python interface, including domain-expert–curated datasets and corresponding simulation codes. Swapping from one test problem to the next is just one line of code.

Here’s a simple illustration:

 1import numpy as np
 2
 3# Select the test problem to be used -- change this line to any
 4# other test problem and everything else should still work!
 5from espresso import SimpleRegression as test_problem
 6
 7# Create an instance of the test problem class
 8tp = test_problem()
 9
10# The test problem provides...
11# ... an initial (null) model vector
12model = tp.starting_model
13# ... the ability to compute simulated data for an arbitrary
14# model vector, and the corresponding jacobian (i.e. derivatives
15# of data wrt model parameters)
16predictions, G = tp.forward(model, return_jacobian = True)
17# ... a data vector, which matches the output from `tp.forward()`
18residuals = tp.data - predictions
19# ... and much more!
20
21# Compute a Gauss-Newton model update
22model += np.linalg.solve(G.T.dot(G), G.T.dot(residuals))
23
24# Compare our result to the answer suggested by Espresso
25print("Our result:", model)
26print("Espresso:", tp.good_model)
27
28# And let's visualise both to see where the differences are:
29my_fig = tp.plot_model(model)
30espresso_fig = tp.plot_model(tp.good_model)
31data_fig = tp.plot_model(tp.data, tp.forward(model))

If this looks interesting, you can:

📙 User Guide

Read about what Espresso provides and how to use it

📗 Contributor Guide

Contribute your own example problems with minimal steps

📘 Developer Guide

Learn about the infrastructure behind Espresso

🐍 GitHub Repository

Explore the source code on GitHub

🐛 Issue Tracker

Report a bug or suggest a feature by creating an issue

💬 Join Slack

Accept this invitation to join the conversation on Slack

Espresso is an open-source community effort, currently supported and coordinated by InLab.