jmstate.functions.base_hazards.LogNormal

class LogNormal(mu, scale, *, clock_type='sojourn', frozen=False)[source]

Implements the log normal base hazard.

Log normal base hazard is time dependent. It is given by the formula:

\[\lambda_0(t) = \frac{\phi\left( \frac{\log t - \mu}{\sigma} \right)}{t \sigma \, \Phi\left( -\frac{\log t - \mu}{\sigma} \right)}, \quad t > 0,\]

where:

\[\phi(z) = \frac{1}{\sqrt{2\pi}} e^{-z^2/2}, \quad \Phi(z) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^z e^{-t^2/2} \, dt.\]
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:
  • mu (nn.Parameter | torch.Tensor) – The log time mean.

  • log_scale (nn.Parameter | torch.Tensor) – The log of scale.

  • clock_type (str) – The type of clock to use.

  • frozen (bool) – Whether the parameters are frozen.

Parameters:
  • mu (Parameter | Tensor)

  • scale (float)

  • clock_type (str)

  • frozen (bool)

__init__(mu, scale, *, clock_type='sojourn', frozen=False)[source]

Initializes the log normal base hazard.

Parameters:
  • mu (float) – The log time mean.

  • scale (float) – The log time scale.

  • 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 log normal 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 scale: Tensor

Gets the scale.

Returns:

The scale.

Return type:

torch.Tensor