&= \frac{1}{4}(1+\hat m_i(2x-1)+\hat m_j(2y-1)+\hat m_{ij}(2x-1)(2y-1)\label{eq:pij}\end{aligned}$$ relating the empirical frequency statistics to the empirical “magnetizations” $m\equiv \hat m$, can be used. Summing up the different terms gives us the mapping onto an Ising model (\[def:ising\]) with $$\begin{aligned}
h_i &= \frac{1-d_i}{2}\log\frac{{\hat p}_i^1}{{\hat p}_i^0}
+\frac{1}{4}\sum_{j\in\partial i}\log\Bigl(\frac{{\hat p}_{ij}^{11}\ 
{\hat p}_{ij}^{10}}{{\hat p}_{ij}^{01}\ {\hat p}_{ij}^{00}}\Bigr),\label{eq:hi}\\[0.2cm]
J_{ij} &= \frac{1}{4}\log\Bigl(\frac{{\hat p}_{ij}^{11}\ {\hat p}_{ij}^{00}}{{\hat p}_{ij}^{01}\ {\hat p}_{ij}^{10}}\Bigr),
\qquad\forall\ (i,j)\in{\mathcal{E}},\label{eq:Jij}\end{aligned}$$ where $d_i$ is the number of neighbors of $i$, using the notation $j\in\partial i$ for “$j$ neighbor of $i$”. The partition function is then explicitly given by $$\label{eq:zbethe}
Z_{Bethe}[{\hat p}] =  \exp\biggl[-\frac{1}{4}\sum_{(i,j)\in{\mathcal{E}}}\log\bigl({\hat p}_{ij}^{00}\ {\hat p}_{ij}^{01}\ {\hat p}_{ij}^{10}\ {\hat p}_{ij}^{11}\bigr)
-\sum_i\frac{1-d_i}{2}\log({\hat p}_i^0\ {\hat p}_i^1)\biggr]$$ The corresponding Gibbs free energy can then be written explicitly using (\[eq:hi\]–\[eq:zbethe\]). With fixed magnetizations $m_i$’s, and given a set of couplings $\{J_{ij}\}$, the parameters $m_{ij}$ are implicit function $$m_{ij} = m_{ij}(m_i,m_j,J_{ij}),$$ obtained by inverting the relations (\[eq:Jij\]). For the linear response, we get from (\[eq:hi\]) a result derived first in [@WeTe]: $$\begin{aligned}
\frac{\partial h_i}{\partial m_j} &= \Bigl[\frac{1-d_i}{1-m_i^2}\\[0.2cm] 
&+ \frac{1}{16}\sum_{k\in \partial i}\Bigl(
\bigl(\frac{1}{{\hat p}_{ik}^{11}}+\frac{1}{{\hat p}_{ik}^{01}}\bigr)\bigl(1+\frac{\partial m_{ik}}{\partial m_i}\bigr)+
\bigl(\frac{1}{{\hat p}_{ik}^{00}}+
\frac{1}{{\hat p}_{ik}^{10}}\bigr)\bigl(1-\frac{\partial m_{ik}}{\partial m_i}\bigr)\Bigr)\Bigr]\delta_{ij}\\[0.2cm]
&+\frac{1}{16}\Bigl(
\bigl(\frac{1}{{\hat p}_{ij}^{11}}+\frac{1}{{\hat p}_{ij}^{10}}\bigr)\bigl(1+\frac{\partial m_{ij}}{\partial m_i}\bigr)+
\bigl(\frac{1}{{\hat p}_{ij}^{00}}+
\frac{1}{{\hat p}_{ij}^{01}}\bigr)\bigl(1-\frac{\partial m_{ij}}{\partial m_i}\bigr)\Bigr)\Bigr]\delta_{j\in\partial i}.\end{aligned}$$ Using (\[eq:Jij\]), we can also express $$\frac{\partial m_{ij}}{\partial m_i} = 
-\frac{\frac{1}{{\hat 