make_random_warping#

skfda.datasets.make_random_warping(n_samples=15, n_features=100, *, start=0, stop=1, sigma=1, shape_parameter=50, n_random=4, random_state=None)[source]#

Generate random warping functions.

Let \(v(t)\) be a randomly generated function defined in \([0,1]\)

\[sv(t) = \sum_{j=0}^{N} a_j \sin(\frac{2 \pi j}{K}t) + b_j \cos(\frac{2 \pi j}{K}t)\]

where \(a_j, b_j \sim N(0, \sigma)\).

The random warping it is constructed making an exponential map to \(\Gamma\).

\[\gamma(t) = \int_0^t \left ( \frac{\sin(\|v\|)}{\|v\|} v(s) + \cos(\|v\|) \right )^2 ds\]

An affine traslation it is used to define the warping in \([a,b]\).

The smoothing and shape of the warpings can be controlling changing \(N\), \(\sigma\) and \(K= 1 + \text{shape\_parameter}\).

Parameters:
  • n_samples (int) – Total number of samples. Defaults 15.

  • n_features (int) – The total number of trajectories. Defaults 100.

  • start (float) – Starting point of the samples. Defaults 1.

  • stop (float) – Ending point of the samples. Defaults 0.

  • sigma (float) – Parameter to control the variance of the samples. Defaults 1.

  • shape_parameter (float) – Parameter to control the shape of the warpings. Should be a positive value. When the shape parameter goes to infinity the warpings generated are \(\gamma_{id}\). Defaults to 50.

  • n_random (int) – Number of random sines and cosines to be sum to construct the warpings.

  • random_state (int | RandomState | Generator | None) – Random state.

Returns:

Object comprising all the samples.

Return type:

FDataGrid