Zurück zu den Modellen
Transformer

RBFTransformer

A custom transformer to apply Radial Basis Functions (RBFs) to time series data.

This transformer allows the user to apply various RBF kernels such as Gaussian, multiquadric, and inverse multiquadric to time series data. The transformation generates new features that augment the input data based on the distances between time points and specified center points, offering a flexible and non-linear feature representation for machine learning models.

This implementation is inspired by the RepeatingBasisFunction transformer from the scikit-lego package: https://github.com/koaning/scikit-lego/blob/main/sklego/preprocessing/repeatingbasis.py

Mathematical Background: Consider a time series with time stamps \(t_1, t_2, \dots, t_N\)-

The transformation computes the kernel distance between the time points and a set of predefined “center points” \(c_1, \dots, c_K\). For each time point \(t_i\), the RBF is computed between \(t_i\) and every center point \(c_k\), producing a matrix of transformed values. Each kernel function depends on the distance between a time point and a center point.

Mathematically, the transformation for the Gaussian RBF is defined as:

\(\phi(t_i, c_k) = \exp(-\gamma (t_i - c_k)^2)\)

where \(\gamma\) is a scaling factor controlling the spread of the RBF.

Additional types of RBFs are available:

  • Multiquadric:

    \(\phi(t_i, c_k) = \sqrt{1 + \gamma (t_i - c_k)^2}\)

  • Inverse Multiquadric:

    \(\phi(t_i, c_k) = \frac{1}{\sqrt{1 + \gamma (t_i - c_k)^2}}\)

These transformations produce new features for each time point, enhancing the representational power of the data by adding non-linear transformations that account for proximity to center points.

Schnellstart

python
from sktime.transformations.basisfunction import RBFTransformer

estimator = RBFTransformer(centers=None, gamma=1.0, rbf_type='gaussian', apply_to='index', use_torch=False)

Parameter(5)

centersarray-like, shape (n_centers,), optional (default=None)

The centers \(c_k\) of the RBFs. These define the points against which the distances from the input data are measured. If None, the centers will be evenly spaced over the range of the input data.

gammafloat, optional (default=1.0)

The spread or scaling factor \(\gamma\) that controls the influence range of each RBF center. Larger values of \(\gamma\) make the RBF sharper (smaller spread), while smaller values make the RBF smoother.

rbf_type{“gaussian”, “multiquadric”, “inverse_multiquadric”},

optional (default=”gaussian”)

The type of radial basis function to apply:

  • “gaussian”: \(\exp(-\gamma (t - c)^2)\)

  • “multiquadric”: \(\sqrt{1 + \gamma (t - c)^2}\)

  • “inverse_multiquadric”: \(\frac{1}{\sqrt{1 + \gamma (t - c)^2}}\)

apply_to{“index”, “values”}, optional (default=”index”)

Determines whether the RBFs are applied to the time index or to the values of the time series.

  • “index”: Apply the RBFs to the time index.

  • “values”: Apply the RBFs to the values of the time series.

use_torchbool, optional (default=False)
Whether to use torch for the RBF calculations. If True, the transformer will use PyTorch for the RBF calculations, if present. If not, will fall back to NumPy. If False, it will use NumPy.