[julia-users] Re: 4D interpolation from scattered points

2015-05-18 Thread Florian Oswald
Hi there,
xdata (or any other grid) does not need to be on a grid, that's just the 
way the example is written. but no extrapolation, that's right.

On Thursday, 14 May 2015 01:05:55 UTC+1, Yakir Gagnon wrote:

 Thanks a ton people!!!

 ExtremelyRandomizedTrees.jl: Might be really good, but errored a lot on 
 version 4.
 ApproXD.jl: Very cool, I'll come back to that later, but for now: What 
 Lininterp cannot do: Multidimensional extrapolation which I need (and 
 accept is prone to silliness). Plus, according to the examples, the known 
 xdata needs to be on a grid. My x,y,z are not equally spaced that way, they 
 are scattered.
 compute the distances: I started with that, and in light of these results 
 I might fall back to doing just that. 
 Polyharmonic Splines: does exactly what I want, but not faster than just 
 distances (but probably a lot more accurate). 
 CHull.jl: might be awesome for this, but I didn't quickly see how I can 
 use it to interpolate and extrapolate.

 I feel like I owe you guys some background: I have some color-map 
 functions that take a value, let's call it X (for some 0X1 and for some 
 -pi/2Xpi/2) and return an RGB. I need to use these to convert images that 
 have colors that are similar (but not always identical) to the RGB values 
 from these color-maps back to the value (X) that would have resulted in 
 said RGB (so it's like the inverse of those color-map functions). After 
 much trial and error, I think that since the images I want to convert this 
 way are all 8-bit, the fastest way would be to construct a lookup table for 
 all 2^(8*3) possible RGB combinations. This table (Dict) will take any RGB 
 value from those images I need to convert and return X. This makes sense 
 because I have only 4 such color-map functions, and potentially endless 
 amounts of images to convert (currently a couple of tera). 
 So I think I'll use simple distances, run that once, save those lookup 
 tables and use them again and again on new images. 




 On Thursday, May 14, 2015 at 4:19:18 AM UTC+10, Luke Stagner wrote:

 You can use Polyharmonic Splines 
 http://nbviewer.ipython.org/gist/lstagner/04a05b120e0be7de9915


 On Wednesday, May 13, 2015 at 5:33:08 AM UTC-7, Yakir Gagnon wrote:

 I have a bunch (~1000) of x,y,z and a corresponding value, V. One unique 
 V for each x,y,z. I want to interpolate and extrapolate wildly (so I 
 really don't care about how accurate or correct it is). The x,y,z I have 
 are not regularly spaced or anything. They're scattered across some range 
 (they all share similar ranges), and I want to know what value (i.e. new V) 
 I should be getting at new and regularly spaced x,y,z. I think 
 Matlab's griddata would do what I want.
 I tired following the lower-level functionality from Grid.jl, 
 Interpolations.jl, and Dierckx.jl, but couldn't figure out how to get this 
 to work. 
 I think I need to fit some curve to my scattered points and then use 
 that to find the values at the new xyz (at least that's how I think 
 griddata works)... Any good simple ideas out there?



Re: [julia-users] Re: 4D interpolation from scattered points

2015-05-13 Thread Tim Holy
On Wednesday, May 13, 2015 06:26:07 AM J Luis wrote:
 Matlab does that with the interp3 function that, I believe, uses the qhull
 http://www.qhull.org/C lib. At least it used to use it and Octave does.
 It would be nice to have a wrapper for this lib.

There's a PyCall based wrapper here:
https://github.com/davidavdav/CHull.jl

--Tim

 
 quarta-feira, 13 de Maio de 2015 às 13:33:08 UTC+1, Yakir Gagnon escreveu:
  I have a bunch (~1000) of x,y,z and a corresponding value, V. One unique V
  for each x,y,z. I want to interpolate and extrapolate wildly (so I
  really
  don't care about how accurate or correct it is). The x,y,z I have are not
  regularly spaced or anything. They're scattered across some range (they
  all
  share similar ranges), and I want to know what value (i.e. new V) I should
  be getting at new and regularly spaced x,y,z. I think Matlab's griddata
  would do what I want.
  I tired following the lower-level functionality from Grid.jl,
  Interpolations.jl, and Dierckx.jl, but couldn't figure out how to get this
  to work.
  I think I need to fit some curve to my scattered points and then use that
  to find the values at the new xyz (at least that's how I think griddata
  works)... Any good simple ideas out there?



[julia-users] Re: 4D interpolation from scattered points

2015-05-13 Thread René Donner
You could use an ensemble regression approach - see 
https://github.com/rened/ExtremelyRandomizedTrees.jl#regression for a 1D to 
1D example. For your data you could use this (ndims == 2, for 
visualization):

using ExtremelyRandomizedTrees, FunctionalDataUtils

# train model
ndim = 2
nsamples = 1000

data = 5+5*randn(ndim, nsamples)
targets = sum(data,1)
targets += randn(size(targets))

model = ExtraTrees(data, targets, regression = true)

# predict
a = meshgrid(1:20, 1:30)   # a is 2 x 20*30
result = reshape(predict(model, a), 20, 30)

using Images
convert(Image,asimagesc(result))




Am Mittwoch, 13. Mai 2015 14:33:08 UTC+2 schrieb Yakir Gagnon:

 I have a bunch (~1000) of x,y,z and a corresponding value, V. One unique V 
 for each x,y,z. I want to interpolate and extrapolate wildly (so I really 
 don't care about how accurate or correct it is). The x,y,z I have are not 
 regularly spaced or anything. They're scattered across some range (they all 
 share similar ranges), and I want to know what value (i.e. new V) I should 
 be getting at new and regularly spaced x,y,z. I think Matlab's griddata 
 would do what I want.
 I tired following the lower-level functionality from Grid.jl, 
 Interpolations.jl, and Dierckx.jl, but couldn't figure out how to get this 
 to work. 
 I think I need to fit some curve to my scattered points and then use that 
 to find the values at the new xyz (at least that's how I think griddata 
 works)... Any good simple ideas out there?



[julia-users] Re: 4D interpolation from scattered points

2015-05-13 Thread Yakir Gagnon
Thanks a ton people!!!

ExtremelyRandomizedTrees.jl: Might be really good, but errored a lot on 
version 4.
ApproXD.jl: Very cool, I'll come back to that later, but for now: What 
Lininterp cannot do: Multidimensional extrapolation which I need (and 
accept is prone to silliness). Plus, according to the examples, the known 
xdata needs to be on a grid. My x,y,z are not equally spaced that way, they 
are scattered.
compute the distances: I started with that, and in light of these results I 
might fall back to doing just that. 
Polyharmonic Splines: does exactly what I want, but not faster than just 
distances (but probably a lot more accurate). 
CHull.jl: might be awesome for this, but I didn't quickly see how I can use 
it to interpolate and extrapolate.

I feel like I owe you guys some background: I have some color-map functions 
that take a value, let's call it X (for some 0X1 and for some 
-pi/2Xpi/2) and return an RGB. I need to use these to convert images that 
have colors that are similar (but not always identical) to the RGB values 
from these color-maps back to the value (X) that would have resulted in 
said RGB (so it's like the inverse of those color-map functions). After 
much trial and error, I think that since the images I want to convert this 
way are all 8-bit, the fastest way would be to construct a lookup table for 
all 2^(8*3) possible RGB combinations. This table (Dict) will take any RGB 
value from those images I need to convert and return X. This makes sense 
because I have only 4 such color-map functions, and potentially endless 
amounts of images to convert (currently a couple of tera). 
So I think I'll use simple distances, run that once, save those lookup 
tables and use them again and again on new images. 




On Thursday, May 14, 2015 at 4:19:18 AM UTC+10, Luke Stagner wrote:

 You can use Polyharmonic Splines 
 http://nbviewer.ipython.org/gist/lstagner/04a05b120e0be7de9915


 On Wednesday, May 13, 2015 at 5:33:08 AM UTC-7, Yakir Gagnon wrote:

 I have a bunch (~1000) of x,y,z and a corresponding value, V. One unique 
 V for each x,y,z. I want to interpolate and extrapolate wildly (so I 
 really don't care about how accurate or correct it is). The x,y,z I have 
 are not regularly spaced or anything. They're scattered across some range 
 (they all share similar ranges), and I want to know what value (i.e. new V) 
 I should be getting at new and regularly spaced x,y,z. I think 
 Matlab's griddata would do what I want.
 I tired following the lower-level functionality from Grid.jl, 
 Interpolations.jl, and Dierckx.jl, but couldn't figure out how to get this 
 to work. 
 I think I need to fit some curve to my scattered points and then use that 
 to find the values at the new xyz (at least that's how I think griddata 
 works)... Any good simple ideas out there?



[julia-users] Re: 4D interpolation from scattered points

2015-05-13 Thread Luke Stagner
You can use Polyharmonic Splines 
http://nbviewer.ipython.org/gist/lstagner/04a05b120e0be7de9915


On Wednesday, May 13, 2015 at 5:33:08 AM UTC-7, Yakir Gagnon wrote:

 I have a bunch (~1000) of x,y,z and a corresponding value, V. One unique V 
 for each x,y,z. I want to interpolate and extrapolate wildly (so I really 
 don't care about how accurate or correct it is). The x,y,z I have are not 
 regularly spaced or anything. They're scattered across some range (they all 
 share similar ranges), and I want to know what value (i.e. new V) I should 
 be getting at new and regularly spaced x,y,z. I think Matlab's griddata 
 would do what I want.
 I tired following the lower-level functionality from Grid.jl, 
 Interpolations.jl, and Dierckx.jl, but couldn't figure out how to get this 
 to work. 
 I think I need to fit some curve to my scattered points and then use that 
 to find the values at the new xyz (at least that's how I think griddata 
 works)... Any good simple ideas out there?