juooo1117

Boltzmann Machine 본문

Deep Learning Study/Udemy Deep Learning A-Z

Boltzmann Machine

Hyo__ni 2023. 12. 10. 17:30

Boltzmann Machine

What makes the Boltzmann Machine stand out?

Botlzmann machine has connections too but it does not operate in a direction → 볼츠만 머신은 undirected model 이다.

아래 그림에서 볼 수 있듯이, the connections of the Boltzmann Machine has no arrows → so it operates on a random direction

ouput layer가 따로없고 모든것은 연결되어 있으며 방향성은 존재하지 않는다.

Generative Model이다. ⇒ Deterministic Model들이 타겟과 가설 간의 차이를 줄여서 오차를 줄이는 것이 목표라고 한다면, Generative Model들의 목표는 확률밀도함수(Probability Density Function)를 정확히 학습해서 좋은 sample을 sampling(결과물을 생성하는 과정)하는 것.

Hidden nodes: visible nodes 처럼 우리가 보지 못하는 어떤 특성(features)가 존재함을 암시하며, 이렇게 보이지 않는 factor들까지 학습할 수 있다면 정확한 확률분포를 학습할 수 있을 것이다.

standard boltzmann machine

How Boltzmann machine function

모든 node는 연결되어 있으므로 가중치 조정(adjusting the weights)은 필요하지 않고, input data는 고정되어 있다.

볼츠만 머신은 input data에 의존하지 않고, 데이터를 생성한다. → visible nodes가 input data를 받아서 단순화하는 동시에 다른 invisible nodes도 자체적으로 raw data를 생성해서 시스템으로 가져와서 결과를 낸다.

Boltzmann machine is a scholastic or generative deep learning model because it has a way of generating its own deep learning model. → 볼츠만 머신은 생성모델이다.

Boltzmann machine nodes are all connected so it measures all components equally treating data from both the hidden and visible nodes equally. → 모든 노드가 연결되어 있으므로 데이터는 동일하게 처리해서 측정

Boltzmann machine does not give priority to the data that it has been fed with neither does it prioritize data that the hidden nodes have generated → 데이터들 사이에는 어떠한 우선순위도 없으며, 모든 데이터로부터 결과를 도출해 낸다.

Energy-Based Models

Boltzmann distribution

특정 상태 x에 대한 에너지를 E(x)라고 한다면, 이 에너지 E(x)는 그 상태(configuration)에 매칭되는 값이다. → 즉, 상태 x에 대한 사건들의 분포를 말해주기도 하므로, 이는 확률분포(probability distribution)와 연결시켜 생각할 수 있다.

Pi : 어떤 시스템의 다양한 상태(i)를 나타내는 확률 (에너지가 낮을 수록 확률은 낮아짐) → 확률은 에너지에 역비례(inversely relative)

시스템의 확률은 그 상태의 시스템의 에너지와 inversely relative 한다.

In deep learning, the Boltzmann distribution is used in the sampling distribution of stochastic neural networks such as the Boltzmann machine, restricted Boltzmann machine, energy-based models and deep Boltzmann machine.

As the number of nodes are increased the difficulty of implementing in real time applications becomes critical, so a different type of architecture named Restricted Boltzmann machine is introduced.

Restricted Boltzmann Machines (RBM)

What is the RBM?

hidden nodes, visible nodes들끼리는 서로 연결하지 않은 구조이다. 그 외에는 standard boltzmann machine과 동일하다.

visible, hidden layer의 node 간의 내부적인 연결이 없어진 것은 사건 간의 독립성을 가정함으로써 확률분포의 결합을 쉽게 표현하기 위해서이다.

visible layer와 hidden layer만을 연결해줌으로써 visible layer의 데이터가 주어졌을 때 hidden layer의 데이터를 계산할 수 있도록 하거나 혹은 hidden layer의 데이터가 주어졌을 때 visible layer의 데이터를 계산할 수 있도록 하는 ‘조건부 확률’을 계산할 수 있게 하는 것이다.

⇒ Boltzmann Machine의 계산이 너무 복잡해지니까 이를 편하게 하기 위해 덜 엄격한 모델 RBM을 구성한 것

RBM과 같은 형태를 구성하게 됨으로써 Feed-Forward Nerual Network(FFNN) 처럼 학습하게 된다. → forward propagation을 통해 hidden nodes의 상태를 결정하고, 다시 hidden nodes의 상태로부터 back propagation을 함으로써 visible nodes의 상태를 재결정

Contrastive Divergence

Restricted Boltzmann Machines이 어떻게 weight를 조절할까?

다른 모델들은 gradient descent process가 있어서, backpropagation을 통해서 error를 전달하고 최소화하기 위해서 weight를 조절하는 반면에 볼츠만 머신은 undirected network 이기 때문에 이 방법으로 weight를 조절할 수 없다. → contrastive divergence를 사용!!

input은 re-constructed input을 만들지만, weight는 동일하다. 이와 같은 방식으로 계속 re-constructed input을 집어넣어서(feeding) 최종적인 결과를 낸다. → Gibbs Sampling

*Gibbs Sampling: 고차원의 문제를 1차원의 문제로 바꾸어 굉장히 쉽게 해결할 수 있다. (Multivariate → Univariate 로 풀어서 차원의 저주 해결)

Contrastive Divergence(CD):

visible layer에 데이터를 주고 hidden layer의 node 값을 샘플링, 그런 다음 다시 visible layer의 데이터를 다시 예측하도록 하는 과정에서 처음 주어진 visible layer의 데이터와 다시 획득한 visible layer의 데이터가 얼마나 차이가 있는지를 말하는 것.

만약 weight matrix와 hidden layer의 bias가 잘 학습되었다면 hidden unit을 잘 sample 해줄 수 있을 것이고 그렇다면 재획득한 visible layer의 데이터는 원래의 데이터와 일치할 것이기 때문이다.

Deep Belief Networks (DBM)

What is the DBM?

feed-forward 신경망에서 신경망의 층 수가 늘어나면서 발생하는 경사감소 소멸(Gradient Descent Vanishing) 문제 해결 필요

⇒ 여러 RBM을 쌓아서(stack) 생기는 것이 DBM 구조이다.

첫 번째 RBM의 hidden layer는 두 번째 RBM의 input이 된다. (RBM을 쌓아놓고 Layer별로 RBM을 훈련 → weight를 갖게되면 연결은 방향성을 가지고 아래로만 실행되도록 한다; connection only works downward)

맨 위의 두 개를 제외한 모든 layer에 방향성이 존재한다. → layer들 사이에 하향 방향성이(direction downward) 있다는 것이다. 단, top layer에는 방향성이 없다.

Deep Boltzmann Machines (DBM)

DBM <> DBM

Deep Belief Networks 와 Deep Boltzmann Machines 은 다른 것이다.

Deep Belief Networks이 방향성을 만든 반면, Deep Boltzmann Machines은 무방향성 네트워크 방식을 유지한다. ( → main architectural differences)

Deep Boltzmann Machines은 더 복잡하고 정교한 features들을 추출해 낼 수 있다.