chaospy.fit_quadrature

chaospy.fit_quadrature(orth, nodes, weights, solves, retall=False, norms=None)[source]

Fit polynomial chaos expansion using spectral projection.

Create a polynomial approximation model from orthogonal expansion, quadrature nodes and weights.

Args:
orth (numpoly.ndpoly):

Orthogonal polynomial expansion. Must be orthogonal for the approximation to be accurate.

nodes (numpy.ndarray):

Where to evaluate the polynomial expansion and model to approximate. nodes.shape==(D, K) where D is the number of dimensions and K is the number of nodes.

weights (numpy.ndarray):

Weights when doing numerical integration. weights.shape == (K,) must hold.

solves (numpy.ndarray):

The model evaluation to approximate. If numpy.ndarray is provided, it must have len(solves) == K.

retall (int):

What the function should return. 0: only return fitted polynomials, with shape evals.shape[1:]. 1: polynomials, and Fourier coefficients, 2: polynomials, coefficients and polynomial evaluations.

norms (numpy.ndarray):

Three terms recurrence method produces norms more stable than the ones calculated from the polynomials themselves. Calculated from quadrature if not provided. norms.shape == (len(orth),) must hold.

Returns:
(numpoly.ndpoly):

Fitted model approximation in the form of an polynomial.