Fig. 3.
Excerpt of Pyro code that learns a linear regression mapping appraisals to emotion ratings, with graphical representation on the right. We use plate notation: There are N independent observations of outcomes and emotion ratings, and the parameters β are constant and shared across the observations. The compute_appraisal() function takes in a representation of an outcome and returns an apptaisal (l. 3). We then sample regression coefficients βi for each dimension i from a Normal distribution, given parameters μi, σi (l. 4). We compute the estimated emotion rating (l. 5), and then condition on having observed the emotion rating in the data (l. 6), in order to infer the values of μi, σi.