# [Numpy-discussion] Interpolation question

Robert Kern robert.kern@gmail....
Sun Mar 28 18:34:45 CDT 2010

```On Sun, Mar 28, 2010 at 18:30, Andrea Gavana <andrea.gavana@gmail.com> wrote:
> Hi Friedrich & All,
>
> On 28 March 2010 23:51, Friedrich Romstedt wrote:
>> 2010/3/28 Andrea Gavana <andrea.gavana@gmail.com>:
>>> Example 1
>>>
>>> # o2 and o3 are the number of production wells, split into 2
>>> # different categories
>>> # inj is the number of injection wells
>>> # fomts is the final oil recovery
>>>
>>> rbf = Rbf(oilPlateau, gasPlateau, gasInjPlateau, o2, o3, inj, fomts)
>>>
>>> op = [50380]
>>> gp = [103014000]
>>> gi = [53151000]
>>> o2w = [45]
>>> o3w = [20]
>>> inw = [15]
>>>
>>> fi = rbf(op, gp, gi, o2w, o3w, inw)
>>>
>>> # I => KNOW <= the answer to be close to +3.5e8
>>>
>>> print fi
>>>
>>> [ -1.00663296e+08]
>>>
>>> (yeah right...)
>>>
>>>
>>> Example 2
>>>
>>> Changing o2w from 45 to 25 (again, the answer should be close to 3e8,
>>> less wells => less production)
>>>
>>> fi = rbf(op, gp, gi, o2w, o3w, inw)
>>>
>>> print fi
>>>
>>> [  1.30023424e+08]
>>>
>>> And keep in mind, that nowhere I have such low values of oil recovery
>>> in my data... the lowest one are close to 2.8e8...
>>
>> I want to put my2 cents in, fwiw ...
>>
>> What I see from
>> http://docs.scipy.org/doc/scipy-0.7.x/reference/generated/scipy.interpolate.Rbf.html#scipy.interpolate.Rbf
>> are three things:
>>
>> 1. Rbf uses some weighting based on the radial functions.
>> 2. Rbf results go through the nodal points without *smooth* set to
>> some value != 0
>> 3. Rbf is isotropic
>>
>> (3.) is most important.  I see from your e-mail that the values you
>> pass in to Rbf are of very different order of magnitude.  But the
>> default norm used in Rbf is for sure isotropic, i.e., it will result
>> in strange and useless "mean distances" in R^N where there are N
>> parameters.  You have to either pass in a *norm* which weights the
>> coords according to their extent, or to scale the data such that the
>> aspect ratios of the hypecube's edges are sensible.

> I believe I need a technical dictionary to properly understand all
> that... :-D . Sorry, I am no expert at all, really, just an amateur
> magnitude of the matrix is a very interesting one. Although I have
> absolutely no idea on how to re-scale them properly to avoid RBFs
> going crazy.

Scaling each axis by its standard deviation is a typical first start.
Shifting and scaling the values such that they each go from 0 to 1 is
another useful thing to try.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
```