bayesquad_from_data¶
- probnum.quad.bayesquad_from_data(nodes, fun_evals, kernel=None, measure=None, domain=None, options=None)¶
Infer the value of an integral from a given set of nodes and function evaluations.
- Parameters:
nodes (ndarray) – shape=(n_eval, input_dim) – Locations at which the function evaluations are available as
fun_evals
.fun_evals (ndarray) – shape=(n_eval,) – Function evaluations at
nodes
.kernel (CovarianceFunction | None) – The kernel used for the GP model. Defaults to the
ExpQuad
kernel.measure (IntegrationMeasure | None) – The integration measure. Defaults to the Lebesgue measure.
domain (DomainLike | None) – The integration domain. Contains lower and upper bound as scalar or
np.ndarray
. Obsolete ifmeasure
is given.options (dict | None) –
A dictionary with the following optional solver settings
- scale_estimationOptional[str]
Estimation method to use to compute the scale parameter. Defaults to ‘mle’. Options are
Maximum likelihood estimation
mle
- jitterOptional[FloatLike]
Non-negative jitter to numerically stabilise kernel matrix inversion. Defaults to 1e-8.
- Returns:
integral – The integral belief subject to the provided measure or domain.
info – Information on the performance of the method.
- Raises:
ValueError – If neither a domain nor a measure are given.
- Warns:
UserWarning – When
domain
is given but not used.- Return type:
See also
bayesquad
Computes the integral using an acquisition policy.
Warning
Currently the method does not support tuning of the kernel parameters other than the global kernel scale. Hence, the method may perform poorly unless the kernel parameters are set to appropriate values by the user.
Examples
>>> import numpy as np >>> domain = (0, 1) >>> nodes = np.linspace(0, 1, 15)[:, None] >>> fun_evals = nodes.reshape(-1, ) >>> F, info = bayesquad_from_data(nodes=nodes, fun_evals=fun_evals, domain=domain) >>> print(F.mean) 0.5