jmstate.functions.base_hazards.Gompertz¶
- class Gompertz(a, b, *, clock_type='sojourn', frozen=False)[source]¶
Implements the Gompertz base hazard.
Gompertz base hazard is time dependent. It is given by the formula:
\[\lambda_0(t) = a \exp{bt}.\]- This method expects:
t0: a column vector of previous transition times, shape (n, 1).
t1: a matrix of future evaluation times, shape (n, m), with the same number of rows as t0.
The output is the log base hazard evaluated at each t1 relative to t0.
If clock_type is set to sojourn, given t0 and t1, the transformation will be computed at t1 - t0 (sojourn time), and simply t1 if clock_type is set to absolute.
Optimization of the parameters can be disabled by checking the forzen flag.
- Variables:
log_a (nn.Parameter | torch.Tensor) – The baseline hazard parameter.
b (nn.Parameter | torch.Tensor) – The shape parameter.
clock_type (str) – The type of clock to use.
frozen (bool) – Whether the parameters are frozen.
- Parameters:
a (float)
b (Parameter | Tensor)
clock_type (str)
frozen (bool)
- __init__(a, b, *, clock_type='sojourn', frozen=False)[source]¶
Initializes the Gompertz base hazard.
- Parameters:
a (float) – The baseline hazard.
b (float) – The shape parameter.
clock_type (str, optional) – The type of clock to use. Defaults to “sojourn”.
frozen (bool, optional) – Whether to freeze the parameters. Defaults to False.
- forward(t0, t1)[source]¶
Calls the Gompertz base hazard.
- Parameters:
t0 (torch.Tensor) – Previous transition times, shape (n, 1).
t1 (torch.Tensor) – Future evaluation times, shape (n, m).
- Returns:
The computed base hazard in log scale.
- Return type:
torch.Tensor
- property a: Tensor¶
Gets the baseline hazard.
- Returns:
The baseline hazard.
- Return type:
torch.Tensor