Datasets#

class FDApy.simulation.Datasets(basis_name, random_state=None)[source]#

Simulate published paper datasets.

Parameters:
  • basis_name (str) – Name of the datasets to simulate.

  • random_state (int | None)

Attributes:
  • data – An object that represents the simulated data.

  • noisy_data – An object that represents a noisy version of the simulated data.

  • sparse_data – An object that represents a sparse version of the simulated data.

Methods

add_noise([noise_variance])

Add noise to functional data objects.

add_noise_and_sparsify([noise_variance, ...])

Generate a noisy and sparse version of functional data objects.

new(n_obs[, n_clusters, argvals])

Simulate realizations of the Datasets.

sparsify([percentage, epsilon])

Generate a sparse version of functional data objects.

add_noise(noise_variance=1.0)[source]#

Add noise to functional data objects.

This function generates an artificial noisy version of a functional data object of class DenseFunctionalData by adding realizations of Gaussian random variables \(\epsilon \sim \mathcal{N}(0, \sigma^2)\) to the observations. The variance \(\sigma^2\) can be supplied by the user. The generated data are given by

\[Y(t) = X(t) + \epsilon.\]
Parameters:

noise_variance (float) – The variance \(\sigma^2\) of the Gaussian noise that is added to the data.

Returns:

Create the class attribute noisy_data.

Return type:

None

add_noise_and_sparsify(noise_variance=1.0, percentage=0.9, epsilon=0.05)[source]#

Generate a noisy and sparse version of functional data objects.

This function generates an artificially noisy and sparse version of a functional datasets. From a functional dataset, it first generates the noisy version and then the sparse version based on the noisy one.

Parameters:
  • noise_variance (float) – The variance \(\sigma^2\) of the Gaussian noise that is added to the data.

  • percentage (float) – The percentage of observations to be retained.

  • epsilon (float) – The uncertainty around the percentage of observations to be retained.

Returns:

Create the class attributes noisy_data and sparse_data.

Return type:

None

new(n_obs, n_clusters=1, argvals=None, **kwargs)[source]#

Simulate realizations of the Datasets.

This function generates n_obs realizations of the Datasets object.

Parameters:
  • n_obs (int) – Number of observations to simulate.

  • n_clusters (int) – Not used in this context.

  • argvals (ndarray[Any, dtype[float64]] | None) – Not used in this context. We will use the argvals from the Basis object as argvals of the simulation. Here to be compliant with the class Simulation.

Returns:

Create the class attributes data.

Return type:

None

sparsify(percentage=0.9, epsilon=0.05)[source]#

Generate a sparse version of functional data objects.

This function generates an artificially sparsified version of a functional data object of class DenseFunctionalData. The percentage (and the uncertainty around it) of the number of observation points retained can be supplied by the user. Let \(p\) be the defined percentage and \(\epsilon\) be the uncertainty value. The retained number of observations will be different for each curve and be between \(p - \epsilon\) and \(p + \epsilon\).

Parameters:
  • percentage (float) – The percentage of observations to be retained.

  • epsilon (float) – The uncertainty around the percentage of observations to be retained.

Returns:

Create the class attribute sparse_data.

Return type:

None