Predictive coding offers a potentially unifying account of cortical function-- postulating that the core function of the brain is to minimize predictionerrors with respect to a generative model of the world. The theory is closelyrelated to the Bayesian brain framework and, over the last two decades, hasgained substantial influence in the fields of theoretical and cognitiveneuroscience. A large body of research has arisen based on both empiricallytesting improved and extended theoretical and mathematical models of predictivecoding, as well as in evaluating their potential biological plausibility forimplementation in the brain and the concrete neurophysiological andpsychological predictions made by the theory. Despite this enduring popularity,however, no comprehensive review of predictive coding theory, and especially ofrecent developments in this field, exists. Here, we provide a comprehensivereview both of the core mathematical structure and logic of predictive coding,thus complementing recent tutorials in the literature. We also review a widerange of classic and recent work within the framework, ranging from theneurobiologically realistic microcircuits that could implement predictivecoding, to the close relationship between predictive coding and the widely-usedbackpropagation of error algorithm, as well as surveying the closerelationships between predictive coding and modern machine learning techniques.