Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SciPy, what is 'slinear' interpolation?

Tags:

python

scipy

I can't find an explanation in the documentation or anywhere online. What does 'slinear' stand for and what does it do?

like image 789
Nate Avatar asked Jul 10 '13 13:07

Nate


People also ask

What is interpolation in Scipy?

Interpolation is a method for generating points between given points. For example: for points 1 and 2, we may interpolate and find points 1.33 and 1.66. Interpolation has many usage, in Machine Learning we often deal with missing data in a dataset, interpolation is often used to substitute those values.

What is interpolation in Python?

Interpolation is mostly used to impute missing values in the dataframe or series while preprocessing data. Interpolation is also used in Image Processing when expanding an image you can estimate the pixel value with help of neighboring pixels.

What does Scipy interpolate interp1d return?

Interpolate a 1-D function. x and y are arrays of values used to approximate some function f: y = f(x). This class returns a function whose call method uses interpolation to find the value of new points.

What is spline interpolation Python?

Interpolation is a method of estimating unknown data points in a given dataset range. Discovering new values between two data points makes the curve smoother. Spline interpolation is a type of piecewise polynomial interpolation method.


1 Answers

Looking at the source of scipy/interpolate/interpolate.py, slinear is a spline of order 1

if kind in ['zero', 'slinear', 'quadratic', 'cubic']:
    order = {'nearest': 0, 'zero': 0,'slinear': 1,
             'quadratic': 2, 'cubic': 3}[kind]
    kind = 'spline'

...

if kind in ('linear', 'nearest'):
    # Make a "view" of the y array that is rotated to the interpolation
    # axis.
    minval = 2
    if kind == 'linear':
        self._call = self._call_linear
    elif kind == 'nearest':
        self.x_bds = (x[1:] + x[:-1]) / 2.0
        self._call = self._call_nearest
else:
    minval = order + 1
    self._call = self._call_spline
    self._spline = splmake(x, y, order=order)

Since the docs for splmake state:

def splmake(xk, yk, order=3, kind='smoothest', conds=None):
    """
    Return a representation of a spline given data-points at internal knots
    ...
like image 79
Hooked Avatar answered Oct 16 '22 10:10

Hooked