leaspy.models.utils.attributes.abstract_manifold_model_attributes module
- class AbstractManifoldModelAttributes(name: str, dimension: int, source_dimension: int)
Bases:
AbstractAttributes
Abstract base class for attributes of leaspy manifold models.
Contains the common attributes & methods of the different attributes classes. Such classes are used to update the models’ attributes.
- Parameters:
- namestr
- dimensionint
- source_dimensionint (default None)
- Raises:
LeaspyModelInputError
if any inconsistent parameter.
- Attributes:
- namestr (default None)
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]
Contains the available parameters to update. Different models have different parameters.
- positions
torch.Tensor
[dimension] (default None) <!> Depending on the model it does not correspond to the same thing.
- velocities
torch.Tensor
[dimension] (default None) Vector of velocities for each feature (positive components). For multivariate models only (except for parallel model as it is useless).
- orthonormal_basis
torch.Tensor
[dimension, dimension - 1] (default None) For multivariate and multivariate parallel models, with source_dimension >= 1.
- betas
torch.Tensor
[dimension - 1, source_dimension] (default None) For multivariate and multivariate parallel models, with source_dimension >= 1.
- mixing_matrix
torch.Tensor
[dimension, source_dimension] (default None) Matrix A such that w_i = A * s_i. For multivariate and multivariate parallel models, with source_dimension >= 1.
Methods
Returns the attributes of the model, which is a tuple of three torch tensors.
move_to_device
(device)Move the tensor attributes of this class to the specified device.
update
(names_of_changed_values, values)Update model group average parameter(s).
- get_attributes() Tuple[FloatTensor, FloatTensor, FloatTensor]
Returns the attributes of the model, which is a tuple of three torch tensors.
For the precise definitions of those attributes please refer to the exact attributes class associated to your model.
- Returns:
- positions: torch.Tensor
- velocities: torch.Tensor
- mixing_matrix: torch.Tensor
- move_to_device(device: device)
Move the tensor attributes of this class to the specified device.
- Parameters:
- devicetorch.device
- abstract update(names_of_changed_values: Set[str], values: Dict[str, Tensor]) None
Update model group average parameter(s).
- Parameters:
- names_of_changed_valuesset[str]
Values to be updated
- valuesdict [str, torch.Tensor]
New values used to update the model’s group average parameters
- Raises:
LeaspyModelInputError
If names_of_changed_values contains unknown values to update.