Prediction error minimization (PEM) is becoming increasingly influential as an explanatory framework in computational neuroscience, building on formal developments in machine learning and statistical physics. This chapter reviews the main motivation for working within the framework, and explains PEM in more detail with fundamental considerations in theoretical neurobiology. It argues that PEM provides a unified account of brain processes for mind, cognition, and action. The chapter begins with the problem of perception, that is, how there can be unsupervised representation of the environmental causes of sensory input. It sets out what appears to be the most promising candidate for solving the problem of perception: hierarchical Bayesian inference. The chapter explains the background for PEM, namely the free energy principle (FEP), which is an extremely general description within theoretical neurobiology of what it means to be a biological persisting organism in the changing world.