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)
Bases:
leaspy.models.generic.GenericModelConstantModel 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.- Parameters:
- name
str The model’s name.
- **kwargs
Hyperparameters for the model. None supported for now.
- name
- Attributes:
- name
str The model’s name.
- is_initialized
bool Always
True(no true initialization needed for constant model).- features
listofstr List of the model features. Unlike most models features will be determined at personalization only (because it does not needed any fit).
- dimension
int Number of features (read-only).
- parameters
dict The model has no parameters: empty dictionary. The
prediction_typeparameter should be defined during personalization. Example:>>> AlgorithmSettings('constant_prediction', prediction_type='last_known')
- name
- Parameters:
name (str)
See also
ConstantPredictionAlgorithm
- is_initialized = True
- compute_individual_trajectory(timepoints, individual_parameters)
Compute scores values at the given time-point(s) given a subject’s individual parameters.
- Parameters:
- timepointsscalar or array_like[scalar] (
list,tuple,numpy.ndarray) Contains the age(s) of the subject.
- individual_parameters
dict[str, Any] Contains the individual parameters. Each individual parameter should be a scalar or array_like.
- timepointsscalar or array_like[scalar] (
- Returns:
torch.TensorContains the subject’s scores computed at the given age(s). The shape of the tensor is
(1, n_tpts, n_features).
- Parameters:
- Return type: