  An adaptive agent predicting the future state of an environment must weigh
trust in new observations against prior experiences. In this light, we propose
a view of the adaptive immune system as a dynamic Bayesian machinery that
updates its memory repertoire by balancing evidence from new pathogen
encounters against past experience of infection to predict and prepare for
future threats. This framework links the observed initial rapid increase of the
memory pool early in life followed by a mid-life plateau to the ease of
learning salient features of sparse environments. We also derive a modulated
memory pool update rule in agreement with current vaccine response experiments.
Our results suggest that pathogenic environments are sparse and that memory
repertoires significantly decrease infection costs even with moderate sampling.
The predicted optimal update scheme maps onto commonly considered competitive
dynamics for antigen receptors.
