leaspy.models.time_reparametrized ================================= .. py:module:: leaspy.models.time_reparametrized Classes ------- .. autoapisummary:: leaspy.models.time_reparametrized.TimeReparametrizedModel Module Contents --------------- .. py:class:: TimeReparametrizedModel(name, source_dimension = None, **kwargs) Bases: :py:obj:`leaspy.models.mcmc_saem_compatible.McmcSaemCompatibleModel` Contains the common attributes & methods of the multivariate time-reparametrized models. :Parameters: **name** : :obj:`str` Name of the model. **source_dimension** : Optional[:obj:`int`] Number of sources. Dimension of spatial components (default is None). **\*\*kwargs** Hyperparameters for the model (including `obs_models`). :Raises: :exc:`.LeaspyModelInputError` If inconsistent hyperparameters. .. !! processed by numpydoc !! .. py:property:: xi_std :type: torch.Tensor Return the standard deviation of xi as a tensor. .. !! processed by numpydoc !! .. py:property:: tau_std :type: torch.Tensor Return the standard deviation of tau as a tensor. .. !! processed by numpydoc !! .. py:property:: noise_std :type: torch.Tensor Return the standard deviation of the model as a tensor. .. !! processed by numpydoc !! .. py:property:: sources_std :type: float Return the standard deviation of sources as a float. .. !! processed by numpydoc !! .. py:property:: source_dimension :type: Optional[int] Return the number of the sources .. !! processed by numpydoc !! .. py:property:: has_sources :type: bool Indicates whether the model includes sources. :Returns: :obj:`bool` True if `source_dimension` is a positive integer. False otherwise. .. !! processed by numpydoc !! .. py:method:: time_reparametrization(*, t, alpha, tau) :staticmethod: Tensorized time reparametrization formula. .. warning:: Shapes of tensors must be compatible between them. :Parameters: **t** : :class:`torch.Tensor` Timepoints to reparametrize **alpha** : :class:`torch.Tensor` Acceleration factors of individual(s) **tau** : :class:`torch.Tensor` Time-shift(s) of individual(s) :Returns: :class:`torch.Tensor` Reparametrized time of same shape as `timepoints` .. !! processed by numpydoc !! .. py:method:: get_variables_specs() Return the specifications of the variables (latent variables, derived variables, model 'parameters') that are part of the model. :Returns: NamedVariables A dictionary-like object containing specifications for the variables .. !! processed by numpydoc !! .. py:method:: put_individual_parameters(state, dataset) Initialize individual latent parameters in the given state if not already set. :Parameters: **state** : State The current state object that holds all the variables **dataset** : Dataset Dataset used to initialize latent variables accordingly. .. !! processed by numpydoc !! .. py:method:: to_dict(*, with_mixing_matrix = True) Export model object as dictionary ready for :term:`JSON` saving. :Parameters: **with_mixing_matrix** : :obj:`bool` (default ``True``) Save the :term:`mixing matrix` in the exported file in its 'parameters' section. .. warning:: It is not a real parameter and its value will be overwritten at model loading (orthonormal basis is recomputed from other "true" parameters and mixing matrix is then deduced from this orthonormal basis and the betas)! It was integrated historically because it is used for convenience in browser webtool and only there... :Returns: KwargsType The object as a dictionary. .. !! processed by numpydoc !! .. py:method:: compute_individual_ages_from_biomarker_values(value, individual_parameters, feature = None) :abstractmethod: For one individual, compute age(s) at which the given features values are reached (given the subject's individual parameters). Consistency checks are done in the main :term:`API` layer. :Parameters: **value** : scalar or array_like[scalar] (:obj:`list`, :obj:`tuple`, :class:`numpy.ndarray`) Contains the :term:`biomarker` value(s) of the subject. **individual_parameters** : :obj:`dict` Contains the individual parameters. Each individual parameter should be a scalar or array_like. **feature** : :obj:`str` (or None) Name of the considered :term:`biomarker`. .. note:: Optional for :class:`.UnivariateModel`, compulsory for :class:`.MultivariateModel`. :Returns: :class:`torch.Tensor` Contains the subject's ages computed at the given values(s). Shape of tensor is ``(1, n_values)``. :Raises: :exc:`.LeaspyModelInputError` If computation is tried on more than 1 individual. .. !! processed by numpydoc !! .. py:method:: compute_individual_ages_from_biomarker_values_tensorized(value, individual_parameters, feature) :abstractmethod: For one individual, compute age(s) at which the given features values are reached (given the subject's individual parameters), with tensorized inputs. :Parameters: **value** : :class:`torch.Tensor` of shape ``(1, n_values)`` Contains the :term:`biomarker` value(s) of the subject. **individual_parameters** : DictParamsTorch Contains the individual parameters. Each individual parameter should be a :class:`torch.Tensor`. **feature** : :obj:`str` (or None) Name of the considered :term:`biomarker`. .. note:: Optional for :class:`.UnivariateModel`, compulsory for :class:`.MultivariateModel`. :Returns: :class:`torch.Tensor` Contains the subject's ages computed at the given values(s). Shape of tensor is ``(n_values, 1)``. .. !! processed by numpydoc !!