Approximation
- class approx(X, y, U, N, basis='cos')
A class to hold the scattered data function approximation.
This class represents an approximation object constructed from scattered data nodes, function values, an ANOVA decomposition class, and a choice of basis functions. It supports multiple bases and regularization parameters.
Attributes:
- basis
Type: str
Basis of the function space. Supported values are:
“per”: exponential functions
“cos”: cosine functions
“cheb”: Chebyshev basis
“std”: transformed exponential functions
“chui1”: Haar wavelets
“chui2”: Chui-Wang wavelets of order 2
“chui3”: Chui-Wang wavelets of order 3
“chui4”: Chui-Wang wavelets of order 4
- X
Type: Numpy array wit dtype float
The scattered data nodes with M rows and d columns.
- y
Type: Numpy array wit dtype float or complex
A vector of M function values. Complex-valued for basis = “per”, real-valued otherwise.
- U
Type: List[Tuple[int]]
A vector containing subsets of coordinate indices representing the ANOVA decomposition.
- N
Type: List[int]
Bandwidths for each ANOVA term.
- trafo
Type: GroupedTransform
Holds the grouped transformation.
- fc
Type: Dict[float, GroupedCoefficients]
holds the GroupedCoefficients after approximation for every different regularization parameters
Constructor:
- approx(X, y, U, N, basis='cos')
Additional Constructor:
- approx(X, y, ds, N, basis='cos')
Functions:
- approximate(self, lam, max_iter=50, weights=None, verbose=False, solver=None, tol=1e-8)
If
lamis anp.ndarrayof dtype float, this function computes the approximation for the regularization parameters contained inlam.If
lamis a float, this function computes the approximation for the regularization parameterlam.
- evaluate(self, lam=None, X=None)
This function evaluates the approximation with optional node matrix
Xand regularizationlam.If both
Xandlamare given: evaluate atXfor specificlam.If only
Xis given: evaluate atXfor alllam.If only
lamis given: evaluate atself.Xfor specificlam.If neither are given: evaluate at
self.Xfor alllam.
- evaluateANOVAterms(self, X, lam=None)
This function evaluates the single ANOVA terms of the approximation on the nodes of matrix
Xand regularizationlam.If
lamis given: evaluate atXfor specificlam.If
lamis not given: evaluate atXfor alllam.
- evaluateSHAPterms(self, X, lam=None)
This function evaluates for each dimension the Shapley contribution to the overall approximation on the nodes of matrix
Xand regularizationlam.If
lamis given: evaluate atXfor specificlam.If
lamis not given: evaluate atXfor alllam.