I can't find an explanation in the documentation or anywhere online. What does 'slinear' stand for and what does it do?
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.
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.
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.
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.
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
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With