How The Immune System Learns From Infections