Calculating the local energy in neural network quantum state given a Hamiltonian of Heisenberg 1D model as following:
$$H = -J\sum_{I}\sigma_{i}^{z}\sigma_{i+1}^{z}$$
I am trying to solve it with a neural network function given by Restricted Boltzmann machine by minimising the Energy function. At each iteration, I generated the sample by using MCMC, and I have to calculated the local energy of each sample, where the local energy was written as follow
$$E_\text{local} = H_{ss'}*\frac{\Psi(s')}{\Psi({s})} = \frac{\sum_{s'}\langle s|H|s'\rangle\Psi(s')}{\Psi(s)}. $$
I don't know how to evaluated this local energy. I saw some people try to flip some anti-parallel spin on the current state and generate another set of sample to evaluated this local energy. But according to the equation we have to calculated all the basis again. I'm confused as how to evaluate $H_{ss'}$. 
 A: $\newcommand{\Ket}[1]{\left|#1\right>}$
$\newcommand{\Bra}[1]{\left<#1\right|}$
$\newcommand{\BK}[1]{\left<#1|#1\right>}$
The local energy can be used within an MCMC sampling scheme in order to optimize your variational neural network state $\Ket{\Psi}$ to the ground state of the applied Hamiltonian, $\mathcal{H}$.
To optimize the network state towards the ground state, we want to minimize the expectation value of the Hamiltonian,
$$
\mathcal{E} = \frac{\Bra{\Psi}\mathcal{H}\Ket{\Psi}}{\BK{\Psi}}.
$$ 
Your MCMC sampling scheme samples spin configurations, $\Ket{\vec{s}}$ (where $\vec{s}$ denotes the collection of spin up/downs) according to the probability distribution given by the current network wavefunction, $|\Psi(\vec{s})|^2$. This allows us to sample the local energy at each configuration, defined as,
$$
E_{\text{Loc}}(\vec{s}) = \frac{\Bra{\vec{s}}\mathcal{H}\Ket{\Psi}}{\Psi(\vec{s})},
$$
where this quantity on the top line is just the entry of $\>\mathcal{H}\Ket{\Psi}$ that corresponds to the $\Ket{\vec{s}}$ spin configuration, and is equivalent to the expression you have given. That is, if $$\>
\Ket{\phi} = \mathcal{H}\Ket{\Psi} \implies \left<{\vec{s}}|\phi\right> = \phi(\vec{s}), \>\>\> E_{\text{Loc}}(\vec{s}) = \frac{\phi(\vec{s})}{\Psi(\vec{s})}.
$$
Therefore, to evaluate the local energy, you are simply sampling the elements from the variational state vector and the variational state vector on which the Hamiltonian as been applied.
The point of using the local energy is that by generating $N$ configurations $\{ \vec{s}_i\}_{i=1,\ldots,N}$ by MCMC according to $|\Psi(\vec{s})|^2$, $\mathcal{E}$ can be approximated as an average,
$$
\mathcal{E} \approx \frac{1}{N} \sum_{i=1}^N E_{\text{Loc}}(\vec{s}_i).
$$
