---
kind: concept
slug: cox-proportional-hazards
title: Cox proportional hazards
summary: >-
  Neural versions of the Cox survival model: a neural risk term trained on a sampled-control loss, a Cox partial-likelihood term added to an autoencoder loss, or time as an input that drops proportional hazards. Author-reported gains on KKBox churn data and small survival sets; the autoencoder paper has one centre and internal validation only.
tags: [survival-analysis, time-to-event, neural-networks]
papers: ["1907.00825", "1810.03382", "2305.14961"]
related: [survival-analysis, nested-case-control-sampling]
status: draft
updated_at: 2026-10-19
---

## Overview

The Cox model writes the hazard of an event as a shared baseline times a
relative-risk term that depends only on covariates, h(t | x) = h0(t) exp[g(x)]
[arxiv:1907.00825 § 3]. Fitting the exact partial likelihood sums over risk
sets that can hold almost the whole data set, so it does not batch well
[arxiv:1907.00825 § 3.2].

Every variant here keeps the Cox idea of scoring each event against the
individuals still at risk, with a covariate-dependent risk term. Only the
proportional variants keep the relative-risk form. Cox-Time does not
[arxiv:1907.00825 § 3.4]. The variants differ in how they replace the linear
risk term, what they add to the loss, and whether time enters the model.

A 2023 review of 61 deep-learning survival methods classes 26 of them as
Cox-based [arxiv:2305.14961 §3.3.1] [arxiv:2305.14961 fig. 4]. It ranks none of them, because
the reported results use different datasets, splits and metric variants
[arxiv:2305.14961 §3.6]. Its counts also do not fully add up [arxiv:2305.14961
§3.3.1], so treat them as approximate. Card:
[Deep Learning for Survival Analysis: A Review](/papers/2305.14961).

## Variants

### Proportional neural risk, partial-likelihood training (Cox-MLP, DeepSurv-style)

The paper's Cox-MLP (DeepSurv) keeps the proportional form and replaces the
linear risk with an MLP. It is trained on a batched negative partial
log-likelihood [arxiv:1907.00825 § 2] [arxiv:1907.00825 § 6.1.1]. Card:
[Time-to-Event Prediction with Neural Networks and Cox Regression](/papers/1907.00825).
On the four small sets it has the best IBLL on FLCHAIN [arxiv:1907.00825 tab. 4].
On KKBox it is unstable across fits, which the authors attribute to the
proportionality constraint on large data [arxiv:1907.00825 § 6.2.2]. The
review also traces DeepSurv to an earlier network-based Cox model by Faraggi
and Simon, which has no card here [arxiv:2305.14961 §3.3.1] [arxiv:2305.14961 §3].

### Sampled-control loss (Cox-MLP (CC))

For each event, one control is drawn from its risk set with replacement, and
the loss is log(1 + exp[g(x_j) - g(x_i)]) averaged over events
[arxiv:1907.00825 § 3.2] [eq. 9] [eq. 8]. A penalty lambda times the sum of
|g| over the sampled sets keeps the non-linear g from drifting, since its
minimiser is not unique [arxiv:1907.00825 § 3.3] [eq. 10]. The loss needs
one control per event, so it trains on mini-batches [arxiv:1907.00825 § 3.2].
This variant stays proportional. On KKBox it scores C^td 0.844, IBS 0.119
and IBLL -0.379 [arxiv:1907.00825 tab. 7]. The paper reports it as unstable
at short durations [arxiv:1907.00825 fig. 4].

### Cox partial likelihood as one term of an autoencoder loss

Here the Cox term is not the whole objective. A denoising autoencoder learns a
short code from the input, and a single linear unit on that code gives the log
hazard ratio [arxiv:1810.03382 § Network Design and Training] [eq. 6]. The loss
is alpha times a reconstruction error plus (1 - alpha) times the negated Cox
partial log-likelihood. The reconstruction is taken on the uncorrupted input
[arxiv:1810.03382 § Network Design and Training] [eq. 7]. The paper defines the
risk sets over the whole training sample [eq. 5], and trains with Adam on
mini-batches of 16 for 100 epochs [arxiv:1810.03382 § Network Design and
Training]. The reconstruction term needs no survival label, so the code can
be learned from the input alone. Card:
[Deep learning cardiac motion analysis for human survival prediction](/papers/1810.03382).

The paper applies it to right-ventricle motion from cardiac MRI, 11,514 values
per patient, in 302 pulmonary hypertension patients from one centre. The
optimism-corrected Harrell's C is 0.73, against 0.59 for a Cox model on manual
ventricular volumes. Both figures come from bootstrap internal validation only
[arxiv:1810.03382 § Predictive performance]. The paper gives search ranges for
the hyperparameters but not the values it chose [arxiv:1810.03382 tab. 2]. The
card records no ablation that separates the reconstruction term from the
survival term.

### Time as an input (Cox-Time)

The network takes (t, x) and returns g(t, x), so the risk can change with time
and proportional hazards no longer hold [arxiv:1907.00825 § 3.4] [eq. 11]. The
training loss uses the same pair form, with each control drawn from the risk
set and both members evaluated at the event time [eq. 12]. The baseline is
estimated with the Breslow form over the full risk set [eq. 13]
[arxiv:1907.00825 § 3.5]. On KKBox it has the best IBS (0.107) and IBLL
(-0.334), but its C^td of 0.861 is below DeepHit's 0.888 and RSF's 0.870
[arxiv:1907.00825 tab. 7]. On the small sets it has the best or tied-best IBS on three of
four. On FLCHAIN it trails the proportional models (IBS 0.102 against 0.092,
IBLL -0.432 against -0.309), and the authors say proportionality is reasonable
there [arxiv:1907.00825 tab. 3] [tab. 4] [arxiv:1907.00825 § 6.1.2]. On simulated
non-proportional data it estimates survival curves better than the
proportional models [arxiv:1907.00825 app. C.2]. The review names Cox-Time as
an extension of DeepSurv [arxiv:2305.14961 §3.3.1].

## When to use which

| Situation | Use | Why |
|---|---|---|
| Hazards are plausibly proportional, and you want the smallest change from the linear Cox model | Cox-MLP (DeepSurv-style) | Keeps the proportional form; best IBLL on FLCHAIN [arxiv:1907.00825 tab. 4] |
| Data is large and you must train on mini-batches with a per-event loss | Cox-MLP (CC) | One sampled control per event; no full risk-set sum [arxiv:1907.00825 § 3.2] |
| Covariate effects may change over time, and you can afford one network call per event time at prediction | Cox-Time | Drops proportional hazards [arxiv:1907.00825 § 3.4]; best KKBox IBS and IBLL [arxiv:1907.00825 tab. 7] |
| You have high-dimensional inputs, want a compact learned code, and can accept a single-centre study as evidence | Cox term in an autoencoder loss | The code is learned jointly with the risk [arxiv:1810.03382 § Network Design and Training]; reports a higher corrected C than a volumetric Cox model [arxiv:1810.03382 § Predictive performance] |
| Ranking quality matters more than calibrated survival curves | Compare with DeepHit or RSF | DeepHit has the best KKBox C^td but the worst IBS and IBLL [arxiv:1907.00825 tab. 7] |
| Tight prediction latency, many individuals | A proportional variant | Its cumulative hazard factorises into baseline times exp[g(x)] [arxiv:1907.00825 § 3.5] |
| Several competing causes of the event | Look beyond the variants on this page | The review counts nine methods that handle competing risks, four of them discrete-time [arxiv:2305.14961 §3.4.1] |
| Choosing a method by its published benchmark numbers | Compare on your own data | The review says reported results cannot be compared across papers [arxiv:2305.14961 §3.6] |

The cards record no measured wall-clock or memory figures for prediction. The
latency row rests on the cost argument alone: Cox-Time needs one network call
per distinct event time up to the horizon, and its Breslow step is quadratic
unless the training rows are subsampled [arxiv:1907.00825 § 3.5]. The
autoencoder paper reports only total training time, 76 hours including the
hyperparameter search and the bootstrap [arxiv:1810.03382 § Network Design and
Training].

## Implementation sketch

Cox-Time training with one sampled control per event. The paper's KKBox
configuration used lambda 0.001 and 8 layers of 256 nodes with no dropout
[arxiv:1907.00825 app. A.2] [tab. 6].

```pseudocode
# Cox-Time, one sampled control per event  [arxiv:1907.00825 § 3.4] [eq. 12]
# Input:  covariates x (N, d); durations t (N,); events e (N,) in {0, 1}
# Output: network g(t, x)

def train_cox_time(net, x, t, e, lam, batch_size):
    cases = indices where e == 1
    for batch in minibatches(cases, batch_size):
        # Draw one control per case from its risk set, with replacement [§ 3.2]
        ctrl = sample_risk_set(t, batch)
        # Both members are evaluated at the case's own event time [§ 3.4]
        g_case = net(t[batch], x[batch])
        g_ctrl = net(t[batch], x[ctrl])
        # Pair loss, averaged over the batch [eq. 9] [eq. 12]
        loss = mean(log(1 + exp(g_ctrl - g_case)))
        # Penalty sums over the sampled outputs, as in [eq. 10]
        penalty = lam * (sum(abs(g_case)) + sum(abs(g_ctrl)))
        update(net, loss + penalty)
```

Baseline and survival curve after training. The Breslow denominator sums over
the full risk set, not a sample [eq. 13].

```pseudocode
# Breslow increments and survival curve  [arxiv:1907.00825 § 3.5] [eq. 13]
# Input:  net; x (N, d); t (N,); e (N,); grid of distinct event times
# Output: S(t_k | x) for each grid time

def breslow_increments(net, x, t, e, grid):
    for each t_k in grid:
        # Number of events at t_k [eq. 6]
        n_k = count of i with t[i] == t_k and e[i] == 1
        # Denominator over the full risk set, not a sample [eq. 13]
        at_risk = indices j with t[j] >= t_k
        denom = sum(exp(net(t_k, x[at_risk])))
        increment[k] = n_k / denom
    return increment

def predict_survival(net, x_new, grid, increment):
    H = 0.0
    for each t_k in grid:
        # Accumulate hazard weighted by the relative risk at t_k [eq. 13]
        H += increment[k] * exp(net(t_k, x_new))
        survival[k] = exp(-H)  # survival from cumulative hazard [eq. 1]
    return survival
```

Where the variants differ. The proportional variants use a risk head g(x).
Cox-Time puts time into the input. The autoencoder variant adds alpha times a
reconstruction error to the Cox term, with the risk taken from a linear unit on
the code [eq. 6] [eq. 7]. Its paper defines the risk set over the training
sample [eq. 5], but the public PyTorch code builds it within each mini-batch
[code: survival4D/nn/torch/__init__.py#L17-L18]. The paper's loss also scales
the reconstruction term differently from that code [arxiv:1810.03382 § Paper vs
code].

Pitfalls the papers flag. Pick one reading of the control set.
[arxiv:1907.00825 eq. 9] draws controls from the risk set without the case,
but [arxiv:1907.00825 § 3.2] also says the case is in the sampled set.
Excluding the case is the cleaner reading of [arxiv:1907.00825 eq. 9].
The review also warns that batch-wise training only approximates the full
Cox risk set unless the batch is large enough [arxiv:2305.14961 §3.3.1].
Penalty size grows with batch size if summed as in [arxiv:1907.00825 eq. 10], so a lambda
tuned on one normalisation does not transfer to another. Check the official
code's choice of control and normalisation against the card's Paper vs code
section before reusing either.

The autoencoder card suggests, as its own advice and not as the paper's, a
log-sum-exp form for the Cox term. The paper's formula and its code exponentiate
before the cumulative sum, which overflows for large predicted log hazard
ratios [arxiv:1810.03382 § Pitfalls].

## Contradictions

Within 1907.00825:

- The sampled set is said to include the case [arxiv:1907.00825 § 3.2], but the
  loss draws controls from the risk set without the case [arxiv:1907.00825 eq. 9].
- Concordance and calibration disagree on KKBox. DeepHit has the top C^td
  (0.888) and the worst IBS and IBLL [arxiv:1907.00825 tab. 7].
- Concordance on the small sets has no single winner. DeepHit is best on
  SUPPORT and METABRIC, Cox-Time on Rot. & GBSG, and Cox-MLP (CC) on FLCHAIN
  [arxiv:1907.00825 tab. 2].

Between 2305.14961 and 1907.00825 on how Cox-Time is trained. The review says
Cox-Time approximates the risk set with a large subset of individuals at risk
[arxiv:2305.14961 §3.3.1]. The Cox-Time paper draws one control per event
from the risk set [arxiv:1907.00825 eq. 12]. The card does not resolve which
description is the more accurate one.

Within 1810.03382, the paper's risk set is over the training sample [eq. 5],
while the public PyTorch code builds it within each mini-batch and computes
the reconstruction and Cox terms on different scales from the paper
[code: survival4D/nn/torch/__init__.py#L17-L18] [arxiv:1810.03382 § Paper vs
code]. The card does not resolve which the reported numbers used.

Across the two papers, the concordance and calibration figures come from
different data: KKBox and four small sets for 1907.00825, and one 302-patient
cardiac cohort for 1810.03382. Their values are not comparable.

## Papers

- [Time-to-Event Prediction with Neural Networks and Cox Regression](/papers/1907.00825): replaces the Cox risk term with a neural network, adds a sampled-control loss for mini-batch training, and introduces Cox-Time, which takes time as an input.
- [Deep learning cardiac motion analysis for human survival prediction](/papers/1810.03382): adds a Cox partial-likelihood term to a denoising autoencoder's loss, so that the learned code of cardiac motion is trained to predict survival.
- [Deep Learning for Survival Analysis: A Review](/papers/2305.14961): a systematic classification of 61 deep survival methods by model class and data aspects. It ranks none of them, and its counts are approximate.
