jmstate.functions.base_hazards.Weibull¶
- class Weibull(lmda, k, *, clock_type='sojourn', frozen=False)[source]¶
Implements the Weibull base hazard.
Weibull base hazard is time dependent.
It is given by the formula:
\[\lambda_0(t) = k \lambda^k t^{k - 1}.\]- 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 set to absolute.
Optimization of the parameters can be disabled by checking the forzen flag.
- Variables:
log_lmda (nn.Parameter | torch.Tensor) – The log of the scale parameter.
log_k (nn.Parameter | torch.Tensor) – The log of the shape parameter.
clock_type (str) – The type of clock to use.
frozen (bool) – Whether the parameters are frozen.
- Parameters:
lmda (float)
k (float)
clock_type (str)
frozen (bool)
- __init__(lmda, k, *, clock_type='sojourn', frozen=False)[source]¶
Initializes the Weibull base hazard.
- Parameters:
lmda (float) – The scale parameter.
k (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 Weibull 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 k: Tensor¶
Gets the shape parameter.
- Returns:
The shape parameter.
- Return type:
torch.Tensor
- property lmda: Tensor¶
Gets the scale parameter.
- Returns:
The scale parameter.
- Return type:
torch.Tensor