Linear#

class skfda.misc.covariances.Linear(*, variance=1, intercept=0)[source]#

Linear covariance function.

The covariance function is

\[K(x, x') = \sigma^2 (x^T x' + c)\]

where \(\sigma^2\) is the scale of the variance and \(c\) is the intercept.

Heatmap plot of the covariance function:

from skfda.misc.covariances import Linear
import matplotlib.pyplot as plt

Linear().heatmap(limits=(0, 1))
plt.show()
../../../_images/skfda.misc.covariances.Linear_0_0.png

Example of Gaussian process trajectories using this covariance:

from skfda.misc.covariances import Linear
from skfda.datasets import make_gaussian_process
import matplotlib.pyplot as plt

gp = make_gaussian_process(
        n_samples=10, cov=Linear(), random_state=0)
gp.plot()
plt.show()
../../../_images/skfda.misc.covariances.Linear_1_0.png

Default representation in a Jupyter notebook:

from skfda.misc.covariances import Linear

Linear()
\[K(x, x') = \sigma^2 (x^T x' + c) \\\text{where:}\begin{aligned}\qquad\sigma^2 &= 1 \\c &= 0 \\\end{aligned}\]
2024-03-11T17:26:51.464293 image/svg+xml Matplotlib v3.8.3, https://matplotlib.org/
2024-03-11T17:26:51.281929 image/svg+xml Matplotlib v3.8.3, https://matplotlib.org/

Methods

heatmap([limits])

Return a heatmap plot of the covariance function.

to_sklearn()

Convert it to a sklearn kernel, if there is one.

Parameters:
heatmap(limits=(-1, 1))[source]#

Return a heatmap plot of the covariance function.

Parameters:

limits (Tuple[float, float]) –

Return type:

Figure

to_sklearn()[source]#

Convert it to a sklearn kernel, if there is one.

Return type:

Kernel