Class RadialBasis
- All Implemented Interfaces:
Serializable,Cloneable
RadialBasis computes a least-squares fit to scattered data in \( {\bf R}^d\), where d is the dimension. More precisely, we are given data points $$x_0,\ldots,x_{n-1}\in{\bf R}^d $$ and function values $$f_0,\ldots,f_{n-1}\in{\bf R}^1$$
The radial basis fit to the data is a function sF which approximates the above data in the sense that it minimizes the sum-of-squares error
$$\sum_{i=0}^{n-1}w_i\left(F(x_i)-f_i\right)^2 $$where w are the weights. Of course, we must restrict the functional form of F. Here we assume it is a linear combination of radial functions:
$$F(x)\equiv\sum_{j=0}^{m-1}\alpha_j\phi(\|x-c_j\|) $$ The \(c_j\) are the centers.A radial function, \(\phi(r)\), maps \([0,\infty) \) into \({\bf R}^1\). The default radial function is the Hardy multiquadric,
$$\phi(r)\equiv\sqrt{r^2+\delta^2}$$with \(\delta=1\). An alternate radial function is the Gaussian, \(e^{-ax^2}\).
By default, the centers are points in a Faure sequence, scaled to cover the box containing the data.
Two update methods allow the user to specify weights for each
data point in the approximation scheme. In this way the user can influence
the fit of the radial basis function. For example, if weights are in the
range [0,1] then 0-weighted points are effectively removed from computations
and 1-weighted points will have more influence than any others. When the
number of centers equals the number of data points, the RBF fit will be
"exact", otherwise it will be an approximation (useful for large or noisy
data sets). Provided the ratios of the weights are not too extreme, weights
will not appreciably change the accuracy of the fit to the data, but they
will affect the shape of the approximating function away from the data:
Greater weights result in greater influence at greater distances.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePublic interface for the user supplied function to theRadialBasisobject.static classThe Gaussian basis function, \(e^{-ax^2}\).static classThe Hardy multiquadric basis function, \(\sqrt{r^2+\delta^2} \). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetANOVA()Returns the ANOVA statistics from the linear regression.Returns the radial function.double[]gradient(double[] x) Returns the gradient of the radial basis approximation at a point.voidsetRadialFunction(RadialBasis.Function radialFunction) Sets the radial function.voidupdate(double[][] x, double[] f) Adds a set of data points, all with weight = 1.voidupdate(double[][] x, double[] f, double[] w) Adds a set of data points with user-specified weights.voidupdate(double[] x, double f) Adds a data point with weight = 1.voidupdate(double[] x, double f, double w) Adds a data point with a specified weight.doublevalue(double[] x) Returns the value of the radial basis approximation at a point.double[]value(double[][] x) Returns the value of the radial basis at a point.
-
Constructor Details
-
RadialBasis
public RadialBasis(int nDim, int nCenters) Creates a new instance of RadialBasis.- Parameters:
nDim- anintspecifying the number of dimensions.nCenters- anintspecifying the number of centers.
-
-
Method Details
-
setRadialFunction
Sets the radial function.- Parameters:
radialFunction- aRadialBasis.Functionto be used in the approximation. The default is Hardy Multiquadric with \(\delta=1\).
-
getRadialFunction
Returns the radial function.- Returns:
- a
RadialBasis.Functionwhich is the current radial function.
-
update
public void update(double[] x, double f) Adds a data point with weight = 1.- Parameters:
x- is adoublearray containing the locations of the data point.f- is adoublecontaining the function value at the data point.
-
update
public void update(double[] x, double f, double w) Adds a data point with a specified weight.- Parameters:
x- is adoublearray containing the locations of the data point.f- is adoublecontaining the function value at the data point.w- is adoublecontaining the weight of this data point.
-
update
public void update(double[][] x, double[] f) Adds a set of data points, all with weight = 1.- Parameters:
x- is adoublematrix of size n by nDim containing the locations of the data points for each dimension.f- is adoublearray containing the function values at the data points.
-
update
public void update(double[][] x, double[] f, double[] w) Adds a set of data points with user-specified weights.- Parameters:
x- is adoublematrix of size n by nDim containing the locations of the data points for each dimension.f- is adoublearray containing the function values at the data points.w- is adoublearray containing the weights associated with the data points.
-
value
public double value(double[] x) Returns the value of the radial basis approximation at a point.- Parameters:
x- is adoublearray containing the locations of the data point at which the approximation is to be computed.- Returns:
- a
doublecontaining the value of the radial basis approximation at x.
-
gradient
public double[] gradient(double[] x) Returns the gradient of the radial basis approximation at a point.- Parameters:
x- is adoublearray containing the locations of the data point at which the approximation's gradient is to be computed.- Returns:
- a
doublearray, of lengthnDimcontaining the value of the gradient of the radial basis approximation at x.
-
value
public double[] value(double[][] x) Returns the value of the radial basis at a point.- Parameters:
x- adoublematrix of size n by nDim containing the points at which the radial basis is to be evaluated.- Returns:
- a
doublearray giving the value of the radial basis at the pointx
-
getANOVA
Returns the ANOVA statistics from the linear regression.- Returns:
- an
ANOVAtable and related statistics - See Also:
-