FillExtrapolation#

class skfda.representation.extrapolation.FillExtrapolation(fill_value)[source]#

Values outside the domain range will be filled with a fixed value.

Examples

>>> from skfda.datasets import make_sinusoidal_process
>>> from skfda.representation.extrapolation import FillExtrapolation
>>> fd = make_sinusoidal_process(n_samples=2, random_state=0)

We can set the default type of extrapolation

>>> fd.extrapolation = FillExtrapolation(0)
>>> fd([-.5, 0, 1.5]).round(3)
array([[[ 0.   ],
        [ 0.976],
        [ 0.   ]],
       [[ 0.   ],
        [ 0.759],
        [ 0.   ]]])

The previous extrapolator is equivalent to the string “zeros”. In the same way FillExtrapolation(np.nan) is equivalent to “nan”.

>>> fd.extrapolation = "nan"
>>> fd([-.5, 0, 1.5]).round(3)
array([[[   nan],
        [ 0.976],
        [   nan]],
       [[   nan],
        [ 0.759],
        [   nan]]])

Methods

Parameters:

fill_value (float) –

Examples using skfda.representation.extrapolation.FillExtrapolation#

Extrapolation

Extrapolation