# A Bayesian Modeling Approach to Situated Design of Personalized Soundscaping Algorithms
## 2 Methods
### Factor Graphs and Message Passing-Based Inference
#### 2.3.6. Message Passing-Based Inference in the Gaussian Scale Sum Model  
Similarly to the Algonquin node, exact inference is also not possible in the Gaussian scale sum node of (11). Also variational message passing yields intractable computations. As a result we again need to perform a vector Taylor expansion for approximating the intractable terms, corresponding to the covariance term in (11). Table 2 shows an overview of the Gaussian scale sum node, the corresponding variational messages and the node-local variational free energy. All derivations can be found at our GitHub repository (the GitHub repository can be accessed at [[https://github.com/biaslab/SituatedSoundscaping](https://github.com/biaslab/SituatedSoundscaping)]([https://github.com/biaslab/SituatedSoundscaping](https://github.com/biaslab/SituatedSoundscaping)), accessed on 1 July 2021). \begin{table}
\begin{tabular}{c c} \hline \hline
**Node function** \\ \hline \hline  & \(p(x\mid s_{1},\ \dots,\ s_{K},\ \gamma)=\mathcal{N}\Bigg{(}x\ \Big{|}\ \ln \Bigg{(}\sum\limits_{k=1}^{K}\exp(s_{k})\Bigg{)},\ \gamma^{-1}\Bigg{)}\) \\ \hline
**Marginals** & **Functional form** \\ \hline \hline \(q(x)\) & \(\mathcal{N}\big{(}x\ \big{|}\ \hat{m}_{x},\ \hat{\gamma}_{x}^{-1}\big{)}\) where \(\hat{m}_{x}\in\mathbb{R}\) and \(\hat{\gamma}_{x}\in\mathbb{R}^{+}\) \\ \hline \(q(s_{k})\) & \(\mathcal{N}\Big{(}s_{k}\ \big{|}\ \hat{m}_{s_{k}},\ \hat{\gamma}_{s_{k}}^{-1} \Big{)}\) where \(\hat{m}_{s_{k}}\in\mathbb{R}\) and \(\hat{\gamma}_{s_{k}}\in\mathbb{R}^{+}\) \\ \hline \(q(\gamma)\) & \(\Gamma\big{(}\gamma\ \hat{a},\ \hat{\beta}\big{)}\) where \(\hat{a},\hat{\beta}\in\mathbb{R}^{+}\) \\ \hline
**Messages** & **Functional form** \\ \hline \(\vec{v}(x)\) & \(\mathcal{N}\Bigg{(}x\ \Big{|}\ \ln\Bigg{(}\sum\limits_{k=1}^{K}\exp(\hat{m}_{s_{k}}) \Bigg{)},\ \frac{\hat{\beta}}{\hat{a}}\Bigg{)}\) \\ \hline \(\overleftarrow{\
u}(s_{k})\) & \(\mathcal{N}\Bigg{(}s_{k}\ \Big{|}\ \hat{m}_{x}-\frac{\ln \Big{(}\sum\limits_{k=1}^{K}\exp(m_{s_{i}})\Big{)}-\hat{m}_{x}}{\sigma(\hat{m} _{s})_{k}},\ \frac{\hat{\beta}}{\hat{a}\sigma(\hat{m}_{s})_{k}^{2}}\Bigg{)}\) \\ \hline \(\overleftarrow{\
u}(\gamma)\) & \(\Gamma\Bigg{(}\gamma\ \Big{|}\ \frac{3}{2},\ \frac{1}{2}\Bigg{(}\frac{1}{ \hat{\gamma}_{x}}+\sum\limits_{k=1}^{K}\frac{\sigma(\hat{m}_{s})_{k}^{2}}{ \hat{\gamma}_{s_{k}}}+\Bigg{(}\hat{m}_{x}-\ln\Bigg{(}\sum\limits_{k=1}^{K}\exp (\hat{m}_{s_{k}})\Bigg{)}\Bigg{)}^{2}\Bigg{)}\Bigg{)}\) \\ \hline \multicolumn{3}{c}{**Local variational free energy**} \\ \hline \hline \(\frac{1}{2}\ln(2\pi)+\frac{1}{2}\big{(}\psi(\hat{a})-\ln(\hat{\beta})\big{)}+ \frac{\hat{a}}{2\hat{\beta}}\Bigg{(}\frac{1}{\hat{\gamma}_{y}}+\sum\limits_{k= 1}^{K}\frac{\sigma(\hat{m}_{s})_{k}^{2}}{\hat{\gamma}_{s_{k}}}+\Bigg{(}\hat{m} _{x}-\ln\Bigg{(}\sum\limits_{k=1}^{K}\exp(\hat{m}_{s_{k}})\Bigg{)}\Bigg{)}^{2} \Bigg{)}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Table containing (a) the Forney-style factor graph representation of the generalized Algoruin node. (b) The likelihood function corresponding to the generalized Algoruin node. (c) An overview of the chosen approximate posterior distributions. Here the ‘accent refers to the parameters of these distributions. (d) The derived variational messages for the generalized Algoruin node. Here the \(\sigma(\cdot)_{k}\) represents the \(k\)th output of the softmax function. (e) The derived local variational free energy, in which \(\psi(\cdot)\) denotes the digamma function. All derivations are available at Supplementary Materials [[https://github.com/biaslab/SituatedSoundscaping](https://github.com/biaslab/SituatedSoundscaping)]([https://github.com/biaslab/SituatedSoundscaping](https://github.com/biaslab/SituatedSoundscaping)), accessed on 1 July 2021.  
u}(s_{k})\) has been calculated by approximating the intractable terms using a vector Taylor expansion over all variables, except for \(s_{k}\). Alternative approaches are also feasible.