Which gene would you assay next?
The agent starts with no test results at all. At each turn it either buys one more gene expression measurement or commits to a diagnosis. Every measurement costs budget, and a wrong diagnosis costs more, so it has to work out both which gene is worth buying for this patient and when it has seen enough to stop. The network below runs in your browser, so you are watching the trained policy decide, not a recording.
S step · Space play or pause ·
R reset · N next patient
Candidate panel
0 of 40 measuredWhat the agent is weighing
action valuesBelief
Budget
Predicted return
C51Decision log
Same patient, four strategies
every strategy commits with the same classifier, so only the ordering and stopping differ| Strategy | Genes ordered | Cost | Diagnosis | Correct | Confidence | Order |
|---|
Training
Two agents were trained on the same environment: a Rainbow DQN built from the six components of Hessel et al. and a PPO agent with action masking. Curves are the mean over seeds with a bootstrap band. Evaluation runs the greedy policy over the whole validation split at every checkpoint rather than over sampled episodes, so the curve is not moved around by exploration noise.
Diagnostic accuracy
Genes ordered per patient
Rainbow components
each variant removes exactly one component; higher is betterFinal return by variant
Accuracy against measurements
| Variant | Return | Accuracy | Genes | Seeds |
|---|
Analysis
The question is whether an adaptive ordering beats a fixed one at equal cost. The curves below separate the two halves of the problem: how good the acquisition order is, and how good the stopping rule is.
Accuracy against genes ordered
Cost against accuracy
Operating points
held-out test split, identical classifier for every row| Strategy | Accuracy | Balanced acc. | Genes ordered | Cost | Return |
|---|
Confusion matrix
Which gene gets ordered first
How the opening moves branch
every test patient, folded into a tree by what the agent orderedCalibration at the stopping point
Spread across seeds
Classifier accuracy against random subsets
Worked examples
| Patient | True type | Genes ordered | Diagnosis | Sequence |
|---|
Method
The decision problem
A patient arrives with no test results. Ordering the full gene panel would classify them accurately, but panels cost money and time, and most of the genes carry no information once a few others have been read. The useful question is which gene to order next given what has come back so far, and when the evidence is enough to stop.
That is a partially observed Markov decision process. The hidden state is the patient's full expression profile together with their tumour type; the agent sees only the entries it has paid to reveal.
Reward
A measurement costs its price scaled by cost_scale. A correct diagnosis pays
+1 and a wrong one -1. The ratio between those two settings is
what decides how test-hungry the optimal policy is, which is why the frontier in the
analysis comes from re-training at different prices rather than from thresholding one
agent.
Action masking
The legal action set shrinks as the episode runs: a gene cannot be bought twice, and it cannot be bought at all once the remaining budget will not cover it. Masking is applied to the greedy action, to the bootstrap action inside the temporal difference target, and to the policy distribution, so the agent never assigns value to an action it cannot take.
Agent
The main agent is a Rainbow DQN written from scratch. All six components are present and each is a configuration flag, which is what makes the ablation on the training page a genuine one rather than a comparison against differently tuned code.
- Double Q learning picks the bootstrap action with the online network and scores it with the target network.
- Dueling heads split state value from action advantage.
- Prioritised replay samples by temporal difference error through a sum tree, corrected by importance weights.
- Multi-step returns accumulate three steps of reward before bootstrapping.
- NoisyNet layers replace epsilon-greedy with learned parameter noise.
- Distributional C51 predicts the return distribution over 51 atoms instead of its mean.
Network
Commitment is a small fixed choice and is scored from the pooled state by an ordinary head. Measurement is a choice over the panel, so it uses a pointer-style head: the state produces a query vector and the value of ordering gene j is the inner product of that query with gene j's own representation. The head's size does not grow with the panel.
Belief model
A separate classifier is trained on random measurement subsets, so it stays calibrated at every level of missingness. It supplies the posterior shown on the live page and the one the baselines commit with. The agent never receives it as input, so any margin the agent holds over the greedy baseline comes from looking further ahead, not from a better classifier.
Evaluation
Every policy, learned or scripted, is scored by the same driver over the entire test split rather than over sampled episodes. Aggregates across seeds are interquartile means with stratified bootstrap intervals; at a handful of seeds a plain mean is moved too easily by one run that collapsed or one that got lucky.
Gene selection and standardisation are fit on the training split alone. The panel, the belief model and the agent never see validation or test patients during fitting.
Data
On the cost model
Measurement costs are configurable. The default profile gives every gene a cost of one, which makes the budget a plain count of measurements. The alternative profiles are synthetic. They are not taken from any real assay price list, and exist only to make the budget allocation problem non-uniform.
Reproducing
make belief
make experiments
make dashboard