mofaflex.priors.GaussianProcess#

class mofaflex.priors.GaussianProcess(covariates_key=None, covariates_mkey=None, n_inducing=100, kernel='RBF', mefisto_kernel=True, independent_lengthscales=False, group_covar_rank=1, warp=False, warp_interval=20, warp_open_begin=True, warp_open_end=True, warp_reference_group=None)#

Gaussian process prior for spatially or temporally smooth factors.

Important

All methods and properties of this class are only accessible through the MofaFlex class.

Parameters:
  • covariates_key (str | Mapping[str] | None (default: None)) – The column of .obs/.var that contains covariate values. Cannot be used together with covariates_mkey.

  • covariates_mkey (str | Mapping[str] | None (default: None)) – The key in .obsm/.varm that contains covariate values. Cannot be used together with covariates_key.

  • n_inducing (int (default: 100)) – Number of inducing points.

  • kernel (Literal['RBF', 'Matern'] (default: 'RBF')) – Kernel function to use.

  • mefisto_kernel (bool (default: True)) – Whether to use the MEFISTO group covariance kernel or treat groups independently.

  • independent_lengthscales (bool (default: False)) – Whether to use a separate lengthscale per covariate dimension.

  • group_cvar_rank – Rank of the group correlation matrix. Only relevant if mefisto_kernel=True.

  • warp (bool (default: False)) – Whether to use dynamic time warping. Warping is only supported for 1D covariates.

  • warp_interval (int (default: 20)) – Apply dynamic time warping every warp_interval epochs.

  • warp_open_begin (bool (default: True)) – Perform open-ended alignment.

  • warp_open_end (bool (default: True)) – Perform open-ended alignment.

  • warp_reference_group (str | None (default: None)) – Reference group to align the others to. Defaults to the first group.

Attributes table#

factor_covariates

Covariates for each group.

factor_covariates_names

Covariate names for each group where they could be inferred from the input.

factor_gp_group_correlation

Between-group correlation for each factor.

factor_gp_lengthscale

Inferred lengthscales for each factor.

factor_gp_scale

Inferred variance scales (smoothness) for each factor.

warped_factor_covariates

Time-warped covariates for each group, if dynamic time warping was enabled.

warped_weight_covariates

Time-warped covariates for each group, if dynamic time warping was enabled.

weight_covariates

Covariates for each group.

weight_covariates_names

Covariate names for each group where they could be inferred from the input.

weight_gp_group_correlation

Between-group correlation for each factor.

weight_gp_lengthscale

Inferred lengthscales for each factor.

weight_gp_scale

Inferred variance scales (smoothness) for each factor.

Methods table#

get_factor_gps([moment, x, batch_size, ordered])

Get all latent functions.

get_weight_gps([moment, x, batch_size, ordered])

Get all latent functions.

Attributes#

property factor_covariates: Mapping[str, ndarray[tuple[int, int], floating]]#

Covariates for each group.

property factor_covariates_names: dict[str, ndarray[tuple[int, int], str | str_]]#

Covariate names for each group where they could be inferred from the input.

property factor_gp_group_correlation: ndarray[tuple[int, int], floating]#

Between-group correlation for each factor.

property factor_gp_lengthscale: ndarray[tuple[int], floating] | ndarray[tuple[int, int], floating]#

Inferred lengthscales for each factor.

property factor_gp_scale: ndarray[tuple[int], floating]#

Inferred variance scales (smoothness) for each factor.

property warped_factor_covariates: Mapping[str, ndarray[tuple[int, int], floating]] | None#

Time-warped covariates for each group, if dynamic time warping was enabled.

property warped_weight_covariates: Mapping[str, ndarray[tuple[int, int], floating]] | None#

Time-warped covariates for each group, if dynamic time warping was enabled.

property weight_covariates: Mapping[str, ndarray[tuple[int, int], floating]]#

Covariates for each group.

property weight_covariates_names: dict[str, ndarray[tuple[int, int], str | str_]]#

Covariate names for each group where they could be inferred from the input.

property weight_gp_group_correlation: ndarray[tuple[int, int], floating]#

Between-group correlation for each factor.

property weight_gp_lengthscale: ndarray[tuple[int], floating] | ndarray[tuple[int, int], floating]#

Inferred lengthscales for each factor.

property weight_gp_scale: ndarray[tuple[int], floating]#

Inferred variance scales (smoothness) for each factor.

Methods#

get_factor_gps(moment: Literal['mean', 'std'] = 'mean', x: Mapping[str, ndarray[tuple[int, int], T] | Tensor] | None = None, batch_size: int | None = None, ordered: bool = False) Mapping[str, DataFrame]#

Get all latent functions.

Parameters:
Return type:

Mapping[str, DataFrame]

get_weight_gps(moment: Literal['mean', 'std'] = 'mean', x: Mapping[str, ndarray[tuple[int, int], T] | Tensor] | None = None, batch_size: int | None = None, ordered: bool = False) Mapping[str, DataFrame]#

Get all latent functions.

Parameters:
Return type:

Mapping[str, DataFrame]