leaspy.models.utils.attributes.linear_attributes

Classes

LinearAttributes

Attributes of leaspy linear models.

Module Contents

class LinearAttributes(name, dimension, source_dimension)[source]

Bases: leaspy.models.utils.attributes.abstract_manifold_model_attributes.AbstractManifoldModelAttributes

Attributes of leaspy linear models.

Contains the common attributes & methods to update the linear model’s attributes.

Parameters:
namestr
dimensionint
source_dimensionint
Attributes:
namestr (default ‘linear’)

Name of the associated leaspy model.

dimensionint
source_dimensionint
univariatebool

Whether model is univariate or not (i.e. dimension == 1)

has_sourcesbool

Whether model has sources or not (not univariate and source_dimension >= 1)

update_possibilitiesset[str] (default {‘all’, ‘g’, ‘v0’, ‘betas’} )

Contains the available parameters to update. Different models have different parameters.

positionstorch.Tensor [dimension] (default None)

positions = realizations[‘g’] such that “p0” = positions

velocitiestorch.Tensor [dimension] (default None)

Always positive: exp(realizations[‘v0’])

orthonormal_basistorch.Tensor [dimension, dimension - 1] (default None)
betastorch.Tensor [dimension - 1, source_dimension] (default None)
mixing_matrixtorch.Tensor [dimension, source_dimension] (default None)

Matrix A such that w_i = A * s_i.

See also

UnivariateModel
MultivariateModel
update(names_of_changed_values, values)[source]

Update model group average parameter(s).

Parameters:
names_of_changed_valuesset[str]
Elements of set must be either:
  • all (update everything)

  • g correspond to the attribute positions.

  • v0 (only for multivariate models) correspond to the attribute velocities. When we are sure that the v0 change is only a scalar multiplication (in particular, when we reparametrize log(v0) <- log(v0) + mean(xi)), we may update velocities using v0_collinear, otherwise we always assume v0 is NOT collinear to previous value (no need to perform the verification it is - would not be really efficient)

  • betas correspond to the linear combination of columns from the orthonormal basis so to derive the mixing_matrix.

valuesdict [str, torch.Tensor]

New values used to update the model’s group average parameters

Raises:
LeaspyModelInputError

If names_of_changed_values contains unknown parameters.