Why use a generative model rather than the more well known discriminative deep neural networks (DNN)?
A BM is what we would call an undirected probabilistic graphical model with stochastic continuous or discrete units.
It is interpreted as a stochastic recurrent neural network where the state of each unit(neurons/nodes) depends on the units it is connected to. The weights in the network represent thus the strength of the interaction between various units/nodes.
It turns into a Hopfield network if we choose deterministic rather than stochastic units. In contrast to a Hopfield network, a BM is a so-called generative model. It allows us to generate new samples from the learned distribution.
A standard BM network is divided into a set of observable and visible units \( \hat{x} \) and a set of unknown hidden units/nodes \( \hat{h} \).
Additionally there can be bias nodes for the hidden and visible layers. These biases are normally set to \( 1 \).
BMs are stackable, meaning they cwe can train a BM which serves as input to another BM. We can construct deep networks for learning complex PDFs. The layers can be trained one after another, a feature which makes them popular in deep learning
However, they are often hard to train. This leads to the introduction of so-called restricted BMs, or RBMS. Here we take away all lateral connections between nodes in the visible layer as well as connections between nodes in the hidden layer. The network is illustrated in the figure below.
The network layers:
Examples of this trick being employed in physics:
The function \( E(\mathbf{x},\mathbf{h}) \) gives the energy of a configuration (pair of vectors) \( (\mathbf{x}, \mathbf{h}) \). The lower the energy of a configuration, the higher the probability of it. This function also depends on the parameters \( \mathbf{a} \), \( \mathbf{b} \) and \( W \). Thus, when we adjust them during the learning procedure, we are adjusting the energy function to best fit our problem.
An expression for the energy function is $$ E(\hat{x},\hat{h}) = -\sum_{ia}^{NA}b_i^a \alpha_i^a(x_i)-\sum_{jd}^{MD}c_j^d \beta_j^d(h_j)-\sum_{ijad}^{NAMD}b_i^a \alpha_i^a(x_i)c_j^d \beta_j^d(h_j)w_{ij}^{ad}. $$
Here \( \beta_j^d(h_j) \) and \( \alpha_i^a(x_j) \) are so-called transfer functions that map a given input value to a desired feature value. The labels \( a \) and \( d \) denote that there can be multiple transfer functions per variable. The first sum depends only on the visible units. The second on the hidden ones. Note that there is no connection between nodes in a layer.
The quantities \( b \) and \( c \) can be interpreted as the visible and hidden biases, respectively.
The connection between the nodes in the two layers is given by the weights \( w_{ij} \).
There are different variants of RBMs, and the differences lie in the types of visible and hidden units we choose as well as in the implementation of the energy function \( E(\mathbf{x},\mathbf{h}) \).
RBMs were first developed using binary units in both the visible and hidden layer. The corresponding energy function is defined as follows: $$ \begin{align} E(\mathbf{x}, \mathbf{h}) = - \sum_i^M x_i a_i- \sum_j^N b_j h_j - \sum_{i,j}^{M,N} x_i w_{ij} h_j, \label{_auto3} \end{align} $$ where the binary values taken on by the nodes are most commonly 0 and 1.
Another varient is the RBM where the visible units are Gaussian while the hidden units remain binary: $$ \begin{align} E(\mathbf{x}, \mathbf{h}) = \sum_i^M \frac{(x_i - a_i)^2}{2\sigma_i^2} - \sum_j^N b_j h_j - \sum_{i,j}^{M,N} \frac{x_i w_{ij} h_j}{\sigma_i^2}. \label{_auto4} \end{align} $$
When working with a training dataset, the most common training approach is maximizing the log-likelihood of the training data. The log likelihood characterizes the log-probability of generating the observed data using our generative model. Using this method our cost function is chosen as the negative log-likelihood. The learning then consists of trying to find parameters that maximize the probability of the dataset, and is known as Maximum Likelihood Estimation (MLE). Denoting the parameters as \( \boldsymbol{\theta} = a_1,...,a_M,b_1,...,b_N,w_{11},...,w_{MN} \), the log-likelihood is given by $$ \begin{align} \mathcal{L}(\{ \theta_i \}) &= \langle \text{log} P_\theta(\boldsymbol{x}) \rangle_{data} \label{_auto5}\\ &= - \langle E(\boldsymbol{x}; \{ \theta_i\}) \rangle_{data} - \text{log} Z(\{ \theta_i\}), \label{_auto6} \end{align} $$ where we used that the normalization constant does not depend on the data, \( \langle \text{log} Z(\{ \theta_i\}) \rangle = \text{log} Z(\{ \theta_i\}) \) Our cost function is the negative log-likelihood, \( \mathcal{C}(\{ \theta_i \}) = - \mathcal{L}(\{ \theta_i \}) \)
The training procedure of choice often is Stochastic Gradient Descent (SGD). It consists of a series of iterations where we update the parameters according to the equation $$ \begin{align} \boldsymbol{\theta}_{k+1} = \boldsymbol{\theta}_k - \eta \nabla \mathcal{C} (\boldsymbol{\theta}_k) \label{_auto7} \end{align} $$ at each \( k \)-th iteration. There are a range of variants of the algorithm which aim at making the learning rate \( \eta \) more adaptive so the method might be more efficient while remaining stable.
We now need the gradient of the cost function in order to minimize it. We find that $$ \begin{align} \frac{\partial \mathcal{C}(\{ \theta_i\})}{\partial \theta_i} &= \langle \frac{\partial E(\boldsymbol{x}; \theta_i)}{\partial \theta_i} \rangle_{data} + \frac{\partial \text{log} Z(\{ \theta_i\})}{\partial \theta_i} \label{_auto8}\\ &= \langle O_i(\boldsymbol{x}) \rangle_{data} - \langle O_i(\boldsymbol{x}) \rangle_{model}, \label{_auto9} \end{align} $$ where in order to simplify notation we defined the "operator" $$ \begin{align} O_i(\boldsymbol{x}) = \frac{\partial E(\boldsymbol{x}; \theta_i)}{\partial \theta_i}, \label{_auto10} \end{align} $$ and used the statistical mechanics relationship between expectation values and the log-partition function: $$ \begin{align} \langle O_i(\boldsymbol{x}) \rangle_{model} = \text{Tr} P_\theta(\boldsymbol{x})O_i(\boldsymbol{x}) = - \frac{\partial \text{log} Z(\{ \theta_i\})}{\partial \theta_i}. \label{_auto11} \end{align} $$
The data-dependent term in the gradient is known as the positive phase of the gradient, while the model-dependent term is known as the negative phase of the gradient. The aim of the training is to lower the energy of configurations that are near observed data points (increasing their probability), and raising the energy of configurations that are far from observed data points (decreasing their probability).
The gradient of the negative log-likelihood cost function of a Binary-Binary RBM is then $$ \begin{align} \frac{\partial \mathcal{C} (w_{ij}, a_i, b_j)}{\partial w_{ij}} =& \langle x_i h_j \rangle_{data} - \langle x_i h_j \rangle_{model} \label{_auto12}\\ \frac{\partial \mathcal{C} (w_{ij}, a_i, b_j)}{\partial a_{ij}} =& \langle x_i \rangle_{data} - \langle x_i \rangle_{model} \label{_auto13}\\ \frac{\partial \mathcal{C} (w_{ij}, a_i, b_j)}{\partial b_{ij}} =& \langle h_i \rangle_{data} - \langle h_i \rangle_{model}. \label{_auto14}\\ \label{_auto15} \end{align} $$ To get the expectation values with respect to the data, we set the visible units to each of the observed samples in the training data, then update the hidden units according to the conditional probability found before. We then average over all samples in the training data to calculate expectation values with respect to the data.
When the goal of the training is to approximate a probability distribution, as it is in generative modeling, another relevant measure is the Kullback-Leibler divergence, also known as the relative entropy or Shannon entropy. It is a non-symmetric measure of the dissimilarity between two probability density functions \( p \) and \( q \). If \( p \) is the unkown probability which we approximate with \( q \), we can measure the difference by $$ \begin{align} \text{KL}(p||q) = \int_{-\infty}^{\infty} p (\boldsymbol{x}) \log \frac{p(\boldsymbol{x})}{q(\boldsymbol{x})} d\boldsymbol{x}. \label{_auto16} \end{align} $$
Thus, the Kullback-Leibler divergence between the distribution of the training data \( f(\boldsymbol{x}) \) and the model distribution \( p(\boldsymbol{x}| \boldsymbol{\theta}) \) is $$ \begin{align} \text{KL} (f(\boldsymbol{x})|| p(\boldsymbol{x}| \boldsymbol{\theta})) =& \int_{-\infty}^{\infty} f (\boldsymbol{x}) \log \frac{f(\boldsymbol{x})}{p(\boldsymbol{x}| \boldsymbol{\theta})} d\boldsymbol{x} \label{_auto17}\\ =& \int_{-\infty}^{\infty} f(\boldsymbol{x}) \log f(\boldsymbol{x}) d\boldsymbol{x} - \int_{-\infty}^{\infty} f(\boldsymbol{x}) \log p(\boldsymbol{x}| \boldsymbol{\theta}) d\boldsymbol{x} \label{_auto18}\\ %=& \mathbb{E}_{f(\boldsymbol{x})} (\log f(\boldsymbol{x})) - \mathbb{E}_{f(\boldsymbol{x})} (\log p(\boldsymbol{x}| \boldsymbol{\theta})) =& \langle \log f(\boldsymbol{x}) \rangle_{f(\boldsymbol{x})} - \langle \log p(\boldsymbol{x}| \boldsymbol{\theta}) \rangle_{f(\boldsymbol{x})} \label{_auto19}\\ =& \langle \log f(\boldsymbol{x}) \rangle_{data} + \langle E(\boldsymbol{x}) \rangle_{data} + \log Z \label{_auto20}\\ =& \langle \log f(\boldsymbol{x}) \rangle_{data} + \mathcal{C}_{LL} . \label{_auto21} \end{align} $$
The first term is constant with respect to \( \boldsymbol{\theta} \) since \( f(\boldsymbol{x}) \) is independent of \( \boldsymbol{\theta} \). Thus the Kullback-Leibler Divergence is minimal when the second term is minimal. The second term is the log-likelihood cost function, hence minimizing the Kullback-Leibler divergence is equivalent to maximizing the log-likelihood.
To further understand generative models it is useful to study the gradient of the cost function which is needed in order to minimize it using methods like stochastic gradient descent.
The partition function is the generating function of expectation values, in particular there are mathematical relationships between expectation values and the log-partition function. In this case we have $$ \begin{align} \langle \frac{ \partial E(\boldsymbol{x}; \theta_i) } { \partial \theta_i} \rangle_{model} = \int p(\boldsymbol{x}| \boldsymbol{\theta}) \frac{ \partial E(\boldsymbol{x}; \theta_i) } { \partial \theta_i} d\boldsymbol{x} = -\frac{\partial \log Z(\theta_i)}{ \partial \theta_i} . \label{_auto22} \end{align} $$
Here \( \langle \cdot \rangle_{model} \) is the expectation value over the model probability distribution \( p(\boldsymbol{x}| \boldsymbol{\theta}) \).
Using the previous relationship we can express the gradient of the cost function as $$ \begin{align} \frac{\partial \mathcal{C}_{LL}}{\partial \theta_i} =& \langle \frac{ \partial E(\boldsymbol{x}; \theta_i) } { \partial \theta_i} \rangle_{data} + \frac{\partial \log Z(\theta_i)}{ \partial \theta_i} \label{_auto23}\\ =& \langle \frac{ \partial E(\boldsymbol{x}; \theta_i) } { \partial \theta_i} \rangle_{data} - \langle \frac{ \partial E(\boldsymbol{x}; \theta_i) } { \partial \theta_i} \rangle_{model} \label{_auto24}\\ %=& \langle O_i(\boldsymbol{x}) \rangle_{data} - \langle O_i(\boldsymbol{x}) \rangle_{model} \label{_auto25} \end{align} $$
This expression shows that the gradient of the log-likelihood cost function is a difference of moments, with one calculated from the data and one calculated from the model. The data-dependent term is called the positive phase and the model-dependent term is called the negative phase of the gradient. We see now that minimizing the cost function results in lowering the energy of configurations \( \boldsymbol{x} \) near points in the training data and increasing the energy of configurations not observed in the training data. That means we increase the model's probability of configurations similar to those in the training data.
The gradient of the cost function also demonstrates why gradients of unsupervised, generative models must be computed differently from for those of for example FNNs. While the data-dependent expectation value is easily calculated based on the samples \( \boldsymbol{x}_i \) in the training data, we must sample from the model in order to generate samples from which to caclulate the model-dependent term. We sample from the model by using MCMC-based methods. We can not sample from the model directly because the partition function \( Z \) is generally intractable.
As in supervised machine learning problems, the goal is also here to perform well on unseen data, that is to have good generalization from the training data. The distribution \( f(x) \) we approximate is not the true distribution we wish to estimate, it is limited to the training data. Hence, in unsupervised training as well it is important to prevent overfitting to the training data. Thus it is common to add regularizers to the cost function in the same manner as we discussed for say linear regression.
The idea of applying RBMs to quantum many body problems was presented by G. Carleo and M. Troyer, working with ETH Zurich and Microsoft Research. There are several interesting articles that follow up the research presented by Carleo and Troyer, see for example Saito's work using neural networks.
Some of their motivation included
The wavefunction should be a probability amplitude depending on \( \boldsymbol{x} \). The RBM model is given by the joint distribution of \( \boldsymbol{x} \) and \( \boldsymbol{h} \) $$ \begin{align} F_{rbm}(\mathbf{x},\mathbf{h}) = \frac{1}{Z} e^{-\frac{1}{T_0}E(\mathbf{x},\mathbf{h})}. \label{_auto26} \end{align} $$
To find the marginal distribution of \( \boldsymbol{x} \) we set: $$ \begin{align} F_{rbm}(\mathbf{x}) &= \sum_\mathbf{h} F_{rbm}(\mathbf{x}, \mathbf{h}) \label{_auto27}\\ &= \frac{1}{Z}\sum_\mathbf{h} e^{-E(\mathbf{x}, \mathbf{h})}. \label{_auto28} \end{align} $$
Now this is what we use to represent the wave function, calling it a neural-network quantum state (NQS) $$ \begin{align} \Psi (\mathbf{X}) &= F_{rbm}(\mathbf{x}) \label{_auto29}\\ &= \frac{1}{Z}\sum_{\boldsymbol{h}} e^{-E(\mathbf{x}, \mathbf{h})} \label{_auto30}\\ &= \frac{1}{Z} \sum_{\{h_j\}} e^{-\sum_i^M \frac{(x_i - a_i)^2}{2\sigma^2} + \sum_j^N b_j h_j + \sum_\ {i,j}^{M,N} \frac{x_i w_{ij} h_j}{\sigma^2}} \label{_auto31}\\ &= \frac{1}{Z} e^{-\sum_i^M \frac{(x_i - a_i)^2}{2\sigma^2}} \prod_j^N (1 + e^{b_j + \sum_i^M \frac{x\ _i w_{ij}}{\sigma^2}}). \label{_auto32}\\ \label{_auto33} \end{align} $$
Now we don't necessarily have training data (unless we generate it by using some other method). However, what we do have is the variational principle which allows us to obtain the ground state wave function by minimizing the expectation value of the energy of a trial wavefunction (corresponding to the untrained NQS). Similarly to the traditional variational Monte Carlo method then, it is the local energy we wish to minimize. The gradient to use for the stochastic gradient descent procedure is $$ \begin{align} C_i = \frac{\partial \langle E_L \rangle}{\partial \theta_i} = 2(\langle E_L \frac{1}{\Psi}\frac{\partial \Psi}{\partial \theta_i} \rangle - \langle E_L \rangle \langle \frac{1}{\Psi}\frac{\partial \Psi}{\partial \theta_i} \rangle ), \label{_auto34} \end{align} $$ where the local energy is given by $$ \begin{align} E_L = \frac{1}{\Psi} \hat{\mathbf{H}} \Psi. \label{_auto35} \end{align} $$
Because we are restricted to potential functions which are positive it is convenient to express them as exponentials, so that $$ \begin{align} \phi_C (\boldsymbol{x}_C) = e^{-E_C(\boldsymbol{x}_C)} \label{_auto36} \end{align} $$
where \( E(\boldsymbol{x}_C) \) is called an energy function, and the exponential representation is the Boltzmann distribution. The joint distribution is defined as the product of potentials.
The joint distribution of the random variables is then $$ \begin{align} p(\boldsymbol{x}) =& \frac{1}{Z} \prod_C \phi_C (\boldsymbol{x}_C) \nonumber \\ =& \frac{1}{Z} \prod_C e^{-E_C(\boldsymbol{x}_C)} \nonumber \\ =& \frac{1}{Z} e^{-\sum_C E_C(\boldsymbol{x}_C)} \nonumber \\ =& \frac{1}{Z} e^{-E(\boldsymbol{x})}. \label{_auto37} \end{align} $$ $$ \begin{align} p_{BM}(\boldsymbol{x}, \boldsymbol{h}) = \frac{1}{Z_{BM}} e^{-\frac{1}{T}E_{BM}(\boldsymbol{x}, \boldsymbol{h})} , \label{_auto38} \end{align} $$
with the partition function $$ \begin{align} Z_{BM} = \int \int e^{-\frac{1}{T} E_{BM}(\tilde{\boldsymbol{x}}, \tilde{\boldsymbol{h}})} d\tilde{\boldsymbol{x}} d\tilde{\boldsymbol{h}} . \label{_auto39} \end{align} $$
\( T \) is a physics-inspired parameter named temperature and will be assumed to be 1 unless otherwise stated. The energy function of the Boltzmann machine determines the interactions between the nodes and is defined $$ \begin{align} E_{BM}(\boldsymbol{x}, \boldsymbol{h}) =& - \sum_{i, k}^{M, K} a_i^k \alpha_i^k (x_i) - \sum_{j, l}^{N, L} b_j^l \beta_j^l (h_j) - \sum_{i,j,k,l}^{M,N,K,L} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (h_j) \nonumber \\ &- \sum_{i, m=i+1, k}^{M, M, K} \alpha_i^k (x_i) v_{im}^k \alpha_m^k (x_m) - \sum_{j,n=j+1,l}^{N,N,L} \beta_j^l (h_j) u_{jn}^l \beta_n^l (h_n). \label{_auto40} \end{align} $$
Here \( \alpha_i^k (x_i) \) and \( \beta_j^l (h_j) \) are one-dimensional transfer functions or mappings from the given input value to the desired feature value. They can be arbitrary functions of the input variables and are independent of the parameterization (parameters referring to weight and biases), meaning they are not affected by training of the model. The indices \( k \) and \( l \) indicate that there can be multiple transfer functions per variable. Furthermore, \( a_i^k \) and \( b_j^l \) are the visible and hidden bias. \( w_{ij}^{kl} \) are weights of the \textbf{inter-layer} connection terms which connect visible and hidden units. $ v_{im}^k$ and \( u_{jn}^l \) are weights of the \textbf{intra-layer} connection terms which connect the visible units to each other and the hidden units to each other, respectively.
We remove the intra-layer connections by setting \( v_{im} \) and \( u_{jn} \) to zero. The expression for the energy of the RBM is then $$ \begin{align} E_{RBM}(\boldsymbol{x}, \boldsymbol{h}) = - \sum_{i, k}^{M, K} a_i^k \alpha_i^k (x_i) - \sum_{j, l}^{N, L} b_j^l \beta_j^l (h_j) - \sum_{i,j,k,l}^{M,N,K,L} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (h_j). \label{_auto41} \end{align} $$ resulting in $$ \begin{align} P_{RBM} (\boldsymbol{x}) =& \int P_{RBM} (\boldsymbol{x}, \tilde{\boldsymbol{h}}) d \tilde{\boldsymbol{h}} \nonumber \\ =& \frac{1}{Z_{RBM}} \int e^{-E_{RBM} (\boldsymbol{x}, \tilde{\boldsymbol{h}}) } d\tilde{\boldsymbol{h}} \nonumber \\ =& \frac{1}{Z_{RBM}} \int e^{\sum_{i, k} a_i^k \alpha_i^k (x_i) + \sum_{j, l} b_j^l \beta_j^l (\tilde{h}_j) + \sum_{i,j,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (\tilde{h}_j)} d\tilde{\boldsymbol{h}} \nonumber \\ =& \frac{1}{Z_{RBM}} e^{\sum_{i, k} a_i^k \alpha_i^k (x_i)} \int \prod_j^N e^{\sum_l b_j^l \beta_j^l (\tilde{h}_j) + \sum_{i,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (\tilde{h}_j)} d\tilde{\boldsymbol{h}} \nonumber \\ =& \frac{1}{Z_{RBM}} e^{\sum_{i, k} a_i^k \alpha_i^k (x_i)} \biggl( \int e^{\sum_l b_1^l \beta_1^l (\tilde{h}_1) + \sum_{i,k,l} \alpha_i^k (x_i) w_{i1}^{kl} \beta_1^l (\tilde{h}_1)} d \tilde{h}_1 \nonumber \\ & \times \int e^{\sum_l b_2^l \beta_2^l (\tilde{h}_2) + \sum_{i,k,l} \alpha_i^k (x_i) w_{i2}^{kl} \beta_2^l (\tilde{h}_2)} d \tilde{h}_2 \nonumber \\ & \times ... \nonumber \\ & \times \int e^{\sum_l b_N^l \beta_N^l (\tilde{h}_N) + \sum_{i,k,l} \alpha_i^k (x_i) w_{iN}^{kl} \beta_N^l (\tilde{h}_N)} d \tilde{h}_N \biggr) \nonumber \\ =& \frac{1}{Z_{RBM}} e^{\sum_{i, k} a_i^k \alpha_i^k (x_i)} \prod_j^N \int e^{\sum_l b_j^l \beta_j^l (\tilde{h}_j) + \sum_{i,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (\tilde{h}_j)} d\tilde{h}_j \label{_auto42} \end{align} $$
Similarly $$ \begin{align} P_{RBM} (\boldsymbol{h}) =& \frac{1}{Z_{RBM}} \int e^{-E_{RBM} (\tilde{\boldsymbol{x}}, \boldsymbol{h})} d\tilde{\boldsymbol{x}} \nonumber \\ =& \frac{1}{Z_{RBM}} e^{\sum_{j, l} b_j^l \beta_j^l (h_j)} \prod_i^M \int e^{\sum_k a_i^k \alpha_i^k (\tilde{x}_i) + \sum_{j,k,l} \alpha_i^k (\tilde{x}_i) w_{ij}^{kl} \beta_j^l (h_j)} d\tilde{x}_i \label{_auto43} \end{align} $$
Using Bayes theorem $$ \begin{align} P_{RBM} (\boldsymbol{h}|\boldsymbol{x}) =& \frac{P_{RBM} (\boldsymbol{x}, \boldsymbol{h})}{P_{RBM} (\boldsymbol{x})} \nonumber \\ =& \frac{\frac{1}{Z_{RBM}} e^{\sum_{i, k} a_i^k \alpha_i^k (x_i) + \sum_{j, l} b_j^l \beta_j^l (h_j) + \sum_{i,j,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (h_j)}} {\frac{1}{Z_{RBM}} e^{\sum_{i, k} a_i^k \alpha_i^k (x_i)} \prod_j^N \int e^{\sum_l b_j^l \beta_j^l (\tilde{h}_j) + \sum_{i,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (\tilde{h}_j)} d\tilde{h}_j} \nonumber \\ =& \prod_j^N \frac{e^{\sum_l b_j^l \beta_j^l (h_j) + \sum_{i,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (h_j)} } {\int e^{\sum_l b_j^l \beta_j^l (\tilde{h}_j) + \sum_{i,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (\tilde{h}_j)} d\tilde{h}_j} \label{_auto44} \end{align} $$
Similarly $$ \begin{align} P_{RBM} (\boldsymbol{x}|\boldsymbol{h}) =& \frac{P_{RBM} (\boldsymbol{x}, \boldsymbol{h})}{P_{RBM} (\boldsymbol{h})} \nonumber \\ =& \prod_i^M \frac{e^{\sum_k a_i^k \alpha_i^k (x_i) + \sum_{j,k,l} \alpha_i^k (x_i) w_{ij}^{kl} \beta_j^l (h_j)}} {\int e^{\sum_k a_i^k \alpha_i^k (\tilde{x}_i) + \sum_{j,k,l} \alpha_i^k (\tilde{x}_i) w_{ij}^{kl} \beta_j^l (h_j)} d\tilde{x}_i} \label{_auto45} \end{align} $$
The original RBM had binary visible and hidden nodes. They were showned to be universal approximators of discrete distributions. It was also shown that adding hidden units yields strictly improved modelling power. The common choice of binary values are 0 and 1. However, in some physics applications, -1 and 1 might be a more natural choice. We will here use 0 and 1. $$ \begin{align} E_{BB}(\boldsymbol{x}, \mathbf{h}) = - \sum_i^M x_i a_i- \sum_j^N b_j h_j - \sum_{i,j}^{M,N} x_i w_{ij} h_j. \label{_auto46} \end{align} $$ $$ \begin{align} p_{BB}(\boldsymbol{x}, \boldsymbol{h}) =& \frac{1}{Z_{BB}} e^{\sum_i^M a_i x_i + \sum_j^N b_j h_j + \sum_{ij}^{M,N} x_i w_{ij} h_j} \label{_auto47}\\ =& \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a} + \boldsymbol{b}^T \boldsymbol{h} + \boldsymbol{x}^T \boldsymbol{W} \boldsymbol{h}} \label{_auto48} \end{align} $$
with the partition function $$ \begin{align} Z_{BB} = \sum_{\boldsymbol{x}, \boldsymbol{h}} e^{\boldsymbol{x}^T \boldsymbol{a} + \boldsymbol{b}^T \boldsymbol{h} + \boldsymbol{x}^T \boldsymbol{W} \boldsymbol{h}} . \label{_auto49} \end{align} $$
In order to find the probability of any configuration of the visible units we derive the marginal probability density function. $$ \begin{align} p_{BB} (\boldsymbol{x}) =& \sum_{\boldsymbol{h}} p_{BB} (\boldsymbol{x}, \boldsymbol{h}) \label{_auto50}\\ =& \frac{1}{Z_{BB}} \sum_{\boldsymbol{h}} e^{\boldsymbol{x}^T \boldsymbol{a} + \boldsymbol{b}^T \boldsymbol{h} + \boldsymbol{x}^T \boldsymbol{W} \boldsymbol{h}} \nonumber \\ =& \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a}} \sum_{\boldsymbol{h}} e^{\sum_j^N (b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j})h_j} \nonumber \\ =& \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a}} \sum_{\boldsymbol{h}} \prod_j^N e^{ (b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j})h_j} \nonumber \\ =& \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a}} \bigg ( \sum_{h_1} e^{(b_1 + \boldsymbol{x}^T \boldsymbol{w}_{\ast 1})h_1} \times \sum_{h_2} e^{(b_2 + \boldsymbol{x}^T \boldsymbol{w}_{\ast 2})h_2} \times \nonumber \\ & ... \times \sum_{h_2} e^{(b_N + \boldsymbol{x}^T \boldsymbol{w}_{\ast N})h_N} \bigg ) \nonumber \\ =& \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a}} \prod_j^N \sum_{h_j} e^{(b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}) h_j} \nonumber \\ =& \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a}} \prod_j^N (1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}}) . \label{_auto51} \end{align} $$
A similar derivation yields the marginal probability of the hidden units $$ \begin{align} p_{BB} (\boldsymbol{h}) = \frac{1}{Z_{BB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M (1 + e^{a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}}) . \label{_auto52} \end{align} $$
We derive the probability of the hidden units given the visible units using Bayes' rule $$ \begin{align} p_{BB} (\boldsymbol{h}|\boldsymbol{x}) =& \frac{p_{BB} (\boldsymbol{x}, \boldsymbol{h})}{p_{BB} (\boldsymbol{x})} \nonumber \\ =& \frac{ \frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a} + \boldsymbol{b}^T \boldsymbol{h} + \boldsymbol{x}^T \boldsymbol{W} \boldsymbol{h}} } {\frac{1}{Z_{BB}} e^{\boldsymbol{x}^T \boldsymbol{a}} \prod_j^N (1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}})} \nonumber \\ =& \frac{ e^{\boldsymbol{x}^T \boldsymbol{a}} e^{ \sum_j^N (b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j} ) h_j} } { e^{\boldsymbol{x}^T \boldsymbol{a}} \prod_j^N (1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}})} \nonumber \\ =& \prod_j^N \frac{ e^{(b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j} ) h_j} } {1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}}} \nonumber \\ =& \prod_j^N p_{BB} (h_j| \boldsymbol{x}) . \label{_auto53} \end{align} $$
From this we find the probability of a hidden unit being "on" or "off": $$ \begin{align} p_{BB} (h_j=1 | \boldsymbol{x}) =& \frac{ e^{(b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j} ) h_j} } {1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}}} \label{_auto54}\\ =& \frac{ e^{(b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j} )} } {1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}}} \label{_auto55}\\ =& \frac{ 1 }{1 + e^{-(b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j})} } , \label{_auto56} \end{align} $$ and $$ \begin{align} p_{BB} (h_j=0 | \boldsymbol{x}) =\frac{ 1 }{1 + e^{b_j + \boldsymbol{x}^T \boldsymbol{w}_{\ast j}} } . \label{_auto57} \end{align} $$
Similarly we have that the conditional probability of the visible units given the hidden are $$ \begin{align} p_{BB} (\boldsymbol{x}|\boldsymbol{h}) =& \prod_i^M \frac{ e^{ (a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}) x_i} }{ 1 + e^{a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}} } \label{_auto58}\\ &= \prod_i^M p_{BB} (x_i | \boldsymbol{h}) . \label{_auto59} \end{align} $$ $$ \begin{align} p_{BB} (x_i=1 | \boldsymbol{h}) =& \frac{1}{1 + e^{-(a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h} )}} \label{_auto60}\\ p_{BB} (x_i=0 | \boldsymbol{h}) =& \frac{1}{1 + e^{a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h} }} . \label{_auto61} \end{align} $$
Inserting into the expression for \( E_{RBM}(\boldsymbol{x},\boldsymbol{h}) \) in equation results in the energy $$ \begin{align} E_{GB}(\boldsymbol{x}, \boldsymbol{h}) =& \sum_i^M \frac{(x_i - a_i)^2}{2\sigma_i^2} - \sum_j^N b_j h_j -\sum_{ij}^{M,N} \frac{x_i w_{ij} h_j}{\sigma_i^2} \nonumber \\ =& \vert\vert\frac{\boldsymbol{x} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2 - \boldsymbol{b}^T \boldsymbol{h} - (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{W}\boldsymbol{h} . \label{_auto62} \end{align} $$
with the partition function given by $$ \begin{align} Z_{GB} =& \int \sum_{\tilde{\boldsymbol{h}}}^{\tilde{\boldsymbol{H}}} e^{-\vert\vert\frac{\tilde{\boldsymbol{x}} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2 + \boldsymbol{b}^T \tilde{\boldsymbol{h}} + (\frac{\tilde{\boldsymbol{x}}}{\boldsymbol{\sigma}^2})^T \boldsymbol{W}\tilde{\boldsymbol{h}}} d\tilde{\boldsymbol{x}} . \label{_auto64} \end{align} $$
We proceed to find the marginal probability densitites of the Gaussian-binary RBM. We first marginalize over the binary hidden units to find \( p_{GB} (\boldsymbol{x}) \) $$ \begin{align} p_{GB} (\boldsymbol{x}) =& \sum_{\tilde{\boldsymbol{h}}}^{\tilde{\boldsymbol{H}}} p_{GB} (\boldsymbol{x}, \tilde{\boldsymbol{h}}) \nonumber \\ =& \frac{1}{Z_{GB}} \sum_{\tilde{\boldsymbol{h}}}^{\tilde{\boldsymbol{H}}} e^{-\vert\vert\frac{\boldsymbol{x} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2 + \boldsymbol{b}^T \tilde{\boldsymbol{h}} + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{W}\tilde{\boldsymbol{h}}} \nonumber \\ =& \frac{1}{Z_{GB}} e^{-\vert\vert\frac{\boldsymbol{x} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2} \prod_j^N (1 + e^{b_j + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j}} ) . \label{_auto65} \end{align} $$
We next marginalize over the visible units. This is the first time we marginalize over continuous values. We rewrite the exponential factor dependent on \( \boldsymbol{x} \) as a Gaussian function before we integrate in the last step. $$ \begin{align} p_{GB} (\boldsymbol{h}) =& \int p_{GB} (\tilde{\boldsymbol{x}}, \boldsymbol{h}) d\tilde{\boldsymbol{x}} \nonumber \\ =& \frac{1}{Z_{GB}} \int e^{-\vert\vert\frac{\tilde{\boldsymbol{x}} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2 + \boldsymbol{b}^T \boldsymbol{h} + (\frac{\tilde{\boldsymbol{x}}}{\boldsymbol{\sigma}^2})^T \boldsymbol{W}\boldsymbol{h}} d\tilde{\boldsymbol{x}} \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h} } \int \prod_i^M e^{- \frac{(\tilde{x}_i - a_i)^2}{2\sigma_i^2} + \frac{\tilde{x}_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h}}{\sigma_i^2} } d\tilde{\boldsymbol{x}} \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h} } \biggl( \int e^{- \frac{(\tilde{x}_1 - a_1)^2}{2\sigma_1^2} + \frac{\tilde{x}_1 \boldsymbol{w}_{1\ast}^T \boldsymbol{h}}{\sigma_1^2} } d\tilde{x}_1 \nonumber \\ & \times \int e^{- \frac{(\tilde{x}_2 - a_2)^2}{2\sigma_2^2} + \frac{\tilde{x}_2 \boldsymbol{w}_{2\ast}^T \boldsymbol{h}}{\sigma_2^2} } d\tilde{x}_2 \nonumber \\ & \times ... \nonumber \\ &\times \int e^{- \frac{(\tilde{x}_M - a_M)^2}{2\sigma_M^2} + \frac{\tilde{x}_M \boldsymbol{w}_{M\ast}^T \boldsymbol{h}}{\sigma_M^2} } d\tilde{x}_M \biggr) \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M \int e^{- \frac{(\tilde{x}_i - a_i)^2 - 2\tilde{x}_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h}}{2\sigma_i^2} } d\tilde{x}_i \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M \int e^{- \frac{\tilde{x}_i^2 - 2\tilde{x}_i(a_i + \tilde{x}_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h}) + a_i^2}{2\sigma_i^2} } d\tilde{x}_i \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M \int e^{- \frac{\tilde{x}_i^2 - 2\tilde{x}_i(a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}) + (a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 - (a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 + a_i^2}{2\sigma_i^2} } d\tilde{x}_i \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M \int e^{- \frac{(\tilde{x}_i - (a_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}))^2 - a_i^2 -2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} - (\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 + a_i^2}{2\sigma_i^2} } d\tilde{x}_i \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M e^{\frac{2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} +(\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 }{2\sigma_i^2}} \int e^{- \frac{(\tilde{x}_i - a_i - \boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2}{2\sigma_i^2}} d\tilde{x}_i \nonumber \\ =& \frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M \sqrt{2\pi \sigma_i^2} e^{\frac{2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} +(\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 }{2\sigma_i^2}} . \label{_auto66} \end{align} $$
We finish by deriving the conditional probabilities. $$ \begin{align} p_{GB} (\boldsymbol{h}| \boldsymbol{x}) =& \frac{p_{GB} (\boldsymbol{x}, \boldsymbol{h})}{p_{GB} (\boldsymbol{x})} \nonumber \\ =& \frac{\frac{1}{Z_{GB}} e^{-\vert\vert\frac{\boldsymbol{x} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2 + \boldsymbol{b}^T \boldsymbol{h} + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{W}\boldsymbol{h}}} {\frac{1}{Z_{GB}} e^{-\vert\vert\frac{\boldsymbol{x} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2} \prod_j^N (1 + e^{b_j + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j}} ) } \nonumber \\ =& \prod_j^N \frac{e^{(b_j + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j})h_j } } {1 + e^{b_j + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j}}} \nonumber \\ =& \prod_j^N p_{GB} (h_j|\boldsymbol{x}). \label{_auto67} \end{align} $$ The conditional probability of a binary hidden unit \( h_j \) being on or off again takes the form of a sigmoid function $$ \begin{align} p_{GB} (h_j =1 | \boldsymbol{x}) =& \frac{e^{b_j + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j} } } {1 + e^{b_j + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j}}} \nonumber \\ =& \frac{1}{1 + e^{-b_j - (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j}}} \label{_auto68}\\ p_{GB} (h_j =0 | \boldsymbol{x}) =& \frac{1}{1 + e^{b_j +(\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{w}_{\ast j}}} . \label{_auto69} \end{align} $$
The conditional probability of the continuous \( \boldsymbol{x} \) now has another form, however. $$ \begin{align} p_{GB} (\boldsymbol{x}|\boldsymbol{h}) =& \frac{p_{GB} (\boldsymbol{x}, \boldsymbol{h})}{p_{GB} (\boldsymbol{h})} \nonumber \\ =& \frac{\frac{1}{Z_{GB}} e^{-\vert\vert\frac{\boldsymbol{x} -\boldsymbol{a}}{2\boldsymbol{\sigma}}\vert\vert^2 + \boldsymbol{b}^T \boldsymbol{h} + (\frac{\boldsymbol{x}}{\boldsymbol{\sigma}^2})^T \boldsymbol{W}\boldsymbol{h}}} {\frac{1}{Z_{GB}} e^{\boldsymbol{b}^T \boldsymbol{h}} \prod_i^M \sqrt{2\pi \sigma_i^2} e^{\frac{2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} +(\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 }{2\sigma_i^2}}} \nonumber \\ =& \prod_i^M \frac{1}{\sqrt{2\pi \sigma_i^2}} \frac{e^{- \frac{(x_i - a_i)^2}{2\sigma_i^2} + \frac{x_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h}}{2\sigma_i^2} }} {e^{\frac{2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} +(\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 }{2\sigma_i^2}}} \nonumber \\ =& \prod_i^M \frac{1}{\sqrt{2\pi \sigma_i^2}} \frac{e^{-\frac{x_i^2 - 2a_i x_i + a_i^2 - 2x_i \boldsymbol{w}_{i\ast}^T\boldsymbol{h} }{2\sigma_i^2} } } {e^{\frac{2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} +(\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2 }{2\sigma_i^2}}} \nonumber \\ =& \prod_i^M \frac{1}{\sqrt{2\pi \sigma_i^2}} e^{- \frac{x_i^2 - 2a_i x_i + a_i^2 - 2x_i \boldsymbol{w}_{i\ast}^T\boldsymbol{h} + 2a_i \boldsymbol{w}_{i\ast}^T \boldsymbol{h} +(\boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2} {2\sigma_i^2} } \nonumber \\ =& \prod_i^M \frac{1}{\sqrt{2\pi \sigma_i^2}} e^{ - \frac{(x_i - b_i - \boldsymbol{w}_{i\ast}^T \boldsymbol{h})^2}{2\sigma_i^2}} \nonumber \\ =& \prod_i^M \mathcal{N} (x_i | b_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}, \sigma_i^2) \label{_auto70}\\ \Rightarrow p_{GB} (x_i|\boldsymbol{h}) =& \mathcal{N} (x_i | b_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h}, \sigma_i^2) . \label{_auto71} \end{align} $$
The form of these conditional probabilities explains the name "Gaussian" and the form of the Gaussian-binary energy function. We see that the conditional probability of \( x_i \) given \( \boldsymbol{h} \) is a normal distribution with mean \( b_i + \boldsymbol{w}_{i\ast}^T \boldsymbol{h} \) and variance \( \sigma_i^2 \).
The wavefunction should be a probability amplitude depending on \( \boldsymbol{x} \). The RBM model is given by the joint distribution of \( \boldsymbol{x} \) and \( \boldsymbol{h} \) $$ \begin{align} F_{rbm}(\boldsymbol{x},\mathbf{h}) = \frac{1}{Z} e^{-\frac{1}{T_0}E(\boldsymbol{x},\mathbf{h})} \label{_auto72} \end{align} $$ To find the marginal distribution of \( \boldsymbol{x} \) we set: $$ \begin{align} F_{rbm}(\mathbf{x}) &= \sum_\mathbf{h} F_{rbm}(\mathbf{x}, \mathbf{h}) \label{_auto73}\\ &= \frac{1}{Z}\sum_\mathbf{h} e^{-E(\mathbf{x}, \mathbf{h})} \label{_auto74} \end{align} $$
Now this is what we use to represent the wave function, calling it a neural-network quantum state (NQS) $$ \begin{align} \Psi (\mathbf{X}) &= F_{rbm}(\mathbf{x}) \label{_auto75}\\ &= \frac{1}{Z}\sum_{\boldsymbol{h}} e^{-E(\mathbf{x}, \mathbf{h})} \label{_auto76}\\ &= \frac{1}{Z} \sum_{\{h_j\}} e^{-\sum_i^M \frac{(x_i - a_i)^2}{2\sigma^2} + \sum_j^N b_j h_j + \sum_{i,j}^{M,N} \frac{x_i w_{ij} h_j}{\sigma^2}} \label{_auto77}\\ &= \frac{1}{Z} e^{-\sum_i^M \frac{(x_i - a_i)^2}{2\sigma^2}} \prod_j^N (1 + e^{b_j + \sum_i^M \frac{x_i w_{ij}}{\sigma^2}}) \label{_auto78}\\ \label{_auto79} \end{align} $$
The above wavefunction is the most general one because it allows for complex valued wavefunctions. However it fundamentally changes the probabilistic foundation of the RBM, because what is usually a probability in the RBM framework is now a an amplitude. This means that a lot of the theoretical framework usually used to interpret the model, i.e. graphical models, conditional probabilities, and Markov random fields, breaks down. If we assume the wavefunction to be postive definite, however, we can use the RBM to represent the squared wavefunction, and thereby a probability. This also makes it possible to sample from the model using Gibbs sampling, because we can obtain the conditional probabilities. $$ \begin{align} |\Psi (\mathbf{X})|^2 &= F_{rbm}(\mathbf{X}) \label{_auto80}\\ \Rightarrow \Psi (\mathbf{X}) &= \sqrt{F_{rbm}(\mathbf{X})} \label{_auto81}\\ &= \frac{1}{\sqrt{Z}}\sqrt{\sum_{\{h_j\}} e^{-E(\mathbf{X}, \mathbf{h})}} \label{_auto82}\\ &= \frac{1}{\sqrt{Z}} \sqrt{\sum_{\{h_j\}} e^{-\sum_i^M \frac{(X_i - a_i)^2}{2\sigma^2} + \sum_j^N b_j h_j + \sum_{i,j}^{M,N} \frac{X_i w_{ij} h_j}{\sigma^2}} } \label{_auto83}\\ &= \frac{1}{\sqrt{Z}} e^{-\sum_i^M \frac{(X_i - a_i)^2}{4\sigma^2}} \sqrt{\sum_{\{h_j\}} \prod_j^N e^{b_j h_j + \sum_i^M \frac{X_i w_{ij} h_j}{\sigma^2}}} \label{_auto84}\\ &= \frac{1}{\sqrt{Z}} e^{-\sum_i^M \frac{(X_i - a_i)^2}{4\sigma^2}} \sqrt{\prod_j^N \sum_{h_j} e^{b_j h_j + \sum_i^M \frac{X_i w_{ij} h_j}{\sigma^2}}} \label{_auto85}\\ &= \frac{1}{\sqrt{Z}} e^{-\sum_i^M \frac{(X_i - a_i)^2}{4\sigma^2}} \prod_j^N \sqrt{e^0 + e^{b_j + \sum_i^M \frac{X_i w_{ij}}{\sigma^2}}} \label{_auto86}\\ &= \frac{1}{\sqrt{Z}} e^{-\sum_i^M \frac{(X_i - a_i)^2}{4\sigma^2}} \prod_j^N \sqrt{1 + e^{b_j + \sum_i^M \frac{X_i w_{ij}}{\sigma^2}}} \label{_auto87}\\ \label{_auto88} \end{align} $$
This is where we deviate from what is common in machine learning. Rather than defining a cost function based on some dataset, our cost function is the energy of the quantum mechanical system. From the variational principle we know that minizing this energy should lead to the ground state wavefunction. As stated previously the local energy is given by $$ \begin{align} E_L = \frac{1}{\Psi} \hat{\mathbf{H}} \Psi, \label{_auto89} \end{align} $$ and the gradient is $$ \begin{align} G_i = \frac{\partial \langle E_L \rangle}{\partial \alpha_i} = 2(\langle E_L \frac{1}{\Psi}\frac{\partial \Psi}{\partial \alpha_i} \rangle - \langle E_L \rangle \langle \frac{1}{\Psi}\frac{\partial \Psi}{\partial \alpha_i} \rangle ), \label{_auto90} \end{align} $$ where \( \alpha_i = a_1,...,a_M,b_1,...,b_N,w_{11},...,w_{MN} \).
We use that \( \frac{1}{\Psi}\frac{\partial \Psi}{\partial \alpha_i} = \frac{\partial \ln{\Psi}}{\partial \alpha_i} \), and find $$ \begin{align} \ln{\Psi({\mathbf{X}})} &= -\ln{Z} - \sum_m^M \frac{(X_m - a_m)^2}{2\sigma^2} + \sum_n^N \ln({1 + e^{b_n + \sum_i^M \frac{X_i w_{in}}{\sigma^2}})}. \label{_auto91} \end{align} $$
This gives $$ \begin{align} \frac{\partial }{\partial a_m} \ln\Psi &= \frac{1}{\sigma^2} (X_m - a_m) \label{_auto92}\\ \frac{\partial }{\partial b_n} \ln\Psi &= \frac{1}{e^{-b_n-\frac{1}{\sigma^2}\sum_i^M X_i w_{in}} + 1} \label{_auto93}\\ \frac{\partial }{\partial w_{mn}} \ln\Psi &= \frac{X_m}{\sigma^2(e^{-b_n-\frac{1}{\sigma^2}\sum_i^M X_i w_{in}} + 1)}. \label{_auto94} \end{align} $$
If \( \Psi = \sqrt{F_{rbm}} \) we have $$ \begin{align} \ln{\Psi({\mathbf{X}})} &= -\frac{1}{2}\ln{Z} - \sum_m^M \frac{(X_m - a_m)^2}{4\sigma^2} + \frac{1}{2}\sum_n^N \ln({1 + e^{b_n + \sum_i^M \frac{X_i w_{in}}{\sigma^2}})}, \label{_auto95} \end{align} $$ which results in $$ \begin{align} \frac{\partial }{\partial a_m} \ln\Psi &= \frac{1}{2\sigma^2} (X_m - a_m) \label{_auto96}\\ \frac{\partial }{\partial b_n} \ln\Psi &= \frac{1}{2(e^{-b_n-\frac{1}{\sigma^2}\sum_i^M X_i w_{in}} + 1)} \label{_auto97}\\ \frac{\partial }{\partial w_{mn}} \ln\Psi &= \frac{X_m}{2\sigma^2(e^{-b_n-\frac{1}{\sigma^2}\sum_i^M X_i w_{in}} + 1)}. \label{_auto98} \end{align} $$
Let us assume again that our Hamiltonian is $$ \begin{align} \hat{\mathbf{H}} = \sum_p^P (-\frac{1}{2}\nabla_p^2 + \frac{1}{2}\omega^2 r_p^2 ) + \sum_{p < q} \frac{1}{r_{pq}}, \label{_auto99} \end{align} $$
where the first summation term represents the standard harmonic oscillator part and the latter the repulsive interaction between two electrons. Natural units (\( \hbar=c=e=m_e=1 \)) are used, and \( P \) is the number of particles. This gives us the following expression for the local energy (\( D \) being the number of dimensions) $$ \begin{align} E_L &= \frac{1}{\Psi} \mathbf{H} \Psi \label{_auto100}\\ &= \frac{1}{\Psi} (\sum_p^P (-\frac{1}{2}\nabla_p^2 + \frac{1}{2}\omega^2 r_p^2 ) + \sum_{p < q} \frac{1}{r_{pq}}) \Psi \label{_auto101}\\ &= -\frac{1}{2}\frac{1}{\Psi} \sum_p^P \nabla_p^2 \Psi + \frac{1}{2}\omega^2 \sum_p^P r_p^2 + \sum_{p < q} \frac{1}{r_{pq}} \label{_auto102}\\ &= -\frac{1}{2}\frac{1}{\Psi} \sum_p^P \sum_d^D \frac{\partial^2 \Psi}{\partial x_{pd}^2} + \frac{1}{2}\omega^2 \sum_p^P r_p^2 + \sum_{p < q} \frac{1}{r_{pq}} \label{_auto103}\\ &= \frac{1}{2} \sum_p^P \sum_d^D (-(\frac{\partial}{\partial x_{pd}} \ln\Psi)^2 -\frac{\partial^2}{\partial x_{pd}^2} \ln\Psi + \omega^2 x_{pd}^2) + \sum_{p < q} \frac{1}{r_{pq}}. \label{_auto104}\\ \label{_auto105} \end{align} $$
Letting each visible node in the Boltzmann machine represent one coordinate of one particle, we obtain $$ \begin{align} E_L &= \frac{1}{2} \sum_m^M (-(\frac{\partial}{\partial v_m} \ln\Psi)^2 -\frac{\partial^2}{\partial v_m^2} \ln\Psi + \omega^2 v_m^2) + \sum_{p < q} \frac{1}{r_{pq}}, \label{_auto106} \end{align} $$ where we have that $$ \begin{align} \frac{\partial}{\partial x_m} \ln\Psi &= - \frac{1}{\sigma^2}(x_m - a_m) + \frac{1}{\sigma^2} \sum_n^N \frac{w_{mn}}{e^{-b_n - \frac{1}{\sigma^2}\sum_i^M x_i w_{in}} + 1} \label{_auto107}\\ \frac{\partial^2}{\partial x_m^2} \ln\Psi &= - \frac{1}{\sigma^2} + \frac{1}{\sigma^4}\sum_n^N \omega_{mn}^2 \frac{e^{b_n + \frac{1}{\sigma^2}\sum_i^M x_i w_{in}}}{(e^{b_n + \frac{1}{\sigma^2}\sum_i^M x_i w_{in}} + 1)^2}. \label{_auto108} \end{align} $$
We now have all the expressions neeeded to calculate the gradient of the expected local energy with respect to the RBM parameters \( \frac{\partial \langle E_L \rangle}{\partial \alpha_i} \).
If we use \( \Psi = \sqrt{F_{rbm}} \) we obtain $$ \begin{align} \frac{\partial}{\partial x_m} \ln\Psi &= - \frac{1}{2\sigma^2}(x_m - a_m) + \frac{1}{2\sigma^2} \sum_n^N \frac{w_{mn}}{e^{-b_n-\frac{1}{\sigma^2}\sum_i^M x_i w_{in}} + 1} \label{_auto109}\\ \frac{\partial^2}{\partial x_m^2} \ln\Psi &= - \frac{1}{2\sigma^2} + \frac{1}{2\sigma^4}\sum_n^N \omega_{mn}^2 \frac{e^{b_n + \frac{1}{\sigma^2}\sum_i^M x_i w_{in}}}{(e^{b_n + \frac{1}{\sigma^2}\sum_i^M x_i w_{in}} + 1)^2}. \label{_auto110} \end{align} $$ The difference between this equation and the previous one is that we multiply by a factor \( 1/2 \).
You can find the codes for the simple two-electron case at the Github repository https://github.com/CompPhysics/ComputationalPhysics2/tree/gh-pages/doc/Programs/BoltzmannMachines/MLcpp/src/CppCode/ob. Only c++ as of now. Python codes to come.


"...probably the best custom task around..."
XmlTask mailing list, November 2005
"...too essential to be left out of the Ant distribution..."
Ant User mailing list, August 2002
"Keep up the good work - xmltask is invaluable to our promotion process"
User comment, June 2003
xmltask provides the facility for automatically editing XML files as part of an Ant build. Unlike the standard filter
task provided with Ant, it is XML-sensitive, but doesn't require you to define XSLTs.
Uses include:
Read more about <xmltask> in the tutorial, previously published on java.net website.
See the CHANGES
file in the download for a comprehensive list of changes for each version
To use this task, make sure:
The xmltask.jar is in your $CLASSPATH
Reference the xmltask
in your build.xml
eg.
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
Reference the xmltask
task as part of your build eg.
<target name="main"> <xmltask source="input.xml" dest="output.xml"> ...
xmltask allows you to specify sections of an XML file to append to, replace, remove or modify. The sections of the XML document to be modified are specified by XPath references, and the XML to insert can be specified in-line in the Ant build.xml, or loaded from files.
The main <xmltask> section takes arguments to define an XML source and a destination file or directory. Note that the XML source is optional if you're creating a new document via <xmltask> instructions. dest
and todir
can be omitted if you're reading a document and storing subsections in buffers for use by another task (see below).
<fileset>s are used to define sets of files for xmltask
to operate on. See the standard Ant documentation for information on using filesets.
| Attribute | Description | Required |
|---|---|---|
| source | the source XML file to load. Can take the form of a wildcarded pattern eg. **/*.xml. Note that this capability will be deprecated in favour of <fileset> usage. | no |
| sourcebuffer | the source buffer containing XML from a previous <xmltask> invocation. The buffer must contain a single root node (i.e be well-formed). If the buffer is empty, then this has the effect of starting with a blank document. | no |
| sourceproperty | the source property containing XML. The property must contain a single root node (i.e be well-formed). If the property is empty, then this has the effect of starting with a blank document. | no |
| dest | the output XML file to write to | no |
| destbuffer | the output buffer to write to | no |
| todir | the output directory to write to | no |
| report | when set to true, will result in diagnostic output. | no |
| public | sets the PUBLIC identifier in the output XML DOCTYPE declaration. | no |
| expandEntityReferences | when set to true, will enable entity reference expansion. Defaults to true. NB! false is ignored due to a longstanding JRE bug. | no |
| system | sets the SYSTEM identifier in the output XML DOCTYPE declaration. | no |
| preservetype | when set to true sets the PUBLIC and SYSTEM identifiers to those of the original document. | no |
| failWithoutMatch | when set to true will stop the xmltask task (and hence the build process) if any subtask fails to match nodes using the given XPath path. |
no |
| indent | when set to true enables indented formatting of the resultant document. This defaults to true. | no |
| encoding | determines the character encoding value for the output document. | no |
| outputter | determines the output mechanism to be used. See formatting for more info. | no |
| omitHeader | when set to true forces omission of the <?xml...?> header. Note that the XML spec specifies the header SHOULD be included, but this is not mandated for XML v1.0 | no |
| standalone | when set to true/false sets the standalone attribute of the header. |
no |
| clearBuffers | Clears buffers after population by previous xmltask invocations. Buffers are cleared after every input file is processed. Buffers are specified in a comma-delimited string. |
no |
| defaultXpathFactory | Sets the XPathFactory implementation for Default Object Model URI. | no |
| xpathFactory | Sets the XPathFactory implementation for xpathObjectModelUri explicitly. If defaultXpathFactory is set, the latter takes precedence for Default Object Model URI as per specification. | no |
| xpathObjectModelUri | Sets the Object Model URI for XPathFactory implementation set by xpathFactory. If not set, implies that the latter is used for Default Object Model URI. | no |
e.g.
<xmltask source="input.xml" dest="output.xml">
reads from input.xml
and writes to output.xml
<xmltask todir="output"> <fileset dir="."> <includes name="*.xml"/>
reads from the XML files in the current dir and writes to the same filenames in the output
dir.
<xmltask sourcebuffer="servlet" output="servlet.xml">
reads from the previously populated buffer servlet
and writes to output.xml
<xmltask source="input.xml" destbuffer="output">
reads from a file input.xml
and writes to the buffer called output
.
append
attribute
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to cut | yes |
| buffer | the buffer to store the cut XML | no |
| property | the property to store the cut XML | no |
| append | when set to true , appends to the given buffer or property. You can only append when creating a new property since Ant properties are immutable (i.e. when an XPath resolves to multiple text nodes) |
no |
| attrValue | Cutting an attribute will result in the whole attribute plus value being cut. When attrValue is set to true then only the attribute's value is cut. This is implicit for cutting to properties |
no |
| trim | trims leading/trailing spaces when writing to properties | no |
| propertySeparator | defines the separating string when appending properties | no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<cut path="web/servlet/context/root[@id='2']/text()" buffer="namedBuffer"/> <cut path="web/servlet/context/root[@id='2']/text()" property="property1"/>
append
attribute
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to copy | yes |
| buffer | the buffer to store the copied XML | no |
| property | the property to store the copied XML | no |
| append | when set to true , appends to the given buffer or property. You can only append when creating a new property since Ant properties are immutable (i.e. when an XPath resolves to multiple text nodes) |
no |
| attrValue | Copying an attribute will result in the whole attribute plus value being cut. When attrValue is set to true then only the attribute's value is copied. This is now implicit for copying to properties |
no |
| propertySeparator | defines the separating string when appending properties | no |
| trim | trims leading/trailing spaces when writing to properties | no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<copy path="web/servlet/context/root[@id='2']/text()" buffer="namedBuffer"/> <copy path="web/servlet/context/root[@id='2']/text()" property="property1"/>
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to insert into | yes |
| buffer | the buffer to paste | no |
| file | the file to paste | no |
| xml | the literal XML to paste | no |
| expandProperties | indicates whether properties in body text XML are expanded or not. Defaults to true |
no |
| position | where the XML is to be inserted in relation to the XML highlighted by path . The allowed positions are before, after , or under . The default position is under . |
no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<insert path="/web/servlet/context/root[@attr='val']" xml="<B/>"/> <insert path="/web/servlet/context/root[@attr='val']" file="insert.xml"/> <insert path="/web/servlet/context/root[@attr='val']" buffer="namedBuffer" position="before"/> <insert path="/web/servlet/context/root[@attr='val']" xml="${property1}" position="before"/>
The XML to insert can be a document fragment - that is to say it doesn't require a root node. Examples of insertable XML include:
<welcome-file-list/>
(a well formed document)
<servlet-mapping id="1"/><servlet-mapping id="2"/>
(a well-formed document without a root node)
The XML to insert can be specified as body text within the <insert> task eg.
<insert path="web/servlet/context/root[@id='2']/text()"> <![CDATA[ <node/> ]]> </insert>
Note that the XML has to be specified within a CDATA
section. Ant properties are expanded within these sections, unless expandProperties
is set to false
You can create a new document by not specifying a source file, and making the first instruction for <xmltask> an <insert> or <paste> with the appropriate root node (and any subnodes).
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to replace. If this represents an attribute, then the value of the attribute will be changed. In this scenario you can only specify text as replacement | yes |
| withText | the text to insert in place of the nominated nodes | no |
| withXml | the literal XML to insert in place of the nominated nodes | no |
| withFile | the file containing XML to insert in place of the nominated nodes | no |
| withBuffer | the buffer containing XML to insert in place of the nominated nodes | no |
| expandProperties | indicates whether properties in body text XML are expanded or not. Defaults to true |
no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<replace path="web/servlet/context/root[@id='2']/text()" withText="2"/> <replace path="web/servlet/context/root[@id='2']/@id" withText="3"/> <replace path="web/servlet/context/root[@id='2']/text()" withXml="<id>"/> <replace path="web/servlet/context/root[@id='2']/" withFile="substitution.xml"/> <replace path="web/servlet/context/root[@id='2']/" withBuffer="namedBuffer"/>
(note that to include literal XML using withXml
, angle brackets have to be replaced with entities). The XML can be a well-formed document without any root node. The XML to insert can be specified as body text within the <replace> task eg.
<replace path="web/servlet/context/root[@id='2']/text()"> <![CDATA[ <node/> ]]> </replace>
Note that the XML has to be specified within a CDATA
section. Ant properties are expanded within these sections, unless expandProperties
is set to false
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to be changed | yes |
| attr | the name of the attribute to be added/changed or removed | yes |
| value | the value to set the attribute to | no |
| remove | if set to true , indicates that the nominated attribute should be removed |
no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<attr path="web/servlet/context[@id='4']/" attr="id" value="test"/> <attr path="web/servlet/context[@id='4']/" attr="id" remove="true"/>
Note that in the first example, if the attribute id
doesn't exist, it will be added.
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to be removed | yes |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<remove path="web/servlet/context[@id='redundant']"/>
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to be changed or copied | yes |
| pattern | The regular expression to apply to the text node or attribute value | yes |
| replace | The text to replace the matched expression with | no |
| property | The property to copy the matched expression into. A capturing group must be used to specify the text to capture | no |
| buffer | The buffer to copy the matched expression into. A capturing group must be used to specify the text to capture | no |
| casesensitive | Sets case sensitivity of the regular expression. Defaults to true | no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
The <regexp>
task uses the standard Java regular expression mechanism. Replacements can make use of capturing groups. When copying to a buffer or a property, a capturing group must be specified to determine the text to be copied.
e.g.
<regexp path="/web-app/servlet/servlet-name/text()" pattern="Test" replace="Prod"/> <regexp path="/web-app/servlet/servlet-name/text()" pattern="Servlet-([a-z])-([0-9]*)" replace="Servlet-$2-$1"/> <regexp path="/web-app/servlet/servlet-name/text()" pattern="(.*)Test" property="servlet.name"/> <regexp path="/web-app/servlet/servlet-name/text()" pattern="(.*)Test" buffer="servlet.name"/>
Note the use of the capturing groups to reverse components of the servlet's name, or to determine the servlet name substring to copy to a buffer or property.
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to be renamed | yes |
| to | the new node name | yes |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<rename path="a/b/c[@id='1']" to="d"/> <rename path="a/b/@c" to="d"/>
build.xml
file for nodes identified by an XPath.
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to be identified | yes |
| target | the Ant target to call for each identified node | no |
| buffer | the buffer to use to store each identified node (for the duration of the target call) | no |
| inheritAll | boolean indicating if the target being called inherits all properties. Defaults to true | no |
| inheritRefs | boolean indicating if the target being called inherits all references. Defaults to false | no |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g. in the below example, the Ant target CNode
is called for each occurrence of the C
node in the given XPath expression. For each call to CNode
the buffer abc
is populated with the node identified (plus any subnodes).
<call path="a/b/c" target="CNode" buffer="abc"/>
In the below example, Ant actions are embedded within the <call>
action (Ant 1.6 and above only):
<call path="a/b/c"> <actions> <echo>Found a node under a/b/c</echo> </actions> </call>
This mechanism can be used to drive Ant builds from existing XML resources such as web.xml
or struts.xml
, or to provide a meta-build
facility for Ant, by driving the build.xml
from a higher level proprietary XML config.
Properties can be set for the target being called using XPath syntax or simply as existing properties or static strings. eg.
<call path="a/b/c" target="CNode" buffer="abc"> <param name="val" path="text()"/> <param name="id" path="@id" default="n/a"/> <param name="os" value="${os.name}"/> </call>
will call the Ant target CNode
as above, but for each invocation, the property val is set to the value of the text node under C
, and the property id is set to the corresponding id attribute. If the id attribute is missing then "n/a" will be substituted. os is set to the OS.
The same can be done for embedded actions:
<call path="a/b/c"> <param name="val" path="text()"/> <param name="id" path="@id" default="n/a"/> <param name="os" value="${os.name}"/> <actions> <echo>val = @{val}</echo> <echo>id = @{id}</echo> </actions> </call>
Note how the parameters are dereferenced in this example (using @{...}). Note also that for embedded actions each property must have a value assigned to it. If in doubt use the default
attribute in the <param>
instruction.
| Attribute | Description | Required |
|---|---|---|
| path | the XPath reference of the element(s) to be identified | no |
| buffer | the buffer to print out | no |
| comment | a corresponding comment to print out | no |
e.g..
<print path="a/b/c" comment="Nodes matching a/b/c"/> <print buffer="buffer1" comment="Contents of buffer 1"/>
This instruction has no effect on the documents being scanned or generated.
xmltask
now supports the Ant 1.5 <xmlcatalog> element, which allows you to specify local copies of DTDs. This allows you to specify a DOCTYPE referred to in the original document, and the local DTD to use instead (useful if you're behind firewalls and the like).
e.g.
<xmlcatalog id="dtds"> <dtd publicId="-//OOPS Consultancy//DTD Test 1.0//EN" location="./local.dtd"/> </xmlcatalog> <xmltask source="18.xml" dest="18-out.xml" report="true"> <xmlcatalog refid="dtds"/> <!-- set a text element to a value --> ... </xmltask>
references a local copy of a DTD.
Alternatively, you can use the legacy <entity> element within <xmltask>, as below:
<entity remote="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" local="web.dtd"/> <entity remote="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" local=""/>
The first version above specifies a local version of the DTD. The second indicates that the remote entity will be ignored completely. Note that the remote
attribute can take either the PUBLIC specification or the SYSTEM specification.
uncomment
instruction allows you to uncomment sections of XML. This means you can maintain different XML fragments within one document and enable a subset. For instance you can maintain different configs and only enable one at deployment
| Attribute | Description | Required |
|---|---|---|
| path | the path of the comment to uncomment. This must resolve to a comment within the input document | yes |
| if | only performed if the given property is set | no |
| unless | performed unless the given property is set | no |
e.g.
<xmltask source="server.xml" dest="server.xml" report="true"> <!-- enables a servlet configuration --> <uncomment path="/server/service[@name='Tomcat-Standalone']/comment()"/> ... </xmltask>
<target name="main"> <xmltask source="input.xml" dest="output.xml public="//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" system="http://java.sun.com/j2ee/dtds/web-app_2_2.dtd" report="true"> <replace path="web/servlet/context/config[@id='1']/text()" withFile="config1.xml"/> <replace path="web/servlet/context/config[@id='2']/text()" withFile="config2.xml"/> <insert path="/web/security/" file="uat.security.xml"/> <remove path="web/servlet/context/config[@id='4']"/> </xmltask> </target>
Here the report
attribute is enabled to view the XML transformations as they occur. The input is loaded from input.xml
and the output will go to output.xml
. The files config1/2.xml
replace the text below the appropriate <config> nodes, the file security.xml
is inserted and then the config id #4 is removed. output.xml
will be output with the appropriate DOCTYPE
setting for a Servlet 2.2 web.xml
(using the public
/system
settings - note that if input.xml
has the public
and system
ids set already, preserveType="true"
could be used here).
Buffers are used to store nodes found by <cut> and <copy> operations, and those nodes can be inserted into a document using <insert> / <paste>.
Buffers exist for the duration of the Ant process and consequently can be used across multiple invocations of <xmltask>. eg. the following is possible:
<target name="cut"> <xmltask source="input.xml" dest="1.xml"> <cut path="web/servlet/context/config[@id='4']" buffer="storedXml"/> </xmltask> </target> <target name="paste" depends="cut"> <xmltask source="input.xml" dest="output.xml"> <paste path="web/servlet/context/config[@id='5'] buffer="storedXml"/> </xmltask> </target>
so the buffer storedXml is maintained across multiple targets.
Buffers are simply defined by names. eg. valid buffers would be servlet, buffer100 etc.
A buffer can record multiple nodes (either resulting from multiple matches or multiple <cut> / <copy> operations). This operation is enabled through use of the append
attribute. e.g.
<cut path="web/servlet/context/config" buffer="storedXml" append="true"/>
A buffer can store all types of XML nodes e.g. text / elements / attributes. Note that when recording an attribute node, both the name of the attribute and the value will be recorded. To store the value alone of an attribute, the attrValue
attribute can be used e.g.
<copy path="web/servlet/@id" buffer="id" attrValue="true"/>
This will store the value of the id
attribute. The value can be used as a text node in a subsequent <insert> / <paste>.
Buffers can be persisted to files. This permits buffers to be used across Ant invocations, and uses of <antcall>
. To persist a buffer to a file, simply name it using a file URL. e.g.
<cut path="/a/b" buffer="file://build/buffers/1"/>
and the operation will write the cut XML to a file build/buffers/1
. This file will persist after Ant exits, so care should be taken to remove this if required. The file will be created automatically, but any directories required must exist prior to the buffer being used.
The formatting of the output document is controlled by the attribute 'outputter'. There are three options:
<xmltask outputter="default"...>
outputs the document as is. That is to say, all whitespace etc. is preserved. This is the default option. Note that attribute ordering may change and elements containing attributes may be split over several lines etc. ie. the document remains the same semantically.
<xmltask outputter="simple"...>
outputs the document with a degree of formatting. Elements are indented and given new lines wherever possible to make a more readable document. This is not suitable for all applications since some XML consumers will be whitespace sensitive.
Spacing can be adjusted by using <xmltask outputter="simple:{indent}...">
. e.g. <xmltask outputter="simple:1"...>
results in:
<root> <branch/> </root>
The indent level can be increased: <xmltask outputter="simple:4"...>
results in:
<root> <branch/> </root>
<xmltask outputter="{classname}"...>
outputs the document using the nominated class as the outputting mechanism. This allows you to control the output of the document to your own tastes. The specified class must:
com.oopsconsultancy.xmltask.output.Outputter
interface.The custom class will be loaded and instantiated, then passed to a javax.xml.transform.sax.SAXResult object. Hence the outputter object will receive SAX events for each node in the resultant XML document. Note:
com.oopsconsultancy.xmltask.output.Outputter
extends org.xml.sax.ContentHandler
, so the appropriate SAX methods need to be implemented.CDATA
sections etc. If you want to receive these events, then you also need to implement the org.xml.sax.ext.LexicalHandler
interface as well.setWriter()
A simple introduction is to look at the com.oopsconsultancy.xmltask.output.FormattedDataWriter
source code (in the source tarball).
Some examples of common usage:
<copy path="/xhtml/head/title/text()" buffer="title"/>
<copy path="/xhtml/head/title/text()" property="title"/>
web.xml
. Note how this occurs only if the property insert.reqd
is set:
<insert if="insert.reqd" path="/web-xml/servlet[last()]" position="after" file="newservlet.xml"/>
web.xml
(another way - note properties usage):
<insert path="/web-xml/servlet[last()]" position="after"> <![CDATA[ <servlet>` <servlet-name> ${project.name} </servlet-name> </servlet> ]]> </insert>
<replace path="//div[@id='changeMe']/text()" withText="new text"/>
<attr path="//div[@id='1']" attr="id" value="2"/>
<replace path="//div[@id='1']/@id" withText="2"/>
<remove path="//div[@id='1']/@id"/>
<attr path="//div[@id='1']" attr="id" remove="true"/>
<copy path="//div[@id='1']/@id" attrValue="true" buffer="bufferName"/>
<copy path="//div[@id='1']/@id" property="propertyName"/>
a, b
and c
prior to appending. Buffer b
contains all the div
elements for each input file:
<xmltask clearBuffers="a,b,c"> <fileset dir="."> <includes name="*.xml"/> </fileset> <copy path="//div" buffer="b" append="true"/> ...
<remove path="//child::comment()"/>
web.xml
:
<xmltask source="web.xml" dest="release/web.xml" public="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" system="http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> ...
OR
<xmltask source="web.xml" dest="release/web.xml" preserveType="true"> ...
if you're transforming an existing web.xml
.
<xmltask source="web.xml" dest="release/web.xml" encoding="Shift-JIS"> ...
<rename path="//ul" to="ol"/>
<xmltask dest="release/web.xml"> <insert path="/"> <![CDATA[ <root/> ]]> </insert> ...
<xmltask source="multiple.xml"> <copy path="count(/servlet)" property="count"/> ...
node
element which is tied to a namespace via an xmlns
directive. See this XML.com article for namespace-related issues.
<xmltask source="input.xml"> <copy path="//*[local-name()='node']" property="count"/> ...
web.xml
. For each invocation the servletDef
buffer contains the complete servlet specification from the deployment file, and the property id contains the servlet id (if there is no id attribute then NO ID will be substituted). The servletDef
buffer can be used in succeeding xmltask
invocations.
<xmltask source="web.xml"> <call path="web/servlet" target="deploy" buffer="servletDef"> <param name="id" path="@id" default="NO ID"/> </call> </xmltask>
web.xml
. For each invocation the embedded actions are performed (Ant 1.6 and above only).
<xmltask source="web.xml"> <call path="web/servlet"> <param name="id" path="@id" default="NO ID"/> <actions> <echo>Found a servlet @{id}</echo> <!-- perform deployment actions --> .... </actions> </call> </xmltask>
tomcat-users.xml
file. The users are set up in the first 2 comments
<xmltask source="tomcat-users.xml"> <uncomment path="tomcat-users/comment()[1]"/> <uncomment path="tomcat-users/comment()[2]"/> </xmltask>
<xmltask source="input.xml"> <cut path="web/servlet[@id='1']" buffer="servlet"/> <print buffer="servlet" comment="Copied to 'servlet' buffer"/> ...
buffers/servlet
) for later use
<xmltask source="input.xml"> <cut path="web/servlet[@id='1']" buffer="file://build/buffers/servlet"/> ...
The Java 1.4.2 release as of June 2003 has tightened up XPath parsing and what is regarded as acceptable XPath syntax. In particular, the following usage of trailing path separators is now regarded as incorrect:
/root/branch/
and should be replaced with
/root/branch
Some of the xmltask
examples and documentation have used the incorrect syntax. This is now rectified.
The XPath spec can be found here
An excellent XPath tutorial can be found here
Hints and tips on XPath can be found at O'Reilly's XML web site
Many Xpath issues relate to namespace matching. This XML.com article offers an excellent discussion of the issues.
The following books are invaluable for XPath issues:
| XPath and XPointer by John E. Simpson | XSLT by Doug Tidwell. Contains useful XPath information |
xmltask is written by OOPS Consultancy Ltd..
Copyright © 1997-2006 OOPS Consultancy Ltd


MSRP STARTING
AT $37,995
The look. The feel. Each line tailored to you like a fine suit. With every component designed to thrill. From glistening sheet metal and precise engineering to exceptional handling and intuitive next-generation technology, ATS stokes the passion of the real driver. So sit back and put the pedal to the metal, because the ATS Coupe was born to go.
Shop
MSRP STARTING
AT $33,215
Success isn’t measured by could’ve or should’ve. It’s measured by been there and done that. The nimble handling of the ATS celebrates where you’ve been, while its sophisticated nature hints at where you’re going. Precise. Exact. Exhilarating. This is the new ATS Sedan.
Shop
MSRP STARTING
AT $37,995
The look. The feel. Each line tailored to you like a fine suit. With every component designed to thrill. From glistening sheet metal and precise engineering to exceptional handling and intuitive next-generation technology, ATS stokes the passion of the real driver. So sit back and put the pedal to the metal, because the ATS Coupe was born to go.
Shop
MSRP STARTING
AT $33,215
Success isn’t measured by could’ve or should’ve. It’s measured by been there and done that. The nimble handling of the ATS celebrates where you’ve been, while its sophisticated nature hints at where you’re going. Precise. Exact. Exhilarating. This is the new ATS Sedan.
Shop
MSRP STARTING
AT $37,995
The look. The feel. Each line tailored to you like a fine suit. With every component designed to thrill. From glistening sheet metal and precise engineering to exceptional handling and intuitive next-generation technology, ATS stokes the passion of the real driver. So sit back and put the pedal to the metal, because the ATS Coupe was born to go.
Shop
MSRP STARTING
AT $33,215
Success isn’t measured by could’ve or should’ve. It’s measured by been there and done that. The nimble handling of the ATS celebrates where you’ve been, while its sophisticated nature hints at where you’re going. Precise. Exact. Exhilarating. This is the new ATS Sedan.
Shop


THE BELIEVERS
A film review by Hal Render
Copyright 1987 Hal Render
I just saw THE BELIEVERS last night. Overall impression: pretty scary. The film details the involvement of a police psychiatrist (Martin Sheen) in a string of grisly crimes which involve an ancient Caribbean religion. The pace escalates as Sheen's family become threatened, and the power of the forces against him become overwhelming. The actors are excellent (Sheen, Helen Shaver and Robert Loggia head the cast), the plot and direction are strong, and the story is quite compelling. My only complaint is the apparent cuts they made in the original story (from a book called THE RELIGION) which show up as incongruous elements in the movie. Several small things (and a few large ones) seem to be stressed in the early parts of the movie which turn out to have no real impact at the end. This could just be a case of intended misdirection, although I'll have to read the book to be sure. As for gore, the movie is discreet by current standards (some mutilated animals), though there is one scene which got to me even though I saw it coming. Definitely not for young kids. If you liked ANGEL HEART, you should like THE BELIEVERS. A +2.5 on a -4/+4 rating.
Hal Render
<EMAIL_ADDRESS>(ARPA)
<EMAIL_ADDRESS>(CSNET)
{seismo,pur-ee}!uiucdcs!render (USENET)
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Preparation time
overnight
Cooking time
10 to 30 mins
Serves
Serves 4
Juicy chicken fried in crunchy breadcrumbs served with richly flavoured, roasted tomatoes.
Preheat the oven to 150C/300F/Gas 1.
Place the tomatoes, cut side up onto a roasting tray and drizzle with the olive oil.
Season with salt and black pepper then scatter half the thyme leaves over the top.
Place in the oven and roast for 4-6 hours until slightly dried out. Turn the oven off and allow to cool, preferably overnight in the oven.
For the chicken, place the breadcrumbs, parmesan, lemon zest and remaining thyme leaves into a food processor and blitz to fine crumbs.
Butterfly the chicken breasts (Place the chicken onto what would have been the skin side, then cut down the centre line to half the way through. Turn the knife sideways and cut horizontally almost to the side of the breast to open it out, then repeat with the other side so you have a chicken breast, twice the size it was and half the thickness.)
Season the flour with salt and black pepper then dust the chicken in the flour.
Dip into the egg then into the breadcrumbs, making sure to coat each side thoroughly.
Heat the olive oil and the butter in a large frying pan then add the chicken breasts, one at a time, and fry until golden-brown, about two minutes on each side. Place onto kitchen paper to drain.
To serve, pile some tomatoes onto the plate, add the chicken and a handful of watercress then finish with a wedge of lemon.


Version 0.9 (2015-05-22)#
Changelog#
Add support for mayavi figures in
add_section
method in Report by Mainak JasAdd extract volumes of interest from freesurfer segmentation and setup as volume source space by Alan Leggitt
Add support to combine source spaces of different types by Alan Leggitt
Add support for source estimate for mixed source spaces by Alan Leggitt
Add
SourceSpaces.save_as_volume
method by Alan LeggittAutomatically compute proper box sizes when generating layouts on the fly by Marijn van Vliet
Average evoked topographies across time points by Denis Engemann
Add option to Report class to save images as vector graphics (SVG) by Denis Engemann
Add events count to
mne.viz.plot_events
by Denis EngemannAdd support for stereotactic EEG (sEEG) channel type by Marmaduke Woodman
Add support for montage files by Denis Engemann, Marijn van Vliet, Jona Sassenhagen, Alex Gramfort and Teon Brooks
Add support for spatiotemporal permutation clustering on sensors by Denis Engemann
Add support for multitaper time-frequency analysis by Hari Bharadwaj
Add Stockwell (S) transform for time-frequency representations by Denis Engemann and Alex Gramfort
Add reading and writing support for time frequency data (AverageTFR objects) by Denis Engemann
Add reading and writing support for digitizer data, and function for adding dig points to info by Teon Brooks
Add
plot_projs_topomap
method toRaw
,Epochs
andEvoked
objects by Teon BrooksAdd EEG (based on spherical splines) and MEG (based on field interpolation) bad channel interpolation method to
Raw
,Epochs
andEvoked
objects by Denis Engemann and Mainak JasAdd parameter to
whiten_evoked
,compute_whitener
andprepare_noise_cov
to set the exact rank by Martin Luessi and Denis EngemannAdd fiff I/O for processing history and MaxFilter info by Denis Engemann and Eric Larson
Add automated regularization with support for multiple sensor types to
compute_covariance
by Denis Engemann and Alex GramfortAdd
Evoked.plot_white
method to diagnose the quality of the estimated noise covariance and its impact on spatial whitening by Denis Engemann and Alex GramfortAdd
mne.evoked.grand_average
function to compute grand average of Evoked data while interpolating bad EEG channels if necessary by Mads Jensen and Alex GramfortImprove EEG referencing support and add support for bipolar referencing by Marijn van Vliet and Alex Gramfort
Enable TFR calculation on Evoked objects by Eric Larson
Add support for combining Evoked datasets with arbitrary weights (e.g., for oddball paradigms) by Eric Larson and Alex Gramfort
Add support for concatenating a list of Epochs objects by Denis Engemann
Labels support subtraction (
label_1 - label_2
) by Christian BrodbeckAdd GeneralizationAcrossTime object with support for cross-condition generalization by Jean-Remi King and Denis Engemann
Add support for single dipole fitting by Eric Larson
Add support for spherical models in forward calculations by Eric Larson
Add support for SNR estimation by Eric Larson
Add support for Savitsky-Golay filtering of Evoked and Epochs by Eric Larson
Add support for adding an empty reference channel to data by Teon Brooks
Add reader function
mne.io.read_raw_fif
for Raw FIF files by Teon BrooksAdd example of creating MNE objects from arbitrary data and NEO files by Jaakko Leppakangas
Add
plot_psd
andplot_psd_topomap
methods to epochs by Yousra Bekhti, Eric Larson and Denis Engemannevoked.pick_types
,epochs.pick_types
, andtfr.pick_types
added by Eric Larsonrename_channels
andset_channel_types
added as methods toRaw
,Epochs
andEvoked
objects by Teon BrooksAdd RAP-MUSIC inverse method by Yousra Bekhti and Alex Gramfort
Add
evoked.as_type
to allow remapping data in MEG channels to virtual magnetometer or gradiometer channels by Mainak JasAdd
mne.Report.add_bem_to_section
,mne.Report.add_htmls_to_section
methods tomne.Report
by Teon BrooksAdd support for KIT epochs files with
read_epochs_kit
by Teon BrooksAdd whitening plots for evokeds to
mne.Report
by Mainak JasAdd
DigMontage
class and reader to interface with digitization info by Teon Brooks and Christian BrodbeckAdd
set_montage
method to theRaw
,Epochs
, andEvoked
objects by Teon Brooks and Denis EngemannAdd support for capturing sensor positions when clicking on an image by Chris Holdgraf
Add support for custom sensor positions when creating Layout objects by Chris Holdgraf
BUG#
Fix energy conservation for STFT with tight frames by Daniel Strohmeier
Fix incorrect data matrix when tfr was plotted with parameters
tmin
,tmax
,fmin
andfmax
by Mainak JasFix channel names in topomaps by Alex Gramfort
Fix mapping of
l_trans_bandwidth
(to low frequency) andh_trans_bandwidth
(to high frequency) in_BaseRaw.filter
by Denis EngemannFix scaling source spaces when distances have to be recomputed by Christian Brodbeck
Fix repeated samples in client to FieldTrip buffer by Mainak Jas and Federico Raimondo
Fix highpass and lowpass units read from Brainvision vhdr files by Alex Gramfort
Add missing attributes for BrainVision and KIT systems needed for resample by Teon Brooks
Fix file extensions of SSP projection files written by mne commands (from _proj.fif to -prof.fif) by Alex Gramfort
Generating EEG layouts no longer requires digitization points by Marijn van Vliet
Add missing attributes to BTI, KIT, and BrainVision by Eric Larson
The API change to the edf, brainvision, and egi break backwards compatibility for when importing eeg data by Teon Brooks
Fix bug in
mne.viz.plot_topo
if ylim was passed for single sensor layouts by Denis EngemannAverage reference projections will no longer by automatically added after applying a custom EEG reference by Marijn van Vliet
Fix picks argument to filter in n dimensions (affects FilterEstimator), and highpass filter in FilterEstimator by Mainak Jas
Fix beamformer code LCMV/DICS for CTF data with reference channels by Denis Engemann and Alex Gramfort
Fix scalings for bad EEG channels in
mne.viz.plot_topo
by Marijn van VlietFix EGI reading when no events are present by Federico Raimondo
Add functionality to determine plot limits automatically or by data percentiles by Mark Wronkiewicz
Fix bug in mne.io.edf where the channel offsets were omitted in the voltage calculations by Teon Brooks
Decouple section ordering in command-line from python interface for mne-report by Mainak Jas
Fix bug with ICA resetting by Denis Engemann
API#
apply_inverse functions have a new boolean parameter
prepared
which saves computation time by callingprepare_inverse_operator
only if it is Falsefind_events and read_events functions have a new parameter
mask
to set some bits to a don’t care state by Teon BrooksNew channels module including layouts, electrode montages, and neighbor definitions of sensors which deprecates
mne.layouts
by Denis Engemannread_raw_brainvision
,read_raw_edf
,read_raw_egi
all use a standard montage import by Teon BrooksFix missing calibration factors for
mne.io.egi.read_raw_egi
by Denis Engemann and Federico RaimondoAllow multiple filename patterns as a list (e.g., *raw.fif and *-eve.fif) to be parsed by mne report in
Report.parse_folder()
by Mainak Jasread_hsp
,read_elp
, andwrite_hsp
,write_mrk
were removed and made private by Teon BrooksWhen computing the noise covariance or MNE inverse solutions, the rank is estimated empirically using more sensitive thresholds, which stabilizes results by Denis Engemann and Eric Larson and Alex Gramfort
Raw FIFF files can be preloaded after class instantiation using
raw.preload_data()
Add
label
parameter toapply_inverse
by Teon BrooksDeprecated
label_time_courses
forin_label
method inSourceEstimate
by Teon BrooksDeprecated
as_data_frame
forto_data_frame
by Chris HoldgrafAdd
transform
,unit
parameters toread_montage
by Teon BrooksDeprecated
fmin, fmid, fmax
in stc.plot and addedclim
by Mark WronkiewiczUse
scipy.signal.welch
instead of matplotlib.psd insidecompute_raw_psd
andcompute_epochs_psd
by Yousra Bekhti Eric Larson and Denis Engemann. As a consequence,Raw.plot_raw_psds
has been deprecated.Raw
instances returned bymne.forward.apply_forward_raw
now always have times starting from zero to be consistent with all otherRaw
instances. To get the formerstart
andstop
times, useraw.first_samp / raw.info['sfreq']
andraw.last_samp / raw.info['sfreq']
.pick_types_evoked
has been deprecated in favor ofevoked.pick_types
.Deprecated changing the sensor type of channels in
rename_channels
by Teon BrooksCUDA is no longer initialized at module import, but only when first used.
add_figs_to_section
andadd_images_to_section
now have atextbox
parameter to add comments to the image by Teon BrooksDeprecated
iir_filter_raw
forfit_iir_model_raw
.Add
montage
parameter to thecreate_info
function to create the info using montages by Teon Brooks


Workout Programming Methodology
The idea behind this application is to automate workout programming. With that, there is some advanced logic built into the software when programming the workout. This article will shed light on that logic and give you a clearer picture of how these workouts are generated.
What is the point of doing anything that isn't functional? If you were a pilot, would you only fly your simulator with sunny, blue skies? If you were a police office, would you only practice your driving on dry roads? The answer is no. You have to prepare yourself for any potential scenario.
The aim of this app is to program workouts that will increase the user's work capacity. We do this through constantly varying the workouts, include functional movements in those workouts, and execute at high intensity. Let's break each of these down.
A workout can be varied in a variety of ways. A few exampled of how you can vary a workout include:
- movements in the workout
- time
- workout length
- rest length
- weight
- rest
- equipment
- environment
- temperature
- elevation
- terrain
- wearable gear (i.e. flak vest, firefighting equipment)
- time of day
- training frequency
This app will vary a workout
Nearly every exercise generated will include what we consider a functional movement. For the purposes of this application a functional movement is any movement in which the user moves a quickly moves a large load over a long distance. The main functional movements incorporated in Forgd exercises include:
- deadlifts
- squats
- cleans
- snatches
- thrusters
- presses
Intensity is relative to the individual. A 25 year old athlete might find 225x20 back squats intense while a 60 year old de-conditioned individual will find air squats intense. So how do you measure intensity? If you're not gasping for air at the end of these workouts, you aren't doing something right.
There are several different workout types you can choose from when forging your workout.
- single modality (singlet)
- couplet
- triplet
- chipper


ZooTerrain Insights into running ZooKeeper clusters
Browser -> ZooTerrain
ZooTerrain -> Zookeeper
| znode ? | data length | data version |
| No znode entries. |


Topic readme.md
DISCLAIMER: This module is not yet complete. It may change dramatically between now and release.
Description
luabnet is a Lua library for retrieving data from Blizzard Entertainment's Battle.net Community Platform API.
This module implements functions to retrieve data from the WoW section of the API.
Installation and Dependencies
To install the module, use luarocks install luabnet_wow
or copy the contents of the lua
directory to your package.path .
Some dependencies must be installed manually. For more information, please see the Dependencies section of the luabnettools README here: https://github.com/Choonster/luabnettools#dependencies


|
SF_UART_SP21
|
Contains all I2C driver functions. More...
#include "i2c.h"
#include "em_i2c.h"
#include "em_cmu.h"
Enumerations | |
| enum | DEFINED_STATES { Start_CMD , Read_CMD , Wait_Read , End_Sense , Stop , EN_TX , TX_DATA , END_TX } |
Functions | |
| void | i2c_open (I2C_TypeDef *i2c, I2C_OPEN_STRUCT *i2c_setup) |
| Initiates the I2C system. More... | |
| void | I2C0_IRQHandler (void) |
| The IRQ handler for I2C0. More... | |
| void | I2C1_IRQHandler (void) |
| The IRQ handler for I2C0. More... | |
| void | i2c_start (I2C_TypeDef *i2c, uint32_t target_addr, uint32_t target_reg, bool w_r, uint32_t *data_addr, uint32_t bytes, uint32_t cb) |
| The function to set up the state machine. More... | |
Variables | |
| I2C_STATE_MACHINE | i2c_state |
Contains all I2C driver functions.
| void I2C0_IRQHandler | ( | void | ) |
The IRQ handler for I2C0.
This function is automatically called and then calls the individual interrupt functions above based on the current IF register status.
| void I2C1_IRQHandler | ( | void | ) |
The IRQ handler for I2C0.
This function is automatically called and then calls the individual interrupt functions above based on the current IF register status.
| void i2c_open | ( | I2C_TypeDef * | i2c, |
| I2C_OPEN_STRUCT * | i2c_setup | ||
| ) |
Initiates the I2C system.
This function mirrors the letimer_pwm_open function, setting up the I2C TypeDef default structure and its interrupt routine structures.
| [in] | i2c | The I2C system currently being used. |
| [in] | i2c_setup | The open struct that will have its data values modified, initiated outside of this function. |
| void i2c_start | ( | I2C_TypeDef * | i2c, |
| uint32_t | target_addr, | ||
| uint32_t | target_reg, | ||
| bool | w_r, | ||
| uint32_t * | data_addr, | ||
| uint32_t | bytes, | ||
| uint32_t | cb | ||
| ) |
The function to set up the state machine.
This function pulls in values from the SI setup function and creates the state machine structure.
| [in] | i2c | The I2C system currently being used. |
| [in] | target_addr | The I2C address of the desired peripheral. |
| [in] | target_reg | The command to be sent to the peripheral. |
| [in] | w_r | Bool for read/write. |
| [in] | data_addr | The address of where the read data should be stored. |
| [in] | bytes | The number of bytes expected to be read from the peripheral. |
| [in] | cb | The callback number for the scheduler. |


--- layout: post date: 2010-05-13 time: "11:00:00" authors: ["Greg Wilson"] title: "Day 9: Programming" tags: ["Content"] ---
Our first screencast showing a bit of Python programming is now up for comments. [Link no longer active, more recent link to screencast on dictionaries.] It's deliberately low-tech: we used Emacs as an editor, and simply showed the program's textual output instead of stepping through it with a debugger. (Our next programming lectures will be IDE-based for comparison.) Please tell us what you think about the pace, watchability, etc.


presents
Murakami Kenji (Japan)
800 YA! (YA-O-YA)
Videotape, 3 minutes, 1994
Prize Winner at the Video Poem Contest (VIPO) 1995
Two In The Dark
Videotape, 2 minutes 30 seconds, 1995
Woman In Trouble
Videotape, 2 minutes, 1995
TEL-CLUB
(Born In The Summer)
Videotape, 76 minutes, 1998
Special Jury Prize at the Image Forum Festival 1999
In the summer of 1998, the filmmaker went home to Takasaki to film the birth of his brother and sister-in-law's child. Days went by without anything happening and so with time on his hands and no-one to talk to, he goes to a telephone dating agency where he sits in a room and waits for women to call him and chat. Earnestly wanting to talk with someone, he eventually manages to meet up with a girl who leads him astray.
Murakami Kenji was born in 1970, graduated from Image Forum and has made several 8mm films as well as recent video work. His film, Bye-Bye Original Color won an Honorable Mention at the Image Forum Festival 1995 and TEL-CLUB recently won the Grand Prize at the Yubari Fantastic Adventure Film Festival 1999 (Off Theatre Competition).
Sam Easterson (USA)
A Sheep In Wolf's Clothing
Videotape, 4:30 minutes, 1998
Sheep are equipped with helmet mounted cameras to explore a unique vision of the pastures. The pack turn on their altered brethren and precipitate in a stampede in which the cameras are all but destroyed.
Blow Out
Videotape, 4 minutes, 1995
A camera is attached onto the top of a hot air popcorn popper, showing us the world from the perspective of the machine as the kernels are ejected in an abstract dance. Demonstrating an obvious beginning, middle and end, our popcorn-protagonists go through the substantive transformation required of any Aristotelian narrative, emerging from the machine the same, yet different. The dramatic conclusion as the lens of the camera cracks from the heat of the machine makes us aware of the camera, and in doing so, humorously subverts the serious monumentality of structuralism. (Taken from programme notes by Douglas Fogle, Exhibition Curator at the Walker Art Centre)
Untitled (Take Apart)
Videotape, 40 minutes, 1994
The camera records its destruction.
Sam Easterson is a Minneapolis-based artist who transforms his video cameras into hybrid viewing machines that record the unseen in everyday life. In his videos, static objects become stage players in their own 'ballets mechaniques'. His work has been shown in Europe, Canada and the USA and most recently at the Impakt Festival, Holland and the Franconia Sculpture Park, Minnesota.
Saturday July 24th, 7pm, Gallery Yu
Saga City
Japan


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.rview.CacheInfoEntry
Contains information about the runtime state of one cache in the system.
| Field Summary | |
static java.lang.String |
CLASS_VERSION
|
| Constructor Summary | |
CacheInfoEntry()
|
| Method Summary | |
abstract int |
getAccessCount()
Returns the number of times the cache was accessed |
abstract int |
getBytesUsed()
Returns the number of bytes currently held by cache entries. |
abstract int |
getCacheInvalidationCount()
Returns the number of times the cache was entirely invalidated |
abstract java.lang.String[] |
getDependentTables()
Returns the list of table names upon which this cache depends. |
abstract int |
getEntryCount()
Returns the number of entries in the cache. |
abstract int |
getEntryInvalidationCount()
Returns the number of times a cache entry was invalidated |
abstract int |
getGroupCount()
Returns the number of entry groups in the cache, where each group comprises entries that have a common key prefix. |
abstract int |
getGroupEntryCount()
Returns the total number of entries in all of the entry groups. |
abstract int |
getHitCount()
Returns the number of accesses that were cache hits |
abstract java.lang.String[] |
getKeyProperties()
Returns the list of property names that make up the keys for the cache entries. |
abstract java.lang.Object[][] |
getKeys()
Returns the keys of all the entries in the cache. |
abstract int |
getMissCount()
Returns the number of accesses that were cache misses |
abstract java.lang.String |
getName()
Returns the name of the cache |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.lang.String CLASS_VERSION
| Constructor Detail |
public CacheInfoEntry()
| Method Detail |
public abstract java.lang.String getName()
public abstract int getEntryCount()
public abstract int getGroupCount()
public abstract int getGroupEntryCount()
public abstract int getBytesUsed()
public abstract int getAccessCount()
public abstract int getHitCount()
public abstract int getMissCount()
public abstract int getCacheInvalidationCount()
public abstract int getEntryInvalidationCount()
public abstract java.lang.String[] getDependentTables()
public abstract java.lang.String[] getKeyProperties()
public abstract java.lang.Object[][] getKeys()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


{% extends 'gallery/base.html' %} {% load static %} {% block content %} {%if edit %}
{{space_name}}
Name for a Hub Space - area where people can share their work.


The virtual MIC-Phy will be happening here!
| Home |
|---|
| Program |
| Workshop |
| Registration |
| Scientific committee |
| Organizing committee |
| Contacts |
| Sponsors |
Will be updated soon!
Monday, 15th February, 2021
| Time | Event |
|---|---|
| 10:00-12:00 | Event 1 |
Tuesday, 16th February, 2021
| Time | Event |
|---|---|
| 10:00-12:00 | Event 2 |
Wednesday, 17th February, 2021
| Time | Event |
|---|---|
| 10:00-12:00 | Event 3 |


OData (Open Data Protocol) is an OASIS standard that defines a set of best practices for building and consuming RESTful APIs. OData helps you focus on your business logic while building RESTful APIs without having to worry about the various approaches to define request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats, query options, etc. OData also provides guidance for tracking changes, defining functions/actions for reusable procedures, and sending asynchronous/batch requests.
OData RESTful APIs are easy to consume. The OData metadata, a machine-readable description of the data model of the APIs, enables the creation of powerful generic client proxies and tools.
My latest thoughts about Open data initiatives in Latvia and around the globe.
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.