This talk concerns the description and analysis of a variational framework for empirical risk minimization. In its most general form the framework concerns a two-stage estimation procedure in which (i) the trajectory of an observed (but unknown) dynamical system is fit to a trajectory from a known reference dynamical system by minimizing average per-state loss, and (ii) a parameter estimate is obtained from the initial state of the best fit reference trajectory. I will show that the empirical risk of the best fit trajectory converges almost surely to a constant that can be expressed in variational form as the minimal expected loss over dynamically invariant couplings (joinings) of the observed and reference systems. Moreover, the family of joinings minimizing the expected loss fully characterizes the asymptotic behavior of the estimated parameters. I will illustrate the breadth of the variational framework through applications to the well-studied problems of maximum likelihood estimation and non-linear regression, as well as the analysis of system identification from quantized trajectories subject to noise, a problem in which the models themselves exhibit dynamical behavior across time.