leaspy.models.constant ====================== .. py:module:: leaspy.models.constant Classes ------- .. autoapisummary:: leaspy.models.constant.ConstantModel Module Contents --------------- .. py:class:: ConstantModel(name, **kwargs) Bases: :py:obj:`leaspy.models.stateless.StatelessModel` ConstantModel` is a benchmark model that predicts constant values (no matter what the patient's ages are). These constant values depend on the algorithm setting and the patient's values provided during :term:`calibration`. It could predict: * ``last``: last value seen during calibration (even if ``NaN``). * ``last_known``: last non ``NaN`` value seen during :term:`calibration`. * ``max``: maximum (=worst) value seen during :term:`calibration`. * ``mean``: average of values seen during :term:`calibration`. .. warning:: Depending on ``features``, the ``last_known`` / ``max`` value may correspond to different visits. .. warning:: For a given feature, value will be ``NaN`` if and only if all values for this feature were ``NaN``. :Parameters: **name** : :obj:`str` The model's name. .. seealso:: :class:`~leaspy.algo.personalize.constant_prediction_algo.ConstantPredictionAlgorithm` .. .. !! processed by numpydoc !! .. py:property:: hyperparameters :type: leaspy.utils.typing.DictParamsTorch Dictionary of values for model hyperparameters. :Returns: :class:`~leaspy.utils.typing.DictParamsTorch` Dictionary of hyperparameters. .. !! processed by numpydoc !! .. py:method:: compute_individual_trajectory(timepoints, individual_parameters) Compute the individual trajectory based on the model's features and parameters. :Parameters: **timepoints** : :obj:`torch.Tensor` The time points at which to compute the trajectory. **individual_parameters** : :obj:`dict` Dictionary containing the individual's parameters, where keys are feature names. :Returns: :obj:`torch.Tensor` A tensor containing the computed trajectory for the individual. :Raises: :class:`~leaspy.exceptions.LeaspyModelInputError` If the model was not properly initialized or if features are not set. .. !! processed by numpydoc !!