Bayesian functional optimisation with shape prior