bayesquad_from_data¶
- probnum.quad.bayesquad_from_data(nodes, fun_evals, kernel=None, domain=None, measure=None)[source]¶
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 asfun_evals.fun_evals (
ndarray) – shape=(n_eval,) – Function evaluations atnodes.kernel (
Optional[Kernel]) – The kernel used for the GP model.domain (
Optional[Tuple[Union[ndarray,float,Real,floating],Union[ndarray,float,Real,floating]]]) – shape=(input_dim,) – Domain of integration. Contains lower and upper bound as int or ndarray.measure (
Optional[IntegrationMeasure]) – Integration measure. Defaults to the Lebesgue measure.
- Return type
- Returns
integral – The integral of
funon the domain.info – Information on the performance of the method.
- Raises
ValueError – If neither a domain nor a measure are given.
ValueError – If a domain is given with a Gaussian measure.
Examples
>>> import numpy as np >>> domain = (0, 1) >>> nodes = np.linspace(0, 1, 15)[:, None] >>> fun_evals = 3*nodes**2 >>> F, info = bayesquad_from_data(nodes=nodes, fun_evals=fun_evals, domain=domain) >>> print(F.mean) 1.0001