# Learning Algorithm of Boltzmann Machine Based on Spatial Monte Carlo Integration Method
## 3 Boltzmann Machine Learning Based on Spatial Monte Carlo Integration Method
### Spatial Monte Carlo Integration Method  
Assume that we have a set of i.i.d. sample points, \(\mathcal{S}:=\{\mathbf{s}^{(\mu)}\mid\mu=1,2,\ldots,N\}\), where \(\mathbf{s}^{(\mu)}:=\{\mathbf{s}_{i}^{(\mu)}\in\mathcal{X}\mid i\in V\}\), drawn from a [PERSON] machine, \(P_{\text{BM}}(\mathbf{x}\mid\mathbf{w})\), by using a Markov chain MonteCarlo (MCMC) method. Suppose that we want to know the expectation of a function \(f(\mathbf{x}_{C})\), \(C\subseteq V\), for the [PERSON] machine \(\mathrm{E}_{\text{BM}}[f(\mathbf{x}_{C})\mid\mathbf{w}]\). In the standard Monte Carlo integration (MCI) method, we approximate the desired expectation by the simple average of the given sample points \(\mathcal{S}\):  
\[\mathrm{E}_{\text{BM}}[f(\mathbf{x}_{C})\mid\mathbf{w}]\approx\sum_{\mathbf{x}}f(\mathbf{x}_{C })Q_{\mathcal{S}}(\mathbf{x})=\frac{1}{N}\sum_{\mu=1}^{N}f(\mathbf{s}_{C}^{(\mu)}), \tag{15}\]  
where \(Q_{\mathcal{S}}(\mathbf{x})\) is the distribution of the sample points, which is defined in the same manner as Equation (3), and where, for a set \(\mathcal{A}\subseteq V\), \(\mathbf{s}_{\mathcal{A}}^{(\mu)}\) is the \(\mu\)-th sample point corresponding to \(\mathbf{x}_{\mathcal{A}}\); i.e., \(\mathbf{s}_{\mathcal{A}}^{(\mu)}=\{\mathbf{s}_{i}^{(\mu)}\mid i\in\mathcal{A }\subseteq V\}\). The SMCI method considers spatial information around \(\mathbf{x}_{C}\), in contrast to the standard MCI method. For the SMCI method, we define the neighboring regions of the target region, \(C\subseteq V\), as follows. The first-nearest-neighbor region, \(N_{1}(C)\), is defined by  
\[N_{1}(C):=\{i\mid(i,j)\in E,j\in C,i\
ot\in C\}. \tag{16}\]  
Therefore, when \(C=\{i\}\), \(N_{1}(C)=\partial(i)\). Similarly, the second-nearest-neighbor region, \(N_{2}(C)\), is defined by  
\[N_{2}(C):=\{i\mid(i,j)\in E,j\in N_{1}(C),i\
ot\in C,i\
ot\in N_{1}(C)\}. \tag{17}\]  
In a similar manner, for \(k\geq 1\), we define the \(k\)-th-nearest-neighbor region, \(N_{k}(C)\), by  
\[N_{k}(C):=\{i\mid(i,j)\in E,j\in N_{k-1}(C),i\
ot\in R_{k-1}(C)\}, \tag{18}\]  
where \(R_{k}(C):=\bigcup_{m=0}^{k}N_{m}(C)\) and \(N_{0}(C):=C\). An example of the neighboring regions in a square-grid graph is shown in Figure 1.  
By using the conditional distribution,  
\[P_{\text{BM}}(\mathbf{x}_{R_{k-1}(C)}\mid\mathbf{x}_{N_{k}(C)},\mathbf{w})=\frac{P_{\text{ BM}}(\mathbf{x}\mid\mathbf{w})}{\sum_{\mathbf{x}_{R_{k-1}(C)}}P_{\text{BM}}(\mathbf{x}\mid\mathbf{w})}, \tag{19}\]  
and the marginal distribution,  
\[P_{\text{BM}}(\mathbf{x}_{N_{k}(C)}\mid\mathbf{w})=\sum_{\mathbf{x}_{V\setminus N_{k}(C)} }P_{\text{BM}}(\mathbf{x}\mid\mathbf{w}), \tag{20}\]the desired expectation can be expressed as  
\[\mathrm{E}_{\mathrm{BM}}[f(\mathbf{x}_{\mathrm{C}})\mid\mathbf{w}]=\sum_{\mathbf{x}_{R_{k-1}( \mathrm{C})}}\sum_{\mathbf{x}_{N_{k}(\mathrm{C})}}f(\mathbf{x}_{\mathrm{C}})P_{\mathrm{ BM}}(\mathbf{x}_{R_{k-1}(\mathrm{C})}\mid\mathbf{x}_{N_{k}(\mathrm{C})},\mathbf{w})P_{ \mathrm{BM}}(\mathbf{x}_{N_{k}(\mathrm{C})}\mid\mathbf{w}), \tag{21}\]  
where, for a set \(\mathcal{A}\subseteq V\), \(\sum_{\mathbf{x}_{\mathcal{A}}}=\prod_{i\in\mathcal{A}}\sum_{x_{i}\in\mathcal{X}}\).