jmstate.types.LogBaseHazardFn

class LogBaseHazardFn(*args, **kwargs)[source]

Abstract base class for log base hazard functions.

This class represents a log-transformed baseline hazard function in a multistate model. The log base hazard is parameterized as a torch.nn.Module, allowing its parameters to be optimized during model fitting. For default base hazards, a frozen attribute can be set to prevent optimization of the module parameters.

Tensor input conventions:

  • t0: a column vector of previous transition times of shape \((n, 1)\).

  • t1: a matrix of future time points at which the log base hazard is evaluated,

    of shape \((n, m)\) matching the number of rows in t0.

Notes

The outputs are in log scale and can be directly used in likelihood computations for multistate models.

Parameters:
  • args (Any)

  • kwargs (Any)

__init__(*args, **kwargs)

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

None

abstractmethod forward(t0, t1)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Parameters:
  • t0 (Tensor)

  • t1 (Tensor)

Return type:

Tensor