leaspy.models.constant¶
Classes¶
ConstantModel` is a benchmark model that predicts constant values (no matter what the patient's ages are). |
Module Contents¶
- class ConstantModel(name, **kwargs)[source]¶
Bases:
leaspy.models.stateless.StatelessModelConstantModel` 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 calibration.
- It could predict:
last: last value seen during calibration (even ifNaN).last_known: last nonNaNvalue seen during calibration.max: maximum (=worst) value seen during calibration.mean: average of values seen during calibration.
Warning
Depending on
features, thelast_known/maxvalue may correspond to different visits.Warning
For a given feature, value will be
NaNif and only if all values for this feature wereNaN.See also
- property hyperparameters: DictParamsTorch¶
Dictionary of values for model hyperparameters.
- Returns:
DictParamsTorchDictionary of hyperparameters.
- Return type:
- compute_individual_trajectory(timepoints, individual_parameters)[source]¶
Compute the individual trajectory based on the model’s features and parameters.
- Parameters:
- timepoints
torch.Tensor The time points at which to compute the trajectory.
- individual_parameters
dict Dictionary containing the individual’s parameters, where keys are feature names.
- timepoints
- Returns:
torch.TensorA tensor containing the computed trajectory for the individual.
- Raises:
LeaspyModelInputErrorIf the model was not properly initialized or if features are not set.
- Parameters:
- Return type: