SG++-Doxygen-Documentation
|
We compute the sparse grid interpolant of the function \( f(x) = \sin(10x_0)+x_1.\) We perform dimension-adaptive refinement of the sparse grid model, which means we add a complete hierarchical subspace in some dimensions.
For details on dimension-adaptive refinement see
Hegland, M. Adaptive sparse grids, ANZIAM Journal, 2003, 44, C335-C353
The example can be found in the file subspaceRefinement.py
.
We define the function \( f(x) = \sin(10x_0)+x_1\) to interpolate.
create a two-dimensional piecewise bi-linear grid
To create a dataset we use points on a regular 2d grid with a step size of 1 / rows and 1 / cols.
We refine adaptively 20 times. In every step we recompute the vector of surpluses alpha
, the vector with squared errors on the dataset errorVector
, and then call the refinement routines.
Step 1: calculate the surplus vector alpha. In data mining with do it by solving a regression problem as shown in example Classification Example. Here, the function can be evaluated at any point. Hence. we simply evaluate it at the coordinates of the grid points to obtain the nodal values. Then we use hierarchization to obtain the surplus value.
Step 2: call refinement routines. PredictiveRefinement
implements the decorator pattern and extends the functionality of ANOVAHashRefinement
. PredictiveRefinement
requires a special kind of refinement functor – PredictiveRefinementIndicator
that can access the dataset and the error vector. The refinement itself if performed by calling .free_refine()
same for normal refinement in ANOVAHashRefinement
. ANOVAHashRefinement
creates new grid points only in the dimensions where the parent has level greater 1.
The output of the program should look like this
dimensionality: 2 number of initial grid points: 17 length of alpha vector: 17 length of alpha vector: 17 Refinement step 1, new grid size: 33 Refinement step 2, new grid size: 73