Live data from Hacker News

Cubic spline interpolation

eli.thegreenplace.net

11–20 of 29 posts

Re: Cubic spline interpolation

#11
> There are many techniques to interpolate between a given set of points. Polynomial interpolation can perfectly fit N points with an N-1 degree polynomial, but this approach can be problematic for large a N; high-degree polynomials tend to overfit their data, and suffer from other numerical issues like Runge's phenomenon.

This is a misconception that's often repeated. High degree polynomial interpolations are problematic if you use equispaced points. If you use Chebyshev points, they are highly accurate and in general perform much better than cubic splines. See myth 1 from Lloyd Trefethen's paper: https://people.maths.ox.ac.uk/trefethen/mythspaper.pdf

Re: Cubic spline interpolation

#12
post #11

> There are many techniques to interpolate between a given set of points. Polynomial interpolation can perfectly fit N points with an N-1 degree polynomial, but this approach can be problematic for large a N; high-degree polynomials tend to overfit their data, and suffer from other numerical issues like Runge's phenomenon. This is a misconception that's often repeated. High degree polynomial interpolations are proble…

> in general perform much better than cubic splines

Source? (I couldn't find that in the paper you linked.)

Re: Cubic spline interpolation

#13
post #11

> There are many techniques to interpolate between a given set of points. Polynomial interpolation can perfectly fit N points with an N-1 degree polynomial, but this approach can be problematic for large a N; high-degree polynomials tend to overfit their data, and suffer from other numerical issues like Runge's phenomenon. This is a misconception that's often repeated. High degree polynomial interpolations are proble…

That's a great paper, thanks for the pointer.

Re: Cubic spline interpolation

#15
Stineman interpolation [0] is an alternative that is quick and "dirty" imputer for missing values. Of course there are monotonic-preserving versions [1] of splines that are excellent as well.

For my uses, cubic interpolation is simply not of value when I have noisy points and/or unpredictable behaviour between points --- Kalman smoothers or Gaussian process/Kriging gives me both a good mean estimate between points and a sense of the error associated with the interpolation.

[0] https://archive.org/details/creativecomputing-1980-07/page/n...

[1] https://en.wikipedia.org/wiki/Monotone_cubic_interpolation

Re: Cubic spline interpolation

#16
post #15

Stineman interpolation [0] is an alternative that is quick and "dirty" imputer for missing values. Of course there are monotonic-preserving versions [1] of splines that are excellent as well. For my uses, cubic interpolation is simply not of value when I have noisy points and/or unpredictable behaviour between points --- Kalman smoothers or Gaussian process/Kriging gives me both a good mean estimate between points an…

I second this. In quantitative finance cubic splines are often, simply, out of the question. However, we end up using montonic cubic splines quite often.

Re: Cubic spline interpolation

#18
post #12
post #11

> There are many techniques to interpolate between a given set of points. Polynomial interpolation can perfectly fit N points with an N-1 degree polynomial, but this approach can be problematic for large a N; high-degree polynomials tend to overfit their data, and suffer from other numerical issues like Runge's phenomenon. This is a misconception that's often repeated. High degree polynomial interpolations are proble…

> in general perform much better than cubic splines Source? (I couldn't find that in the paper you linked.)

The paper gives the rate of convergence you get with Polynomial interpolants in Chebyshev nodes:

> If f has v derivatives, with the vth derivative being of bounded variation V, then ||f - p_n|| = O(V n^{-v}) as n -> ∞

and

> If f is analytic, the convergence is geometric, with ||f - p_n|| = O(p^{-n}) for some p > 1

You will not get that good of a rate of convergence with cubic splines. See https://www.researchgate.net/publication/243095286_On_the_Or...

This is further explained in Trefethen's book https://www.amazon.com/Approximation-Theory-Practice-Applied...

Quoting from Ch 14

> In fact, polynomial interpolants in Chebyshev points are problem-free when evaluated by the barycentric interpolation formula. They have the same behavior as discrete Fourier series for period functions, whose reliability nobody worries about. The introduction of splines is a red herring: the true advantage of splines is not that they converge where polynomials fail to do so, but that they are more easility adapted to irregular point distributions and more localized.

You can see also the software package https://www.chebfun.org/ for Chebyshev interpolations with Matlab and https://github.com/rnburn/bbai for Chebyshev interpolation of arbitrary dimension functions with sparse grids for Python. And here is a quick notebook for an experiment you can run that will compare Chebyshev interpolants to cubic splines: https://github.com/rnburn/bbai/blob/master/example/13-sparse...

Re: Cubic spline interpolation

#19
post #10

Polynomials, sampling theory, signal processing, Fourier series, etc. are all so closely related that learning even a little bit of one of these things opens up such a wealth of other things to think about and explore. Splines like this basically answer the question "what polynomial fits these points the best?" which, it turns out, is the same question you need to pose to begin formulating gaussian quadrature. And ga…

That post should come with a "Danger: Rabbit Hole" warning. What a great lecturer!

Re: Cubic spline interpolation

#20
post #18
post #12

Earlier quoted context omitted.

> in general perform much better than cubic splines Source? (I couldn't find that in the paper you linked.)

The paper gives the rate of convergence you get with Polynomial interpolants in Chebyshev nodes: > If f has v derivatives, with the vth derivative being of bounded variation V, then ||f - p_n|| = O(V n^{-v}) as n -> ∞ and > If f is analytic, the convergence is geometric, with ||f - p_n|| = O(p^{-n}) for some p > 1 You will not get that good of a rate of convergence with cubic splines. See https://www.researchgate.net…

Thank you!
Post reply on HN