SlideShare a Scribd company logo
1 of 26
Gaussian Process
Jungkyu Lee
Daum Search Quality Team
1
Intuition
• http://explainaway.wordpress.com/2008/12/01/ridiculous-stats/
• x 축 년도, y 축: 100미터 기록, 음영= 예측의 uncertainty
• 우리의 직관과 잘 맞는다 = 2030년 이후 값은 이전 데이터로 예측할 수 없다
• 데이터 x(연도)가 가까우면, 대응하는 함수값 (100 기록)도 비슷하다고 기대되는 데이터가 주어졌을 때 쓰는
regression
Prerequisite: Conditioning of Multivariate Gaussians
• a random vector x ∈ Rn with x ∼ N (µ, Σ)
• Then the marginals are given by’
• and the posterior conditional is given by
Prerequisite: Bayesian Linear Regression
• 위키 링크
• http://play.daumcorp.com/display/~sweaterr/7.+Linear+Regression#7.LinearRegression-
7.6Bayesianlinearregression
•
w 도 Gaussian, likelihood 도 Gaussian 이면, w의 posterior도 Gaussian 이고, Linear Gaussian System 공
식에 의해서 구할 수 있다
posterior predictive 도 적분이 tractable 하기 때문에, 구할 수 있고, 또한 posterior 의 평균을 weight 로 한 예측
치를 평균으로 하는 정규 분포가 된다
Parametric Models vs. Non-parametric Models
Non-parametric model은 parametric model 과 다르게 model의 구조를 가정하지 않고,
데이터로부터 모든 것을 알아낸다.
Parametric models:
• Linear Regression
• GMM
Non-parametric models:
• KNN
• Kernel Regression
• Gaussian Process
Non-parametric Models
Kernel Regression (Non-Parametric, Non-Bayes) GP Regression (Non-Parametric, Bayes)
함수에 대한 분포를 알아내기 때문에 예측의
confidence가 나옴
15.1 Introduction
• In supervised learning, we observe some inputs xi and some outputs yi.
• xi 를 yi에 mapping 하는 어떤 함수 f가 있다고 가정했고, 그 함수를 알아내려 노력했다.
• 가장 이상적인 방법은 그 함수의 분포까지 알아내서 이것을 예측에 쓰는 것이다
• 여태까지 함수의 parametric한 표현에 대해서 초점을 맞추어 p(f|D) 대신 p(θ|D)를 추정했었다.
• 이제는 함수 자체에 대한 베이지안 추론을 수행한다.
Probability distributions over functions with finite domains
• 다음과 같은 training example 이 있다고 하자 X = {x1, . . . , xm}
• 여러 함수가 있는 함수 공간에서 하나의 함수를 다음과 같이 표현할 수 있다
• 함수의 domain 의 크기는 m 개의 유한 집합이기 때문에 함수를 다음과 같이 벡터로 표현할 수 있다
• 함수를 분포로 어떻게 표현할 수 있을까? 한가지 자연스러운 방법은
• 즉, 유한 domain 에 대한 함수의 값이 정규분포를 따른다.
• 공분산이 대각 행렬이므로, h(x1)과 h(x2) 는 독립이다
• 그렇다면, 함수의 domain 이 무한한 크기를 가질 때, 함수에 대한 분포를 어떻게 표현할까?
Probability distributions over functions with infinite domains
• Stochastic process 는 랜덤 변수 의 모음이다
• Gaussian process 는 이 랜덤 변수의 sub collection 의 joint probability 가 multivariate Gaussian distribution (MVN)
인 stochastic process 이다.
• Gaussian Process 는 무한 차원에 대한 분포인데, 그 중에 일부분만 골라서, 분포를 보면 MVN 이다
• 유한 집합 x1, ... , xm 에 대해서, 랜덤 변수 h(x1),..., h(xm)는 다음과 같은 분포를 가진다
• 무한일 때는 다음과 같이 표현한다.
• 유한 domain 과 달리, 공분산이 kernel로 채워졌다.
• 함수의 분포는 m을 평균으로 하는 정규분포를 따르고, 함수 값 사이의 correlation 은 함수의 input 이 가까우
면 강하게 되는 kernel 을 정의한다.
• 핵심 아이디어는 데이터가 비슷하면, 이 데이터 포인트에 대한 함수의 값도 비슷할 것이라고 기대하는 것이
다
• 즉 Gaussian Process는 무한 차원(무한 domain)에 대한 것이지만, 유한 부분 집합에 대해서만 다룰 수 있다
• 다행히도, 유한 부분 집합으로도, 무한을 고려하는 것과 같은 추론을 할 수 있다는 것이다
Graphical Model for GP
• 2 training points 와 1 test point를 가진 Gaussian Process
• mixed directed and undirected graphical model representing
• fi = f(xi) 는 각 data points 에서 함수의 값이고, hidden node 다
• Test data point x*가 training 과 비슷할 수록, y*도 training 과 비슷해 진다.
• 그러므로, 이전 장에서 했던 Kernel Regression 과 비슷하게, 가까이 test point 와 가까운 training y 의 f 와 비슷
하게 된다
different kernel
• 함수에 대한 분포이므로, 함수를 sampling 할 수 있다
• kernel 에 따라 생성된 함수의 모양이 다르다.
• kernel 로 인한 GP design 이 어떤 문제에 대한 예측력을 결정하는 가장 큰 요인이다
15.2 GPs for regression
• 함수가 다음과 같은 GP 분포를 따른다고 하자
• where m(x) is the mean function and κ(x, x) is the kernel or covariance function,
• 유한한 데이터 점 집합에 대해서, 이 프로세스는 joint Gaussian을 정의한다 (GP의 성질)
•
15.2.1 Predictions using noise-free observations
• fi = f(xi)는 xi에서 계산된 노이즈 없는 관찰이다
• X∗ of size N∗ × D 의 test set이 주어졌을 때, test set 에 대한 function outputs f∗을 예측하고 싶다
• 관찰에 노이즈가 없다고 가정하므로, GP는 관찰 x에 대한 f(x)를 불확실성 없이 예측하고, test point x* 에 대
한 예측 f* 를 다음과 같이 f의 벡터에 이어붙이는 식으로 표현한다
• By the standard rules for conditioning Gaussians (Section 4.3), the posterior has the following form
• 평균을 0, K 는 identity matrix 라고 하면, test point의 f* 평균은 K*
Tf즉 test point 에 비슷한 training point 의 f 에
가중치를 더 준다
training points 간의 Gram matrix
training points 과 test points 간의 Gram matrix
test points 간의 Gram matrix
15.2.1 Predictions using noise-free observations
• 왼쪽: GP의 prior
• 오른쪽: 5개의 noise free observations을 봤을 때 GP posterior
• Predictive uncertainty 는 관찰에서 멀어질수록 커진다
15.2.2 Predictions using noisy observations
• 관찰이 noisy 하다고 하자
• 노이즈가 없을 때처럼 response 가 바로 f 가 아니다
• 관찰치의 response (답) 에 대한 공분산은 다음과 같이 정의한다
• where δpq = I(p = q). In other words,
• 두 번째 행렬은 각 관찰에 더해지는 노이즈 term이 독립이기 때문에 diagonal이다
• 노이즈가 있는 관찰치와, test point 에 대한 noise-free 함수에 대한 joint probability 는
• 여기서, notation 을 간단히 하기 위해, 평균을 0이라고 가정했다
• 그러므로, posterior predictive density 는
• 관찰치에 노이즈가 없다고 가정한 모델과 다른 점은 K의 diagonal 에 σ2y 가 추가 된 것이다
15.2.2 Predictions using noisy observations
• 한 개의 test point 에 대한 분포는
• where k∗ = [κ(x∗, x1), . . . , κ(x∗, xN)] and k∗∗ = κ(x∗, x∗).
• Another way to write the posterior mean is as follows:
• where α = K−1 y y. We will revisit this expression later
15.2.3 Effect of the kernel parameters
• GP의 예측 성능은 고른 kernel 에 전적으로 달려 있다.
• Suppose we choose the following squared-exponential (SE) kernel for the noisy observations
• (a) l = 1 good fit
• (b) l = 0.3 늘림 --> 구불해지고, 불확실성이 커짐
• (c ) l = 3
controls the vertical scale of the function
noise variance
15.2.4 Estimating the kernel parameters
• kernel parameters 를 추정하기 위해서 하는 CV는 너무 느리다
• 다음과 같은 likelihood 를 최대화하는 kernel parameters 를 최적화 한다
• The first term is a data fit term,
• kernel 이 RBF인 경우, bandwidth 가 작을수록, 멀리 있는 점들은 거리가 0이 되고, 가까이 있는 점들만 예측에
쓰기 때문에, GPR은 다음 그림과 같이 data 에 많이 fit 된다. bandwidth 가 극도로 작아져서, Ky가 diagonal
matrix 가 된 경우( 어떤 near point 와도 similarity 가 0 이다), log|Ky| 는 매우 커지겠지만 (대각 행렬의
determinant 는 대각 원소의 합), 데이터 Fit 에러는 작어진다
• 반대로 kernel parameter(bandwidth) 가 커지면, data fit error 는 커지고, log|Ky| 는 작아진다
• 그러므로, 첫번째 term = likelihood, 두 번째 term = model complexity 라고 볼 수 있고, trade off 가 있다.
• 다음과 목적함수를 최소화 하는 kernel parameter l를 찾는다.
• 아래와 같이 gradient 를 구하고
• gradient descent 같은 standard gradient-based optimizer 로 최적화
15.3 GPs meet GLMs
• GP 를 다른 GLMs 모델에 적용할 수 있다
• 이전에는 f(x) = wTx 처럼 함수의 구조를 x 에 선형으로 맞추었지만, 이제는 f ~ GP() 이다
• 예를 들어서 15.3.1 binary classification 모델에 대해서 적용해보면
• define the model
• yi ∈ {−1, +1}, and we let σ(z) = sigm(z) (logistic regression)
• yi = 1이면, fi는 0보다 커야 확률이 0.5보다 커짐
• yi = -1이면 fi는 0보다 작어야 확률이 0.5보다 커짐
• As for GP regression, we assume f ∼ GP(0, κ).
Prerequisite: Gaussian approximation(aka Laplace
approximation)
• http://play.daumcorp.com/pages/viewpage.action?pageId=157627536#8Logisticregression-
8.4.1Laplaceapproximation
• posterior를 정규 분포로 근사하는 방법
posterior 를 평균은 posterior 의 MAP 추정이고, 분
산은 posterior를 두번 미분한 것의 역행렬인 정규분
포로 근사하는 것
Prerequisite: Gaussian approximation for logistic regression
• 결과적으로 hat{w}는 앞에서 했던 logistic regression의 MAP 추정이 되고 H는 posterIor를 두 번 미분한것
15.3 GPs meet GLMs
15.3.1.1 Computing the posterior
• Define the log of the unnormalized posterior as follows:
• Let J(f) −(f) be the function we want to minimize
• The gradient and Hessian of this are given by
• Newton’s Method를 사용해서 최적화를 하면
• 이렇게 f의 posterior 를 최적화 한 f 를 hat{f} 이라 하자
• 수렴시, f의 posterior 의 Gaussian Approximation은
σ 함수가 무엇이냐에 따라 다른 것
15.3 GPs meet GLMs
15.3.1.2 Computing the posterior predictive
• Test point에 대한 posterior predictive 는
f 의 기대값을 f의 MAP 추정값으로 근사
15.3 GPs meet GLMs
15.3.1.3 Computing the marginal likelihood
• Kernel parameter를 최적화하기 위해 marginal likelihood가 필요하다
• LogP(D) 를 kernel parameter에 대한 미분으로 최적화하는데, kernel parameter가 W,K,f에 모두 depend하기 때
문에 어렵다 ((Rasmussen and Williams 2006,p125))
15.3.1.1 Computing the posterior 의 결과에 최적값 넣음
5 Summary
• 왜 Gaussian Process 가 좋은가?
• Bayesian method 이다
• 예측의 uncertainty 를 수치화 할 수 있다
• 여러 model selection 과 hyperparameter selection 과 같은 Bayesian method를 그대로 사용할 수 있다
• 앞에서 RBF 의 bandwidth 에 대한 likelihood 를 최적화하는 방법 같은
• Non-parametric 이다
• input point 에 대한 임의의 함수를 모델링한다 (No model assumption)

More Related Content

What's hot

研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 11章2-4節研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 11章2-4節
Koji Matsuda
 
[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm
Chih-Hsuan Kuo
 
Source monitorと複雑度のはなし
Source monitorと複雑度のはなしSource monitorと複雑度のはなし
Source monitorと複雑度のはなし
aomori ringo
 
Fuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two CulturesFuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two Cultures
CISPA Helmholtz Center for Information Security
 

What's hot (20)

「生態学における統計的因果推論」という大ネタへの挑戦:その理論的背景と適用事例
「生態学における統計的因果推論」という大ネタへの挑戦:その理論的背景と適用事例「生態学における統計的因果推論」という大ネタへの挑戦:その理論的背景と適用事例
「生態学における統計的因果推論」という大ネタへの挑戦:その理論的背景と適用事例
 
1 8.交互作用
1 8.交互作用1 8.交互作用
1 8.交互作用
 
研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 11章2-4節研究室内PRML勉強会 11章2-4節
研究室内PRML勉強会 11章2-4節
 
ようやく分かった!最尤推定とベイズ推定
ようやく分かった!最尤推定とベイズ推定ようやく分かった!最尤推定とベイズ推定
ようやく分かった!最尤推定とベイズ推定
 
ベイズ統計学の概論的紹介
ベイズ統計学の概論的紹介ベイズ統計学の概論的紹介
ベイズ統計学の概論的紹介
 
グラフネットワーク〜フロー&カット〜
グラフネットワーク〜フロー&カット〜グラフネットワーク〜フロー&カット〜
グラフネットワーク〜フロー&カット〜
 
クラシックな機械学習の入門  5. サポートベクターマシン
クラシックな機械学習の入門  5. サポートベクターマシンクラシックな機械学習の入門  5. サポートベクターマシン
クラシックな機械学習の入門  5. サポートベクターマシン
 
NP完全問題の紹介
NP完全問題の紹介NP完全問題の紹介
NP完全問題の紹介
 
[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm[ACM-ICPC] Dinic's Algorithm
[ACM-ICPC] Dinic's Algorithm
 
Source monitorと複雑度のはなし
Source monitorと複雑度のはなしSource monitorと複雑度のはなし
Source monitorと複雑度のはなし
 
RでWAIC
RでWAICRでWAIC
RでWAIC
 
統計的学習の基礎 3章後半
統計的学習の基礎 3章後半統計的学習の基礎 3章後半
統計的学習の基礎 3章後半
 
博士のキャリアデザインワークショップ講演
博士のキャリアデザインワークショップ講演博士のキャリアデザインワークショップ講演
博士のキャリアデザインワークショップ講演
 
レプリカ交換モンテカルロ法で乱数の生成
レプリカ交換モンテカルロ法で乱数の生成レプリカ交換モンテカルロ法で乱数の生成
レプリカ交換モンテカルロ法で乱数の生成
 
PRML上巻勉強会 at 東京大学 資料 第1章後半
PRML上巻勉強会 at 東京大学 資料 第1章後半PRML上巻勉強会 at 東京大学 資料 第1章後半
PRML上巻勉強会 at 東京大学 資料 第1章後半
 
Prml 10 1
Prml 10 1Prml 10 1
Prml 10 1
 
Luz maría garcía velloso murió en 1925
Luz maría garcía velloso murió en 1925Luz maría garcía velloso murió en 1925
Luz maría garcía velloso murió en 1925
 
最適腕識別
最適腕識別最適腕識別
最適腕識別
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 3장. 분류
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 3장. 분류[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 3장. 분류
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 3장. 분류
 
Fuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two CulturesFuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two Cultures
 

Similar to 머피의 머신러닝 : Gaussian Processes

머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model
Jungkyu Lee
 
머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model
Jungkyu Lee
 

Similar to 머피의 머신러닝 : Gaussian Processes (20)

내가 이해하는 SVM(왜, 어떻게를 중심으로)
내가 이해하는 SVM(왜, 어떻게를 중심으로)내가 이해하는 SVM(왜, 어떻게를 중심으로)
내가 이해하는 SVM(왜, 어떻게를 중심으로)
 
Coursera Machine Learning (by Andrew Ng)_강의정리
Coursera Machine Learning (by Andrew Ng)_강의정리Coursera Machine Learning (by Andrew Ng)_강의정리
Coursera Machine Learning (by Andrew Ng)_강의정리
 
[한글] Tutorial: Sparse variational dropout
[한글] Tutorial: Sparse variational dropout[한글] Tutorial: Sparse variational dropout
[한글] Tutorial: Sparse variational dropout
 
머피's 머신러닝, Mixture model and EM algorithm
머피's 머신러닝, Mixture model and EM algorithm머피's 머신러닝, Mixture model and EM algorithm
머피's 머신러닝, Mixture model and EM algorithm
 
Ch11.특수기저
Ch11.특수기저Ch11.특수기저
Ch11.특수기저
 
The fastalgorithmfordeepbeliefnets
The fastalgorithmfordeepbeliefnetsThe fastalgorithmfordeepbeliefnets
The fastalgorithmfordeepbeliefnets
 
From maching learning to deep learning episode2
From maching learning to deep learning episode2 From maching learning to deep learning episode2
From maching learning to deep learning episode2
 
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
[홍대 머신러닝 스터디 - 핸즈온 머신러닝] 5장. 서포트 벡터 머신
 
Variational AutoEncoder(VAE)
Variational AutoEncoder(VAE)Variational AutoEncoder(VAE)
Variational AutoEncoder(VAE)
 
Data Visualization and t-SNE
Data Visualization and t-SNEData Visualization and t-SNE
Data Visualization and t-SNE
 
ESM Mid term Review
ESM Mid term ReviewESM Mid term Review
ESM Mid term Review
 
Pose Graph based SLAM
Pose Graph based SLAMPose Graph based SLAM
Pose Graph based SLAM
 
머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model
 
Lecture 4: Neural Networks I
Lecture 4: Neural Networks ILecture 4: Neural Networks I
Lecture 4: Neural Networks I
 
Learning how to explain neural networks: PatternNet and PatternAttribution
Learning how to explain neural networks: PatternNet and PatternAttributionLearning how to explain neural networks: PatternNet and PatternAttribution
Learning how to explain neural networks: PatternNet and PatternAttribution
 
머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model머피's 머신러닝: Latent Linear Model
머피's 머신러닝: Latent Linear Model
 
Introduction toDQN
Introduction toDQNIntroduction toDQN
Introduction toDQN
 
DL from scratch(6)
DL from scratch(6)DL from scratch(6)
DL from scratch(6)
 
Gan
GanGan
Gan
 
Improved techniques for grid mapping with rao blackwellized particle filters 번역
Improved techniques for grid mapping with rao blackwellized particle filters 번역Improved techniques for grid mapping with rao blackwellized particle filters 번역
Improved techniques for grid mapping with rao blackwellized particle filters 번역
 

More from Jungkyu Lee

머피의 머신러닝: 17장 Markov Chain and HMM
머피의 머신러닝: 17장  Markov Chain and HMM머피의 머신러닝: 17장  Markov Chain and HMM
머피의 머신러닝: 17장 Markov Chain and HMM
Jungkyu Lee
 
Murpy's Machine Learing: 10. Directed Graphical Model
Murpy's Machine Learing: 10. Directed Graphical ModelMurpy's Machine Learing: 10. Directed Graphical Model
Murpy's Machine Learing: 10. Directed Graphical Model
Jungkyu Lee
 
Murpy's Machine Learning 9. Generalize Linear Model
Murpy's Machine Learning 9. Generalize Linear ModelMurpy's Machine Learning 9. Generalize Linear Model
Murpy's Machine Learning 9. Generalize Linear Model
Jungkyu Lee
 
Murpy's Machine Learning:14. Kernel
Murpy's Machine Learning:14. KernelMurpy's Machine Learning:14. Kernel
Murpy's Machine Learning:14. Kernel
Jungkyu Lee
 
머피의 머신러닝 13 Sparse Linear Model
머피의 머신러닝 13 Sparse Linear Model머피의 머신러닝 13 Sparse Linear Model
머피의 머신러닝 13 Sparse Linear Model
Jungkyu Lee
 
머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model
Jungkyu Lee
 
파이널 판타지 3 루트 공략
파이널 판타지 3 루트 공략파이널 판타지 3 루트 공략
파이널 판타지 3 루트 공략
Jungkyu Lee
 
1. boolean 검색
1. boolean 검색1. boolean 검색
1. boolean 검색
Jungkyu Lee
 
ThinkBayes: chapter 13  simulation
ThinkBayes: chapter 13  simulationThinkBayes: chapter 13  simulation
ThinkBayes: chapter 13  simulation
Jungkyu Lee
 
ThinkBayes: Chapter 9 two_dimensions
ThinkBayes: Chapter 9 two_dimensionsThinkBayes: Chapter 9 two_dimensions
ThinkBayes: Chapter 9 two_dimensions
Jungkyu Lee
 
앙상블 학습 기반의 추천시스템 개발
앙상블 학습 기반의 추천시스템 개발앙상블 학습 기반의 추천시스템 개발
앙상블 학습 기반의 추천시스템 개발
Jungkyu Lee
 

More from Jungkyu Lee (20)

8. Logistic Regression
8. Logistic Regression8. Logistic Regression
8. Logistic Regression
 
7. Linear Regression
7. Linear Regression7. Linear Regression
7. Linear Regression
 
4. Gaussian Model
4. Gaussian Model4. Gaussian Model
4. Gaussian Model
 
3 Generative models for discrete data
3 Generative models for discrete data3 Generative models for discrete data
3 Generative models for discrete data
 
From A Neural Probalistic Language Model to Word2vec
From A Neural Probalistic Language Model to Word2vecFrom A Neural Probalistic Language Model to Word2vec
From A Neural Probalistic Language Model to Word2vec
 
머피의 머신러닝: 17장 Markov Chain and HMM
머피의 머신러닝: 17장  Markov Chain and HMM머피의 머신러닝: 17장  Markov Chain and HMM
머피의 머신러닝: 17장 Markov Chain and HMM
 
Murpy's Machine Learing: 10. Directed Graphical Model
Murpy's Machine Learing: 10. Directed Graphical ModelMurpy's Machine Learing: 10. Directed Graphical Model
Murpy's Machine Learing: 10. Directed Graphical Model
 
Murpy's Machine Learning 9. Generalize Linear Model
Murpy's Machine Learning 9. Generalize Linear ModelMurpy's Machine Learning 9. Generalize Linear Model
Murpy's Machine Learning 9. Generalize Linear Model
 
Murpy's Machine Learning:14. Kernel
Murpy's Machine Learning:14. KernelMurpy's Machine Learning:14. Kernel
Murpy's Machine Learning:14. Kernel
 
머피의 머신러닝 13 Sparse Linear Model
머피의 머신러닝 13 Sparse Linear Model머피의 머신러닝 13 Sparse Linear Model
머피의 머신러닝 13 Sparse Linear Model
 
머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model머피의 머신러닝: Undirencted Graphical Model
머피의 머신러닝: Undirencted Graphical Model
 
파이널 판타지 3 루트 공략
파이널 판타지 3 루트 공략파이널 판타지 3 루트 공략
파이널 판타지 3 루트 공략
 
1. boolean 검색
1. boolean 검색1. boolean 검색
1. boolean 검색
 
ThinkBayes: chapter 13  simulation
ThinkBayes: chapter 13  simulationThinkBayes: chapter 13  simulation
ThinkBayes: chapter 13  simulation
 
ThinkBayes: Chapter 9 two_dimensions
ThinkBayes: Chapter 9 two_dimensionsThinkBayes: Chapter 9 two_dimensions
ThinkBayes: Chapter 9 two_dimensions
 
Jensen's inequality, EM 알고리즘
Jensen's inequality, EM 알고리즘 Jensen's inequality, EM 알고리즘
Jensen's inequality, EM 알고리즘
 
앙상블 학습 기반의 추천시스템 개발
앙상블 학습 기반의 추천시스템 개발앙상블 학습 기반의 추천시스템 개발
앙상블 학습 기반의 추천시스템 개발
 
TETRIS AI WITH REINFORCEMENT LEARNING
TETRIS AI WITH REINFORCEMENT LEARNINGTETRIS AI WITH REINFORCEMENT LEARNING
TETRIS AI WITH REINFORCEMENT LEARNING
 
Eigenvalues of regular graphs
Eigenvalues of regular graphsEigenvalues of regular graphs
Eigenvalues of regular graphs
 
Support Vector Machine Tutorial 한국어
Support Vector Machine Tutorial 한국어Support Vector Machine Tutorial 한국어
Support Vector Machine Tutorial 한국어
 

머피의 머신러닝 : Gaussian Processes

  • 1. Gaussian Process Jungkyu Lee Daum Search Quality Team 1
  • 2. Intuition • http://explainaway.wordpress.com/2008/12/01/ridiculous-stats/ • x 축 년도, y 축: 100미터 기록, 음영= 예측의 uncertainty • 우리의 직관과 잘 맞는다 = 2030년 이후 값은 이전 데이터로 예측할 수 없다 • 데이터 x(연도)가 가까우면, 대응하는 함수값 (100 기록)도 비슷하다고 기대되는 데이터가 주어졌을 때 쓰는 regression
  • 3. Prerequisite: Conditioning of Multivariate Gaussians • a random vector x ∈ Rn with x ∼ N (µ, Σ) • Then the marginals are given by’ • and the posterior conditional is given by
  • 4. Prerequisite: Bayesian Linear Regression • 위키 링크 • http://play.daumcorp.com/display/~sweaterr/7.+Linear+Regression#7.LinearRegression- 7.6Bayesianlinearregression • w 도 Gaussian, likelihood 도 Gaussian 이면, w의 posterior도 Gaussian 이고, Linear Gaussian System 공 식에 의해서 구할 수 있다 posterior predictive 도 적분이 tractable 하기 때문에, 구할 수 있고, 또한 posterior 의 평균을 weight 로 한 예측 치를 평균으로 하는 정규 분포가 된다
  • 5. Parametric Models vs. Non-parametric Models Non-parametric model은 parametric model 과 다르게 model의 구조를 가정하지 않고, 데이터로부터 모든 것을 알아낸다. Parametric models: • Linear Regression • GMM Non-parametric models: • KNN • Kernel Regression • Gaussian Process
  • 6. Non-parametric Models Kernel Regression (Non-Parametric, Non-Bayes) GP Regression (Non-Parametric, Bayes) 함수에 대한 분포를 알아내기 때문에 예측의 confidence가 나옴
  • 7. 15.1 Introduction • In supervised learning, we observe some inputs xi and some outputs yi. • xi 를 yi에 mapping 하는 어떤 함수 f가 있다고 가정했고, 그 함수를 알아내려 노력했다. • 가장 이상적인 방법은 그 함수의 분포까지 알아내서 이것을 예측에 쓰는 것이다 • 여태까지 함수의 parametric한 표현에 대해서 초점을 맞추어 p(f|D) 대신 p(θ|D)를 추정했었다. • 이제는 함수 자체에 대한 베이지안 추론을 수행한다.
  • 8. Probability distributions over functions with finite domains • 다음과 같은 training example 이 있다고 하자 X = {x1, . . . , xm} • 여러 함수가 있는 함수 공간에서 하나의 함수를 다음과 같이 표현할 수 있다 • 함수의 domain 의 크기는 m 개의 유한 집합이기 때문에 함수를 다음과 같이 벡터로 표현할 수 있다 • 함수를 분포로 어떻게 표현할 수 있을까? 한가지 자연스러운 방법은 • 즉, 유한 domain 에 대한 함수의 값이 정규분포를 따른다. • 공분산이 대각 행렬이므로, h(x1)과 h(x2) 는 독립이다 • 그렇다면, 함수의 domain 이 무한한 크기를 가질 때, 함수에 대한 분포를 어떻게 표현할까?
  • 9. Probability distributions over functions with infinite domains • Stochastic process 는 랜덤 변수 의 모음이다 • Gaussian process 는 이 랜덤 변수의 sub collection 의 joint probability 가 multivariate Gaussian distribution (MVN) 인 stochastic process 이다. • Gaussian Process 는 무한 차원에 대한 분포인데, 그 중에 일부분만 골라서, 분포를 보면 MVN 이다 • 유한 집합 x1, ... , xm 에 대해서, 랜덤 변수 h(x1),..., h(xm)는 다음과 같은 분포를 가진다 • 무한일 때는 다음과 같이 표현한다. • 유한 domain 과 달리, 공분산이 kernel로 채워졌다. • 함수의 분포는 m을 평균으로 하는 정규분포를 따르고, 함수 값 사이의 correlation 은 함수의 input 이 가까우 면 강하게 되는 kernel 을 정의한다. • 핵심 아이디어는 데이터가 비슷하면, 이 데이터 포인트에 대한 함수의 값도 비슷할 것이라고 기대하는 것이 다 • 즉 Gaussian Process는 무한 차원(무한 domain)에 대한 것이지만, 유한 부분 집합에 대해서만 다룰 수 있다 • 다행히도, 유한 부분 집합으로도, 무한을 고려하는 것과 같은 추론을 할 수 있다는 것이다
  • 10. Graphical Model for GP • 2 training points 와 1 test point를 가진 Gaussian Process • mixed directed and undirected graphical model representing • fi = f(xi) 는 각 data points 에서 함수의 값이고, hidden node 다 • Test data point x*가 training 과 비슷할 수록, y*도 training 과 비슷해 진다. • 그러므로, 이전 장에서 했던 Kernel Regression 과 비슷하게, 가까이 test point 와 가까운 training y 의 f 와 비슷 하게 된다
  • 11. different kernel • 함수에 대한 분포이므로, 함수를 sampling 할 수 있다 • kernel 에 따라 생성된 함수의 모양이 다르다. • kernel 로 인한 GP design 이 어떤 문제에 대한 예측력을 결정하는 가장 큰 요인이다
  • 12. 15.2 GPs for regression • 함수가 다음과 같은 GP 분포를 따른다고 하자 • where m(x) is the mean function and κ(x, x) is the kernel or covariance function, • 유한한 데이터 점 집합에 대해서, 이 프로세스는 joint Gaussian을 정의한다 (GP의 성질) •
  • 13. 15.2.1 Predictions using noise-free observations • fi = f(xi)는 xi에서 계산된 노이즈 없는 관찰이다 • X∗ of size N∗ × D 의 test set이 주어졌을 때, test set 에 대한 function outputs f∗을 예측하고 싶다 • 관찰에 노이즈가 없다고 가정하므로, GP는 관찰 x에 대한 f(x)를 불확실성 없이 예측하고, test point x* 에 대 한 예측 f* 를 다음과 같이 f의 벡터에 이어붙이는 식으로 표현한다 • By the standard rules for conditioning Gaussians (Section 4.3), the posterior has the following form • 평균을 0, K 는 identity matrix 라고 하면, test point의 f* 평균은 K* Tf즉 test point 에 비슷한 training point 의 f 에 가중치를 더 준다 training points 간의 Gram matrix training points 과 test points 간의 Gram matrix test points 간의 Gram matrix
  • 14. 15.2.1 Predictions using noise-free observations • 왼쪽: GP의 prior • 오른쪽: 5개의 noise free observations을 봤을 때 GP posterior • Predictive uncertainty 는 관찰에서 멀어질수록 커진다
  • 15. 15.2.2 Predictions using noisy observations • 관찰이 noisy 하다고 하자 • 노이즈가 없을 때처럼 response 가 바로 f 가 아니다 • 관찰치의 response (답) 에 대한 공분산은 다음과 같이 정의한다 • where δpq = I(p = q). In other words, • 두 번째 행렬은 각 관찰에 더해지는 노이즈 term이 독립이기 때문에 diagonal이다 • 노이즈가 있는 관찰치와, test point 에 대한 noise-free 함수에 대한 joint probability 는 • 여기서, notation 을 간단히 하기 위해, 평균을 0이라고 가정했다 • 그러므로, posterior predictive density 는 • 관찰치에 노이즈가 없다고 가정한 모델과 다른 점은 K의 diagonal 에 σ2y 가 추가 된 것이다
  • 16. 15.2.2 Predictions using noisy observations • 한 개의 test point 에 대한 분포는 • where k∗ = [κ(x∗, x1), . . . , κ(x∗, xN)] and k∗∗ = κ(x∗, x∗). • Another way to write the posterior mean is as follows: • where α = K−1 y y. We will revisit this expression later
  • 17. 15.2.3 Effect of the kernel parameters • GP의 예측 성능은 고른 kernel 에 전적으로 달려 있다. • Suppose we choose the following squared-exponential (SE) kernel for the noisy observations • (a) l = 1 good fit • (b) l = 0.3 늘림 --> 구불해지고, 불확실성이 커짐 • (c ) l = 3 controls the vertical scale of the function noise variance
  • 18. 15.2.4 Estimating the kernel parameters • kernel parameters 를 추정하기 위해서 하는 CV는 너무 느리다 • 다음과 같은 likelihood 를 최대화하는 kernel parameters 를 최적화 한다 • The first term is a data fit term, • kernel 이 RBF인 경우, bandwidth 가 작을수록, 멀리 있는 점들은 거리가 0이 되고, 가까이 있는 점들만 예측에 쓰기 때문에, GPR은 다음 그림과 같이 data 에 많이 fit 된다. bandwidth 가 극도로 작아져서, Ky가 diagonal matrix 가 된 경우( 어떤 near point 와도 similarity 가 0 이다), log|Ky| 는 매우 커지겠지만 (대각 행렬의 determinant 는 대각 원소의 합), 데이터 Fit 에러는 작어진다 • 반대로 kernel parameter(bandwidth) 가 커지면, data fit error 는 커지고, log|Ky| 는 작아진다 • 그러므로, 첫번째 term = likelihood, 두 번째 term = model complexity 라고 볼 수 있고, trade off 가 있다.
  • 19. • 다음과 목적함수를 최소화 하는 kernel parameter l를 찾는다. • 아래와 같이 gradient 를 구하고 • gradient descent 같은 standard gradient-based optimizer 로 최적화
  • 20. 15.3 GPs meet GLMs • GP 를 다른 GLMs 모델에 적용할 수 있다 • 이전에는 f(x) = wTx 처럼 함수의 구조를 x 에 선형으로 맞추었지만, 이제는 f ~ GP() 이다 • 예를 들어서 15.3.1 binary classification 모델에 대해서 적용해보면 • define the model • yi ∈ {−1, +1}, and we let σ(z) = sigm(z) (logistic regression) • yi = 1이면, fi는 0보다 커야 확률이 0.5보다 커짐 • yi = -1이면 fi는 0보다 작어야 확률이 0.5보다 커짐 • As for GP regression, we assume f ∼ GP(0, κ).
  • 21. Prerequisite: Gaussian approximation(aka Laplace approximation) • http://play.daumcorp.com/pages/viewpage.action?pageId=157627536#8Logisticregression- 8.4.1Laplaceapproximation • posterior를 정규 분포로 근사하는 방법 posterior 를 평균은 posterior 의 MAP 추정이고, 분 산은 posterior를 두번 미분한 것의 역행렬인 정규분 포로 근사하는 것
  • 22. Prerequisite: Gaussian approximation for logistic regression • 결과적으로 hat{w}는 앞에서 했던 logistic regression의 MAP 추정이 되고 H는 posterIor를 두 번 미분한것
  • 23. 15.3 GPs meet GLMs 15.3.1.1 Computing the posterior • Define the log of the unnormalized posterior as follows: • Let J(f) −(f) be the function we want to minimize • The gradient and Hessian of this are given by • Newton’s Method를 사용해서 최적화를 하면 • 이렇게 f의 posterior 를 최적화 한 f 를 hat{f} 이라 하자 • 수렴시, f의 posterior 의 Gaussian Approximation은 σ 함수가 무엇이냐에 따라 다른 것
  • 24. 15.3 GPs meet GLMs 15.3.1.2 Computing the posterior predictive • Test point에 대한 posterior predictive 는 f 의 기대값을 f의 MAP 추정값으로 근사
  • 25. 15.3 GPs meet GLMs 15.3.1.3 Computing the marginal likelihood • Kernel parameter를 최적화하기 위해 marginal likelihood가 필요하다 • LogP(D) 를 kernel parameter에 대한 미분으로 최적화하는데, kernel parameter가 W,K,f에 모두 depend하기 때 문에 어렵다 ((Rasmussen and Williams 2006,p125)) 15.3.1.1 Computing the posterior 의 결과에 최적값 넣음
  • 26. 5 Summary • 왜 Gaussian Process 가 좋은가? • Bayesian method 이다 • 예측의 uncertainty 를 수치화 할 수 있다 • 여러 model selection 과 hyperparameter selection 과 같은 Bayesian method를 그대로 사용할 수 있다 • 앞에서 RBF 의 bandwidth 에 대한 likelihood 를 최적화하는 방법 같은 • Non-parametric 이다 • input point 에 대한 임의의 함수를 모델링한다 (No model assumption)