leaspy.models.utils.attributes.abstract_attributes ================================================== .. py:module:: leaspy.models.utils.attributes.abstract_attributes Classes ------- .. autoapisummary:: leaspy.models.utils.attributes.abstract_attributes.AbstractAttributes Module Contents --------------- .. py:class:: AbstractAttributes(name, dimension, source_dimension) Bases: :py:obj:`abc.ABC` Abstract base class for attributes of models. Contains the common attributes & methods of the different attributes classes. Such classes are used to update the models' attributes. :Parameters: **name** : str .. **dimension** : int (default None) .. **source_dimension** : int (default None) .. :Attributes: **name** : str Name of the associated leaspy model. **dimension** : int Number of features of the model **source_dimension** : int Number of sources of the model TODO? move to AbstractManifoldModelAttributes? **univariate** : bool Whether model is univariate or not (i.e. dimension == 1) **has_sources** : bool Whether model has sources or not (not univariate and source_dimension >= 1) TODO? move to AbstractManifoldModelAttributes? **update_possibilities** : set[str] (default empty) Contains the available parameters to update. Different models have different parameters. :Raises: :exc:`.LeaspyModelInputError` if any inconsistent parameter. .. !! processed by numpydoc !! .. py:attribute:: name .. py:attribute:: dimension .. py:attribute:: univariate .. py:attribute:: source_dimension .. py:attribute:: has_sources .. py:attribute:: update_possibilities :type: set[leaspy.utils.typing.ParamType] .. py:method:: get_attributes() :abstractmethod: 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` .. .. !! processed by numpydoc !! .. py:method:: update(names_of_changed_values, values) :abstractmethod: Update model group average parameter(s). :Parameters: **names_of_changed_values** : set[str] Values to be updated **values** : dict [str, `torch.Tensor`] New values used to update the model's group average parameters :Raises: :exc:`.LeaspyModelInputError` If `names_of_changed_values` contains unknown values to update. .. !! processed by numpydoc !! .. py:method:: move_to_device(device) Move the tensor attributes of this class to the specified device. :Parameters: **device** : torch.device .. .. !! processed by numpydoc !!