GPmix.Projector

class GPmix.Projector(basis_type, n_proj=3, basis_params={})[source]

Bases: object

Transform functional data to a set of univariate data by projection onto specified projection functions.

Parameters:
  • basis_type (str) – Specifies the type of projection function. Supported types include: - ‘fourier’: Fourier basis functions. - ‘fpc’: Eigenfunctions from functional principal component analysis. - ‘wavelet’: Discrete wavelet basis. - ‘bspline’: B-spline basis functions. - ‘ou’: Ornstein-Uhlenbeck process realizations. - ‘rl-fpc’: Random linear combinations of eigenfunctions.

  • n_proj (int, default=3) – Number of projection functions to use (i.e., number of univariate projections).

  • basis_params (dict, optional) – Dictionary of hyperparameters for basis generation. Supported keys: - ‘period’: Period for Fourier basis. - ‘order’: Order for B-spline basis. - ‘wv_name’: Name of the wavelet (for wavelet basis). - ‘resolution’: Base resolution for wavelet basis.

n_features

Number of grid points for the projection functions and sample curves.

Type:

int

basis

The projection functions used.

Type:

skfda.FDataGrid

coefficients

Projection coefficients for N samples.

Type:

ndarray of shape (n_proj, N)

Notes

The class supports orthogonalization of basis functions and can handle several types of bases.

dilate_translate_signal(signal, n_trans)[source]

Generate dilated and translated versions of a signal over the domain.

Parameters:
  • signal (ndarray) – The signal to dilate and translate.

  • n_trans (int) – Number of translations (intervals).

Returns:

List of normalized, dilated, and translated signals as FDataGrid objects.

Return type:

list of skfda.FDataGrid

fit(fdata)[source]

Compute the projection coefficients of sample functions.

Parameters:

fdata (skfda.FDataGrid) – Functional data to project.

Returns:

Projection coefficients.

Return type:

ndarray

get_wavelet_basis(wavelet_name, n)[source]

Construct a wavelet basis using scaling and wavelet functions.

Parameters:
  • wavelet_name (str) – Name of the discrete wavelet.

  • n (int) – Number of intervals at the lowest resolution.

Returns:

The constructed wavelet basis as FDataGrid.

Return type:

skfda.FDataGrid

get_wavelet_signal(wavelet_name)[source]

Retrieve the scaling and wavelet functions for a given discrete wavelet.

Parameters:

wavelet_name (str) – Name of the discrete wavelet.

Returns:

  • scaling_function (ndarray) – The scaling (father) wavelet function.

  • wavelet_function (ndarray) – The wavelet (mother) function.

Raises:

ValueError – If the wavelet is not discrete or is unknown.

plot_basis(**kwargs)[source]

Plot the projection basis functions.

Parameters:

**kwargs – Additional keyword arguments passed to the plot function.

plot_projection_coeffs(ncols=4, **kwargs)[source]

Plot the distribution of univariate projection coefficients.

Parameters:
  • ncols (int, optional) – Number of columns in the subplot grid. Default is 4.

  • **kwargs – Additional keyword arguments passed to seaborn.histplot.