[SciPy-User] weighted griddata
Thu Sep 16 23:41:28 CDT 2010
Thanks to all for the input. I'm a Python programmer trying to
understand the math I need. My comments in line...
> So you have data
> (x[i], y[i], t[i])
> and you'd like to fit a 2-D surface to it? I guess you used griddata to
> find the graph of the function y = f(x, t)?
Right, but griddata alone just fills in the grid, it doesn't return a
function, and as you rightly point out, only fills in and doesn't
smooth the original data.
> You may need to fiddle with the smoothing parameter `s=...` for
I was using interpolate.SmoothBivariateSpline previously and had good
results when it worked, but I struggled with the smoothing parameter
for so long I had to put it down. I could not figure out how to
consistently calculate/estimate/predict a smoothing factor (from the
data) that was not too low (and never return) or too high (and give
Is there a way to calculate an optimal smoothing factor from a data set?
> Or, you can maybe fit a 1-D spline (UnivariateSpline) at each `t`
> separately, and use the smoothed results in griddata. The 1D spline
> routines are robust.
Tried that too, but that didn't really do the trick, since the actual
position of a point is more a function of the neighbors in time then
along shore, due to obstacles, etc.
> No, I tell a lie, the Clough-Tocher 2D spline could easily be used for
> weighed data smoothing. The only change needed would be to adjust the
> gradient estimation routine ...
Yea, that's what I was thinking, ha ha, I just don't know how. Pointers?
> I think the rbf routines might be appropriate.
I've used the rbf routines to ortho-rectify our barrel-distorted
images (where the data comes from), but here the positional data is
not based around a center point. Or maybe I don't understand the rbf
stuff fully. How would I use weights with the rbf stuff?
> If you use the sqrt of the squares it is a Sobolev space due to the fact
> that the first derivative can be omitted. but there are lots of variations
> on this theme. Another is least squares with, say, lambda times the square
> of the second difference added to the normal squared deviation. That tends
> to keep the wiggles down but is very sensitive to lambda. There might even
> be an official name for that method, it goes back a long ways.
For clarification, all the points of a line have the same t value, but
each point has a weight of 0 to 1. Would LSQBivariateSpline be any
better than SmoothBivariateSpline? Again, the smoothing factor drove
More information about the SciPy-User