pwtools.rbf.core.Rbf.fit¶
- Rbf.fit()[source]¶
Solve linear system for the weights.
The weights self.w (\(\mathbf w\)) are found from: \(\mathbf G\,\mathbf w = \mathbf z\) or if \(r\) is given \((\mathbf G + r\,\mathbf I)\,\mathbf w = \mathbf z\).
with centers == points (center vectors are all data points). Then G is quadratic. Updates
self.w
.Notes
self.r != None
linear system solverFor \(r=0\), this always yields perfect interpolation at the data points. May be numerically unstable in that case. Use \(r>0\) to increase stability (try small values such as
1e-10
first) or create smooth fitting (generate more stiff functions with higher r). Behaves similar tolstsq
but appears to be numerically more stable (no small noise in solution) .. but r it is another parameter that needs to be tuned.self.r = None
least squares solverUse
scipy.linalg.lstsq()
. Numerically more stable than direct solver w/o regularization. Will mostly be the same as the interpolation result, but will not go thru all points for very noisy data. May create small noise in solution (plot fit with high point density). Much (up to 10x) slower that normal linear solver whenself.r != None
.