| survdnn_losses | R Documentation |
These functions define various loss functions used internally by 'survdnn()' for training deep neural networks on right-censored survival data.
cox_loss(pred, true)
cox_l2_loss(pred, true, lambda = 0.001)
aft_loss(pred, true, sigma = 1, aft_loc = 0, eps = 1e-12)
coxtime_loss(pred, true)
pred |
A torch tensor of model predictions. Its interpretation depends on the loss function:
|
true |
A tensor with two columns: observed time and status (1 = event, 0 = censored). |
lambda |
Regularization parameter for 'cox_l2_loss' (default: '1e-3'). |
sigma |
Positive numeric scale parameter for the log-normal AFT model (default: '1'). In 'survdnn()', a learnable global scale can be used via 'survdnn__aft_lognormal_nll_factory()'. |
aft_loc |
Numeric scalar location offset for the AFT model on the log-time scale. When non-zero, the model is trained on centered log-times 'log(time) - aft_loc' for better numerical stability. Prediction should add this offset back: 'mu = mu_resid + aft_loc'. |
eps |
Small constant for numerical stability (default: '1e-12'). |
A scalar 'torch_tensor' representing the loss value.
- **Cox partial likelihood loss** ('cox_loss'): Negative partial log-likelihood used in proportional hazards modeling. - **L2-penalized Cox loss** ('cox_l2_loss'): Adds L2 regularization to the Cox loss. - **Accelerated Failure Time (AFT) loss** ('aft_loss'): Log-normal AFT **censored negative log-likelihood** (uses both events and censored observations). - **CoxTime loss** ('coxtime_loss'): Placeholder (see details). A correct CoxTime loss requires access to the network and the full input tensor.
# Used internally by survdnn()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.