Hi Hans, hi Kyle,

Thanks for your suggestions. I amended the code in the git 
<https://github.com/nilshg/LearningModels/blob/master/Test_Interpolations.jl> 
accordingly, adding the pchip() interpolation from NumericalMath and 1D and 
2D spline interpolation on an irregular grid with Dierckx.
I tried "benchmarking" the different interpolations by evaluating the 
interpolants at five times the number of points used for the interpolation 
(with the same min and max value) and calculating the average relative 
deviation (y_actual - y_interpolated)/(y_actual) over those points. The 
results are as follows:

1D interpolation: 
Dierckx Spline1D, irregular grid (7e-7)  <  NumericalMath pchip (0.10)  <  
Grid InterpLinear (0.169)  <  Dierckx Spline1D, regular grid (0.175)  <  
Grid InterpQuadratic (0.316)

2D interpolation:
Dierckx Spline2D, irregular grid (0.11)  <  Dierckx Spline2D, regular grid 
(0.29)  <  Grid InterpLinear (0.358)  <  Grid InterpQuadratic (0.7)

I guess the results are not very surprising to people with more experience 
in interpolation than myself, but I wanted to document this here in case 
any new Julia users are interested in the different interpolation options. 
While the code in the git might not be the prettiest, it should at least 
give an overview of how to use the different options available, and get a 
quick look at their performance for different functions.

The question remaining is whether there's any options for shape preserving 
interpolation in two or more dimensions. If anyone could point me towards a 
package able to do this I'd be most grateful.

Best,
Nils

Reply via email to