  We consider two related tasks: (a) estimating a parameterisation of a given
Gibbs state and expectation values of Lipschitz observables on this state; and
(b) learning the expectation values of local observables within a thermal or
quantum phase of matter. In both cases, we wish to minimise the number of
samples we use to learn these properties to a given precision.
  For the first task, we develop new techniques to learn parameterisations of
classes of systems, including quantum Gibbs states of non-commuting
Hamiltonians with exponential decay of correlations and the approximate Markov
property. We show it is possible to infer the expectation values of all
extensive properties of the state from a number of copies that not only scales
polylogarithmically with the system size, but polynomially in the observable's
locality -- an exponential improvement. This set of properties includes
expected values of quasi-local observables and entropies.
  For the second task, we develop efficient algorithms for learning observables
in a phase of matter of a quantum system. By exploiting the locality of the
Hamiltonian, we show that $M$ local observables can be learned with probability
$1-\delta$ to precision $\epsilon$ with using only
$N=O\big(\log\big(\frac{M}{\delta}\big)e^{polylog(\epsilon^{-1})}\big)$ samples
-- an exponential improvement on the precision over previous bounds. Our
results apply to both families of ground states of Hamiltonians displaying
local topological quantum order, and thermal phases of matter with exponential
decay of correlations. In addition, our sample complexity applies to the worse
case setting whereas previous results only applied on average.
  Furthermore, we develop tools of independent interest, such as robust shadow
tomography algorithms, Gibbs approximations to ground states, and
generalisations of transportation cost inequalities for Gibbs states.
