also have $$h_i = \frac{1}{2}\log\frac{1+m_i}{1-m_i}-\sum_jJ_{ij}m_j+\sum_j J_{ij}^2m_i(1-m_j^2)$$ which corresponds precisely to the TAP equations. Using now (\[eq:dual2\]) gives $$\frac{\partial h_i}{\partial m_j}= [\chi^{-1}]_{ij} = 
\delta_{ij}\bigl(\frac{1}{1-m_i^2}+\sum_kJ_{ik}^2(1-m_k^2)\bigr) - J_{ij}-2J_{ij}^2m_im_j.$$ Ignoring the diagonal terms, the TAP solution is conveniently expressed in terms of the inverse empirical susceptibility, $$\label{eq:JTAP}
J_{ij}^{TAP} = -\frac{2[\hat \chi^{-1}]_{ij}}{1+\sqrt{1-8{\hat m}_i{\hat m}_j[\hat \chi^{-1}]_{ij}}},$$ where the branch corresponding to a vanishing coupling in the limit of small correlation i.e. small $\hat \chi_{ij}$ and $[\hat \chi^{-1}]_{ij}$ for $i\ne j$, has been chosen.

#### Bethe approximate solution

When the graph formed by the pairs $(i,j)$ for which the correlations $\hat \chi_{ij}$ are given by some observations is a tree, the following form of the joint probability corresponding to the Bethe approximation: $$\label{eq:ansatz}
{\cal P}({{\mathbf{x}}}) = \prod_{i<j}\frac{{\hat p}_{ij}(x_i,x_j)}{{\hat p}(x_i){\hat p}(x_j)}\prod_i{\hat p}_i(x_i),$$ yields actually an exact solution to the inverse problem (\[eq:iipb\]), where the ${\hat p}$ are the single and pair variables empirical marginal given by the observations. Using the following identity $$\begin{aligned}
\log\frac{\hat p_{ij}(s_i,s_j)}{\hat p_i(s_i)\hat p_j(s_j)} &= 
\frac{(1+s_i)(1+s_j)}{2}\log\frac{\hat p_{ij}^{11}}{\hat p_i^1\hat p_j^1}
+\frac{(1+s_i)(1-s_j)}{2}\log\frac{\hat p_{ij}^{10}}{\hat p_i^1\hat p_j^0}\\[0.2cm]
&+\frac{(1-s_i)(1+s_j)}{2}\log\frac{\hat p_{ij}^{01}}{\hat p_i^0\hat p_j^1}
+\frac{(1-s_i)(1-s_j)}{2}\log\frac{\hat p_{ij}^{00}}{\hat p_i^0\hat p_j^0}\end{aligned}$$ where the following parametrization of the $\hat p$’s $$\begin{aligned}
{\hat p}_i^{x} &{\stackrel{\mbox{\upshape\tiny def}}{=}}{\hat p}\bigl(\frac{1+s_i}{2} = x\bigr) = \frac{1}{2}(1+\hat m_i(2x-1)),\label{eq:pi}\\[0.2cm]
{\hat p}_{ij}^{xy} &{\stackrel{\mbox{\upshape\tiny def}}{=}}{\hat p}\bigl(\frac{1+s_i}{2}=x,\frac{1+s_j}{2}=y\bigr)\nonumber\\[0.2cm] 
