leaspy.models.joint¶
Classes¶
Joint model for multiple repeated measures (logistic) and multiple competing events. |
Module Contents¶
- class JointModel(name, **kwargs)[source]¶
Bases:
leaspy.models.logistic.LogisticModelJoint model for multiple repeated measures (logistic) and multiple competing events. The model implemented is associated to this [publication](https://arxiv.org/abs/2501.08960) on arxiv.
- Parameters:
- name
str The name of the model.
- **kwargs
Hyperparameters of the model (including noise_model)
- name
- Raises:
LeaspyModelInputErrorIf name is not one of allowed sub-type: ‘univariate_linear’ or ‘univariate_logistic’
If hyperparameters are inconsistent
- Parameters:
name (str)
- get_variables_specs()[source]¶
Return the specifications of the variables (latent variables, derived variables, model ‘parameters’) that are part of the model.
- Returns:
- NamedVariables
The specifications of the model’s variables.
- Return type:
- to_dict(*, with_mixing_matrix=True)[source]¶
Export model as a dictionary ready for export. Add the number of events compare to the multivariate output
- put_individual_parameters(state, dataset)[source]¶
Initialise the individual parameters of the state thanks to the dataset.
- compute_individual_trajectory(timepoints, individual_parameters, *, skip_ips_checks=False)[source]¶
This method computes the individual trajectory of a patient for given timepoint(s) using his/her individual parameters (random effects). For the longitudinal sub-model:
Compute longitudinal values
- For the event sub-model:
only one event: return the survival rate corrected by the probability of the first time point of the prediction assuming that the patient was alive,
more than one event: return the Cumulative Incidence function corrected by the probability of the first time point of the prediction assuming that the patient was alive.
Nota: model uses its current internal state.
- Parameters:
- timepointsscalar or array_like[scalar] (
list,tuple,numpy.ndarray) Contains the age(s) of the subject.
- individual_parameters
dict Contains the individual parameters. Each individual parameter should be a scalar or array_like.
- skip_ips_checks
bool(default:False) Flag to skip consistency/compatibility checks and tensorization of
individual_parameterswhen it was done earlier (speed-up).
- timepointsscalar or array_like[scalar] (
- Returns:
torch.TensorContains the subject’s scores computed at the given age(s) Shape of tensor is
(1, n_tpts, n_features).
- Raises:
LeaspyModelInputErrorIf computation is tried on more than 1 individual.
LeaspyIndividualParamsInputErrorif invalid individual parameters.
- Parameters:
individual_parameters (DictParams)
skip_ips_checks (bool)
- Return type: