Sınırlı Boltzmann Makinesinin Arkasındaki Sezgi (RBM)


15

Geoff Hinton'un Coursera'daki Sinir Ağları kursuna katıldım ve aynı zamanda sınırlı boltzmann makinelerine giriş yaptım, yine de RBM'lerin arkasındaki sezgiyi anlamadım.

Neden bu makinedeki enerjiyi hesaplamamız gerekiyor? Ve bu makinedeki olasılığın kullanımı nedir? Bu videoyu da gördüm . Videoda, hesaplama adımlarından önce olasılık ve enerji denklemlerini yazdı ve hiçbir yerde kullanmıyor gibi görünüyordu.

Yukarıdakilere ek olarak, olasılık fonksiyonunun ne için olduğundan emin değilim?


Soruyu düzeltmeye çalıştım, ama bence daha fazla iş gerekiyor. Sen ne olduğunu açıklamak gerekir do aksi soru çok geniştir, takılıp nerede daha spesifik anlamak ve.
Neil Slater

Kafaya giren tek şey, önce pozitif faz, ardından ağırlıkların yeniden inşası ile takip edilen negatif faz olmak üzere üç adım vardır. Peki ya enerjiler ve olasılık fonksiyonu? buradaki fayda nedir? ve bu işlemi kaç kez yapmak zorundayız (pozitif faz -> negatif faz> ağırlıkların yeniden inşası)?
Born2Code

Yanıtlar:


5

RBM'ler ilginç bir canavar. Sorunuzu cevaplamak ve hafızamı onlara aktarmak için, RBM'leri türeteceğim ve türev yoluyla konuşacağım. Olasılık konusunda kafanız karıştığından bahsettiniz, bu yüzden türetim, olasılığı en üst düzeye çıkarmaya çalışmak açısından olacaktır. Öyleyse başlayalım.

RBM'ler görünür ve gizli iki farklı nöron seti içerir, bunları sırasıyla ve h olarak göstereceğim . V ve h'nin belirli bir yapılandırması göz önüne alındığında , olasılık uzayını eşleriz.vhvh

p(v,h)=eE(v,h)Z

Tanımlanacak birkaç şey daha var. Belirli bir konfigürasyondan olasılık uzayına eşlemek için kullandığımız vekil fonksiyona enerji fonksiyonu denir . Z sabiti aslında olasılık boşluğa eşleme emin olmak için bir normalizasyon faktördür. Şimdi gerçekten aradığımız şeye bakalım; bir dizi görünür nöron olasılığı, başka bir deyişle, verilerimizin olasılığı. Z = v V h H e - E ( v , h ) p ( v )E(v,h)Z

Z=vVhHeE(v,h)
p(v)=hHp(v,h)=hHeE(v,h)vVhHeE(v,h)

Bu denklemde çok fazla terim olmasına rağmen, basitçe doğru olasılık denklemlerini yazmaya gelir. Umarım, şimdiye kadar, bu, olasılığı hesaplamak için neden enerji fonksiyonuna ihtiyacımız olduğunu veya daha genel olarak normal olmayan olasılık p'nin ne yapıldığını anlamanıza yardımcı oldu.. Normal olmayan olasılık kullanılır çünkü Z bölme fonksiyonununhesaplanması çok pahalıdır.p(v)ZZ

Şimdi RBM'lerin gerçek öğrenme aşamasına geçelim. Olasılığı en üst düzeye çıkarmak için, her veri noktası için yapmak için gradyan adımı atmamız gerekir . Degrade ifadeleri almak için bazı matematiksel akrobasi gerekir. İlk yaptığımız şey p ( v ) kütüğünü almak . Matematiği mümkün kılmak için bundan sonra log olasılık alanında faaliyet göstereceğiz.p(v)=1p(v)

Gradyanı p ( v ) ' deki paremetreler

log(p(v))=log[hHeE(v,h)]log[vVhHeE(v,h)]
p(v)

log(p(v))θ=1hHeE(v,h)hHeE(v,h)E(v,h)θ+1vVhHeE(v,h)vVhHeE(v,h)E(v,h)θ

Şimdi bunu kağıt üzerinde yaptım ve yarı final denklemini bu sitede çok fazla yer kaybetmeyecek şekilde yazdım. Bu denklemleri kendiniz türetmenizi tavsiye ederim. Şimdi, türevimizi devam ettirmemize yardımcı olacak bazı denklemler yazacağım. Unutmayın: , p ( v ) = h H p ( v , h ) ve bu p ( h | v ) =Zp(v,h)=eE(v,h)p(v)=hHp(v,h)p(h|v)=p(v,h)p(h)

log(p(v))θ=1p(v)hHp(v,h)E(v,h)θ+vVhHp(v,h)E(v,h)θlog(p(v))θ=hHp(h|v)E(v,h)θ+vVhHp(v,h)E(v,h)θ

And there we go, we derived maximum likelihood estimation for RBM's, if you want you can write the last two terms via expectation of their respective terms (conditional, and joint probability).

Notes on energy function and stochasticity of neurons.

E(v,h)=aTvbThvTWh.

It might be easier to reason about the gradient terms above via the expectation form.

log(p(v))θ=Ep(h|v)E(v,h)θ+Ep(v,h)E(v,h)θ

The expectation of the first term is actually really easy to calculate, and that was the genius behind RBMs. By restricting the connection the conditional expectation simply becomes a forward propagation of the RBM with the visible units clamped. This is the so called wake phase in Boltzmann machines. Now calculating the second term is much harder and usually Monte Carlo methods are utilized to do so. Writing the gradient via average of Monte Carlo runs:

log(p(v))θE(v,h)θp(h|v)+E(v,h)θp(v,h)

Calculating the first term is not hard, as stated above, therefore Monte-Carlo is done over the second term. Monte Carlo methods use random successive sampling of the distribution, to calculate the expectation (sum or integral). Now this random sampling in classical RBM's is defined as setting a unit to be either 0 or 1 based on its probability stochasticly, in other words, get a random uniform number, if it is less than the neurons probability set it to 1, if it is greater than set it to 0.


How do we make hidden layer binary too? Bcoz after the activation function operation, we would be getting values in the range between 0 and 1.
Born2Code

This is usually done by thresholding the activation. Anything above 0.5, would become 1, anything below would be zero.
Armen Aghajanyan

But in this link , in section 3.1: Hinton has stated "the hidden unit turns on if this probability is greater than a random number uniformly distributed between 0 and 1". What does this actually mean? And also in this link, they say "Then the jth unit is on if upon choosing s uniformly distributed random number between 0 and 1 we find that its value is less than sig[j]. Otherwise it is off." I didn't get this.
Born2Code

????? How to say whether that particular unit is turned on or off?
Born2Code

I've added an edit. I suggest reading up on Monte Carlo methods because the stochasticity of this algorithm is derived from there.
Armen Aghajanyan

5

In addition to the existing answers, I would like to talk about this energy function, and the intuition behind that a bit. Sorry if this is a bit long and physical.

The energy function describes a so-called Ising model, which is a model of ferromagnetism in terms of statistical mechanics / quantum mechanics. In statistical mechanics, we use a so-called Hamiltonian operator to describe the energy of a quantum-mechanical system. And a system always tries to be in the state with the lowest energy.

Now, the Ising model basically describes the interaction between electrons with a spin σk of either +1 or -1, in presence of an external magnetic field h. The interaction between two electrons i and j is described by a coefficient Jij. This Hamiltonian (or energy function) is

H^=i,jJijσiσjμjhjσj
where H^ denotes the Hamiltonian. A standard procedure to get from an energy function to the probability, that a system is in a given state (i.e. here: a configuration of spins, e.g. σ1=+1,σ2=1,...) is to use the Boltzmann distribution, which says that at a temperature T, the probability pi of the system to be in a state i with energy Ei is given by
pi=exp(Ei/kT)iexp(Ei/kt)
At this point, you should recognize that these two equations are the exact same equations as in the videos by Hinton and the answer by Armen Aghajanyan. This leads us to the question:

What does the RBM have to do with this quantum-mechanical model of ferromagnetism?

We need to use a final physical quantity: the entropy. As we know from thermodynamics, a system will settle in the state with the minimal energy, which also corresponds to the state with the maximal entropy.

As introduced by Shanon in 1946, in information theory, the entropy H can also be seen as a measure of the information content in X, given by the following sum over all possible states of X:

H(X)=iP(xi)logP(xi)
Now, the most efficient way to encode the information content in X, is to use a way that maximizes the entropy H.

Finally, this is where we get back to RBMs: Basically, we want this RBM to encode as much information as possible. So, as we have to maximize the (information-theoretical) entropy in our RBM-System. As proposed by Hopfield in 1982, we can maximize the information-theoretical entropy exactly like the physical entropy: by modelling the RBM like the Ising model above, and use the same methods to minimize the energy. And that is why we need this strange energy function for in an RBM!

The nice mathematical derivation in Armen Aghajanyan's answer shows everything we need to do, to minimize the energy, thus maximizing entropy and storing / saving as much information as possible in our RBM.

PS: Please, dear physicists, forgive any inaccuracies in this engineer's derivation. Feel free to comment on or fix inaccuracies (or even mistakes).


I saw this video, Just watch the video from that point. how do you get that sampled number? whether we have just run rand() in matlab and obtain it? and then it would be different for each h(i) . Oh nooo! I don't think machine will learn properly.
Born2Code

@Born2Code this is another question. Can you post it as a new question to this site? Please try to add the equations you are talking about to the new question, and explain what parts you don't understand.
hbaderts


0

The answer of @Armen has gave myself a lot of insights. One question hasn't been answered however.

The goal is to maximize the probability (or likelihood) of the v. This is correlated to minimizing the energy function related to v and h:

E(v,h)=aTvbThvTWh

Our variables are a, b and W, which have to be trained. I'm quite sure this training will be the ultimate goal of the RBM.


How do we make hidden layer binary too? Bcoz after the activation function operation, we would be getting values in the range between 0 and 1.
Born2Code

@Born2Code: The activation function gives you the probability that a neuron has value 1. Therefore to "make it binary", you sample from the probabilities calculated for either h or v - in other words you literally do something like h_bin = (rand() < h_val) ? 1 : 0 - this has to be done for each neuron, and each time you want a sample.
Neil Slater

@NeilSlater: but why a random number? Also, whether the random should be generated for each iteration or the same number should be used for all the iterations? one more serious doubt, how many iterations have to be done? I have a training set V, which has only one vector, i.e. v1. With v1, how many times should I have to iterate?
Born2Code

@NeilSlater: One more doubt is, whether the same random number is to be compared with all the values of hidden layer? I know this is such an idiotic question but still
Born2Code

1
It's a random number because that is how you resolve probabilities to binary values. It is a dIfferent number for each neuron inside h or v - you are sampling a vector of binary values for h or v, in order to generate an example that the network "believes" exists - i.e. an example that has a high statistical chance of being representative of the training set. During training, you determine how well it matches an existing training example and adjust weights accordingly.
Neil Slater
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.