Bayesian Decision Theory

advertisement
Introduction to Pattern Recognition for human ICT
Bayesian Decision Theory
2014. 10. 10
Hyunki Hong
Contents
•
Likelihood ratio test
•
Probability of error
•
Bayes risk
•
Bayes, MAP and ML criteria
•
Multi-class problems
•
Discriminant functions
Likelihood ratio test (LRT)
우도비 검증
• Assume we are to classify an object based on the
evidence provided by feature vector 𝑥
1. Would the following decision rule be reasonable?
- “Choose the class that is most probable given observation x”
- More formally: Evaluate the posterior probability of each class 𝑃(𝜔𝑖
|𝑥) and choose the class with largest 𝑃(𝜔𝑖|𝑥).
• Let’s examine this rule for a 2-class problem
1. In this case the decision rule becomes
Binary classification
if 𝑃(𝜔1|𝑥) > 𝑃(𝜔2|𝑥) choose 𝜔1, else choose 𝜔2.
2. Or, in a more compact form
3. Applying Bayes rule
• Since 𝑝(𝑥) does not affect the decision rule, it can be
eliminated*
• Rearranging the previous expression
• The term Λ(𝑥) is called the likelihood ratio, and the decision
rule is known as the likelihood ratio test.
Bayes classifier
*𝑝(𝑥) can be disregarded in the decision rule since it is constant
regardless of class 𝜔𝑖. However, 𝑝(𝑥) will be needed if we want to
estimate the posterior 𝑃(𝜔𝑖|𝑥) which, unlike 𝑝(𝑥|𝜔𝑖)𝑃(𝜔𝑖), is a true
probability value and, therefore, gives us an estimate of the
“goodness” of our decision.
Likelihood ratio test: an example
• Problem
1. Given the likelihoods below, derive a decision rule based on the LRT
(assume equal priors). 𝑝(𝑥|𝜔1) = 𝑁(4,1);
𝑝(𝑥|𝜔2) = 𝑁(10,1)
• Solution
1. Substituting into the LRT expression
2. Simplifying the LRT expression
3. Changing signs and taking
4. Which yields
5. This LRT result is intuitive since the likelihoods
differ only in their mean.
Probility of error
• The performance of any decision rule can be measured by 𝑃[𝑒𝑟𝑟𝑜
𝑟]
1. Making use of the Theorem of total probability :
2. The class conditional probability 𝑃[𝑒𝑟𝑟𝑜𝑟|𝜔𝑖] can be expressed as
3. So, for our 2-class problem, 𝑃[𝑒𝑟𝑟𝑜𝑟] becomes
where 𝜖𝑖 is the integral of 𝑝(𝑥|𝜔𝑖) over region
𝑅𝑗 where we choose 𝜔𝑗.
4. For the previous example, since we assumed
equal priors, then 𝑃[𝑒𝑟𝑟𝑜𝑟] = (𝜖1 + 𝜖2)/2
How good is the LRT decision rule?
• To answer this question, it is convenient to express 𝑃[𝑒𝑟𝑟𝑜𝑟] in
terms of the posterior 𝑃[𝑒𝑟𝑟𝑜𝑟|𝑥].
• The optimal decision rule will minimize 𝑃[𝑒𝑟𝑟𝑜𝑟|𝑥] at every
value of 𝑥 in feature space, so that the integral above is
minimized.
*
점 x 에서 오류확률 P(error| x*)
= ω2를 ω1로 선택할 확률 P(ω1| x*)
Bayes risk
• So far we have assumed that the penalty of misclassifying
𝑥 ∈ 𝜔1 as 𝜔2 is the same as the reciprocal error.
– In general, this is not the case.
ex) Misclassifying a cancer sufferer as a healthy patient is a
much more serious problem than the other way around.
– This concept can be formalized in terms of a cost function 𝐶𝑖𝑗.
: 𝐶𝑖𝑗 represents the cost of choosing class 𝜔𝑖 when 𝜔j is the
true class.
• We define the Bayes Risk as the expected value of the
cost.
How to minimize the Bayes Risk
• First notice that
• We can express the Bayes Risk as
• Then we note that, for either likelihood, one can write:
• Merging the last equation into the Bayes Risk expression yields.
• Now we cancel out all the integrals over 𝑅2.
• The first two terms are constant w.r.t. 𝑅1 so they can be ignored.
• Thus, we seek a decision region 𝑅1 that minimizes
• Let’s forget about the actual expression of 𝑔(𝑥) to develop some
intuition for what kind of decision region 𝑅1 we are looking for
- Intuitively, we will select for 𝑅1 those regions that minimize
- In other words, those regions where 𝑔(𝑥) < 0.
• So we will choose 𝑅1 such that
• And rearranging
• Therefore, minimization of the Bayes Risk also leads to an LRT.
• Example
- Consider a problem with likelihoods
and
1. Sketch the two densities
2. What is the likelihood ratio?
3. Assume 𝑃1 = 𝑃2, 𝐶11 = 𝐶22 = 0, 𝐶12 = 1 and 𝐶21 = 31/2
4. Determine a decision rule to minimize 𝑃[𝑒𝑟𝑟𝑜𝑟]
참조:
• Example
LRT variations
• Bayes criterion
– This is the LRT that minimizes the Bayes risk.
• Maximum A Posteriori criterion
– Sometimes we may be interested in minimizing 𝑃[𝑒𝑟𝑟𝑜𝑟].
– A special case of ΛBayes(𝑥) that uses a zero-one cost
– Known as the MAP criterion, since it seeks to maximize 𝑃(𝜔𝑖|
𝑥). • Maximum Likelihood criterion
- For equal priors 𝑃[𝜔𝑖] = 1/2 and 0/1 loss function, the LTR is
known as a ML criterion, since it seeks to maximize 𝑃(𝑥|𝜔𝑖).
Minimum 𝑃[𝑒𝑟𝑟𝑜𝑟] for multi-class problems
• Minimizing 𝑃[𝑒𝑟𝑟𝑜𝑟] generalizes well for multiple classes.
– For clarity in the derivation, we express 𝑃[𝑒𝑟𝑟𝑜𝑟] in terms of
the probability of making a correct assignment
1. The probability of making a correct assignment is
2. Minimizing 𝑃[𝑒𝑟𝑟𝑜𝑟] is equivalent to maximizing 𝑃[𝑐𝑜𝑟𝑟𝑒𝑐𝑡], so
expressing the latter in terms of posteriors
3. To maximize 𝑃[𝑐𝑜𝑟𝑟𝑒𝑐𝑡], we must maximize each integral ∫𝑅 ,
which we achieve by choosing the class with the largest
posterior
4. So each 𝑅𝑖 is the region where 𝑃(𝜔𝑖|𝑥) is maximum, and the
decision rule that minimizes 𝑃[error], is the MAP criterion.
P(correct)를 최대화하려면, 각각의 적분치를 최대화
→ 각 적분치는 P(ωi|x)를 최대로 하는 클래스 ωi를 선택
→ P(ωi|x)가 최대 되는 영역 Ri로 선택
→ 결국 P(error)를 최소화하는 결정규칙: MAP criterion
𝑖
Minimum Bayes risk for multi-class
problems
• Minimizing the Bayes risk also generalizes well
– As before, we use a slightly different formulation.
1. We denote by 𝛼𝑖 the decision to choose class 𝜔𝑖.
2. We denote by 𝛼(𝑥) the overall decision rule that maps feature
vectors 𝑥 into classes 𝜔𝑖, 𝛼(𝑥) → {𝛼1, 𝛼2, …, 𝛼𝐶}
– The (conditional) risk ℜ(𝛼𝑖|𝑥) of assigning 𝑥 to class 𝜔𝑖 is
- And the Bayes Risk associated with decision rule 𝛼(𝑥) is
- To minimize this expression, we must minimize the conditional
risk ℜ(𝛼(𝑥)|𝑥) at each 𝑥, which is equivalent to choosing 𝜔𝑖
such that ℜ(𝛼𝑖|𝑥) is minimum.
Discriminant functions
• All the decision rules have the same structure.
– At each point 𝑥 in feature space, choose class 𝜔𝑖 that
maximizes (or minimizes) some measure 𝑔𝑖(𝑥).
– This structure can be formalized with a set of discriminant
functions 𝑔𝑖(𝑥), 𝑖 = 1, ..., 𝐶, and the decision rule
– Therefore, we can visualize the
decision rule as a network that
computes 𝐶 df’s and selects the
class with highest discriminant.
– And the three decision rules
can be summarized as
Bayes classifiers for Gaussian classes
• For normally Gaussian classes, these DFs reduce to simple
expressions.
– The multivariate Normal pdf is
– Using Bayes rule, the DFs become
– Eliminating constant terms
– And taking natural logs
- This expression is called a quadratic discriminant function.
Quadratic classifiers
• Bayes classifiers for Normally distributed classes
–
–
–
–
–
Case
Case
Case
Case
Case
1:
2:
3:
4:
5:
Σ𝑖
Σ𝑖
Σ𝑖
Σ𝑖
Σ𝑖
= 𝜎2𝐼
=Σ (Σ diagonal)
=Σ (Σ non-diagonal)
= 𝜎𝑖2𝐼
≠Σ𝑗 (general case)
Case 1: 𝚺𝒊 = 𝝈𝟐𝑰
• This situation occurs when features are statistically
independent with equal variance for all classes.
– In this case, the quadratic DFs become.
– Expanding this expression
– Eliminating the term 𝑥𝑇𝑥, which is constant for all classes
- So the DFs are linear, and the boundaries 𝑔𝑖(𝑥) = 𝑔𝑗(𝑥) are
hyper-planes.
Case 1: 𝚺𝒊 = 𝝈𝟐𝑰
– If we assume equal priors
1. This is called a minimum-distance or nearest mean classifier.
2. The equiprobable contours are hyper-spheres.
3. For unit variance (𝜎2 = 1), 𝑔𝑖(𝑥) is the Euclidean distance.
Case 1: 𝚺𝒊 = 𝝈𝟐𝑰
• Example
: Three-class 2D problem with equal priors
Case 2: 𝚺𝒊 = 𝚺 (diagonal)
• Classes still have the same covariance, but features are allowed
to have different variances.
– In this case, the quadratic DFs become.
– Eliminating the term 𝑥𝑘2, which is constant for all classes.
– This discriminant is also linear, so the decision boundaries 𝑔𝑖(𝑥) = 𝑔𝑗
(𝑥) will also be hyper-planes.
– The equiprobable contours are hyper-ellipses aligned with the
reference frame.
– Note that the only difference with the previous classifier is that the
distance of each axis is normalized by its variance.
Case 2: 𝚺𝒊 = 𝚺 (diagonal)
• Example
: Three-class 2D problem with equal priors
Case 3: 𝚺𝒊 = 𝚺 (non-diagonal)
• Classes have equal covariance matrix, but no longer diagonal
– The quadratic discriminant becomes.
- Eliminating the term log|Σ|, which is constant for all classes, and
assuming equal priors
– The quadratic term is called the Mahalanobis distance, a very
important concept in statistical pattern recognition.
– The Mahalanobis distance is a vector distance that uses a Σ−1 norm,
– Σ−1 acts as a stretching factor on the space.
– Note that when Σ=𝐼, the Mahalanobis
distance becomes the familiar Euclidean
distance.
– Expanding the quadratic term
- Removing the term 𝑥𝑇Σ−1𝑥, which is constant for all classes.
– So the DFs are still linear, and the decision boundaries will also be
hyper-planes.
– The equiprobable contours are hyper-ellipses aligned with the
eigenvectors of Σ.
– This is known as a minimum (Mahalanobis) distance classifier.
Case 3: 𝚺𝒊 = 𝚺 (non-diagonal)
• Example
: Three-class 2D problem with equal priors
Case 4: 𝚺𝒊 = 𝝈𝒊𝟐𝑰
• In this case, each class has a different covariance matrix,
which is proportional to the identity matrix
– The quadratic discriminant becomes.
– This expression cannot be reduced further.
– The decision boundaries are quadratic: hyper-ellipses
– The equiprobable contours are hyper-spheres aligned with the
feature axis.
Case 4: 𝚺𝒊 = 𝝈𝒊𝟐𝑰
• Example
: Three-class 2D problem with equal priors
Case 5: 𝚺𝒊≠𝚺𝒋 (general case)
• We already derived the expression for the general case.
– Reorganizing terms in a quadratic form yields
– The equiprobable contours are hyper-ellipses, oriented with the
eigenvectors of Σ𝑖 for that class.
– The decision boundaries are again quadratic: hyper-ellipses or
hyper-parabolloids.
– Notice that the quadratic expression in the discriminant is
proportional to the Mahalanobis distance for covariance Σ𝑖.
Case 5: 𝚺𝒊≠𝚺𝒋 (general case)
• Example
: Three-class 2D problem with equal priors
Conclusions
•
The examples in this lecture illustrate the following
points
– The Bayes classifier for Gaussian classes (general case) is
quadratic.
– The Bayes classifier for Gaussian classes with equal
covariance is linear.
– The Mahalanobis distance classifier is Bayes-optimal for
1. normally distributed classes and
2. equal covariance matrices and
3. equal priors
– The Euclidean distance classifier is Bayes-optimal for
1. normally distributed classes and
2. equal covariance matrices proportional to the identity matrix and
3. equal priors
– Both Euclidean and Mahalanobis distance classifiers are linear
classifiers.
Conclusions
• Thus, some of the simplest and most popular
classifiers can be derived from decision-theoretic
principles.
– Using a specific (Euclidean or Mahalanobis) minimum distance
classifier implicitly corresponds to certain statistical
assumptions.
– The question whether these assumptions hold or don’t can
rarely be answered in practice; in most.
확률밀도 추정 내용
데이터의 통계적 분석 방법
데이터의 확률분포와 패턴인식
확률밀도 추정
최우추정법
모수적 방법
가우시안 확률밀도함수의 최우추정
비모수적 방법
히스토그램법
히스토그램법의 일반화
커널 밀도 추정법
k-근접이웃규칙법
파젠창 방법
가우시안 커널 방법
1) 데이터의 확률분포와 밀도함수
 주어진 데이터의 통계적 분석이란?
 모집단에 대한 확률분포 모델
p(x) 을 세우고
 데이터 xi를 이용하여 확률분포를 추정해 내는 과정
 분류 문제의 경우
 각 클래스에 속한 데이터들은 각각 서로 다른 확률분포를 따른다고 가정
 클래스 Ck에 대한 데이터 x의 조건부 확률 p(x|Ck) 를 고려
1. 학습단계: 각 클래스별 확률밀도함수 p(x|Ck) 추정
2. 분류: 새로운 데이터 xnew 주어졌을 때, 각 클래스 Ck로 관찰될 확률
P(Ck| xnew) 계산하여 이 확률값이 가장 큰 클래스로 분류
2) 데이터의 확률분포와 패턴인식
 패턴인식에서의 활용

xnew

P(Ck|xnew)

xnew ∈ Ci
학습(Learning)
(sample set)
모집단
(data population)
p( x)
데이터
집합
(probability density)
클래스별
확률밀도
인식(Recognition)
후험확률
(posterior probability)
C1
p ( x | C1 )
p (C 1 | x )
C2
p( x | C2 )
p (C 2 | x )

CM


p (C M | x )
p( x | CM )
x new
(class label)
인식결과
y( x)
3) 데이터의 확률분포와 패턴인식
 베이즈 정리
클래스 Ck에 대한 확률밀도함수
추정
→ 베이지안 분류기
4) 데이터의 확률분포와 밀도함수
 생성적 접근법(generative approach)
 먼저
p(x|Ck) 추정 후 P(Ck|xnew) 계산
 추정 과정에서의 오차가 최종 결과에 직접 영향을 줌
 추정한 분포를 이용하면 다양한 분포 특성에 대한 설명 및 성능 개
선을 위한 방법 모색에 도움
 식별적 접근법(discriminative approach)
 직접
P(Ck|xnew)
추정
 간단한 학습 과정
 확률분포의 복잡도와 무관
2. 모수적 확률밀도 추정
1) 데이터의 확률밀도 추정 방법
 모수적 확률밀도 추정(parametric density estimation)

데이터 분포 형태를 가정한 확률 모델을 미리 정하고, 주어진 데이터
를 이용하여 이 모델의 파라미터를 추정함으로써 구체적인 확률밀도
를 얻는 방법

예) 한 클래스에 속하는 데이터 집합의 확률분포 알고 싶을 때, 가우시
안 분포 따른다고 가정하고 파라미터 추정
 비모수적 확률밀도 추정(nonparametric density estimation)

데이터 분포 형태를 어떤 가정도 없이, 데이터로부터 직접 확률밀도를
추정하는 방법
2) 모수적 확률밀도 추정
• 데이터 ~ 가우시안 분포
명시적인 함수 형태를 결정하기 위해서는 주어진 데이터
집합을 이용하여 적절한 파라미터(μk,
Σk) 의 값을 추정
 “파라미터 추정법”
3) 최우(maximum likelihood) 추정
법
• 데이터 집합이 관찰된 가능성(우도, likelihood)을 최대로 하는
파라미터를 찾아 추정치로 정하는 방법
• X ~ p(x; θ) 가정, 데이터 집합 D = {x1, x2, …, xn}일 때, 이 데이터
를 설명할 수 있는 파라미터 θ 찾기
• 각 데이터가 서로 독립적으로 얻어진 것이라면, 전체 데이터 집
합에 대한 우도:
이 우도값을 최대로 하는 파라미터 θ 찾기
반복된 곱셈에 의한 오차 해결 위해
로그함수 적용
로그-우도
단조증가함수(monotonic increasing function)이므로 로그 취하기 전의 함수와 같은 곳에서 최대값
원하는 파라미터 추정치 θ
 l(θ)를 최대로 하는 값
편미분방정식 ∂l/∂θ = 0 만족하는 파라미터 값 찾기
“최우추정량”
(maximum likelihood estimator)
4) 가우시안 확률밀도함수의 최우추정
• p(x|Ck) ~ 가우시안 분포
하나의 데이터 x에 대한 로그-우도 함수
전체 데이터 집합 X = {x1, x2, …, xn} 에 대한 로그-우도 함수
파라미터와 관련없는 상수항
l(θ)를 각각 μk와 Σk에 대해 미분

l(θ)를 각각 μk와 Σk에 대해 미분
 l ( )

 k
N
   (
i 1
1
k
( xi   k ))  0
공분산 행렬의 역행렬을 Λk = Σk-1 정의. 여기서 ln A-1 = -ln A
N
l ( ) 
1
 ( 2 ( x
  k )  k ( x i   k )) 
T
i
i 1
 파라미터의 최우추정량
 l ( )
 k
데이터의 표본평균
데이터의 표본공분산
N
2
N
ln  k  const
  (
i 1


1
2
( x i   k )( x i   k ) ) 
T
1 T
ln   (  )
N
2
1 T
관계를 이용
( k )  0
7) 가우시안 확률밀도함수의 최우추정 예
 가우시안 분포로부터 100개 데이터 생성 μ=0, σ=1
0.45
0.4
0.35
p(x)
0.3
0.25
0.2
0.15
0.1
0.05
0
-3
-2
-1
0
1
2
3
 실제 밀도함수와 최우추정된 밀도함수가 거의 유사
8) 최우추정법의 문제점
 데이터 분포에 대해 가정한 확률밀도함수 형태가 적절하지 못한 경우
추정된
밀도함수
모집단의
밀도함수
 실제 밀도함수와 최우추정된 밀도함수간의 차이 발생
3. 비모수적 확률밀도 추정
1) 히스토그램법

주어진 데이터가 가지는 값의 범위를 일정 간격의 구간들로 나누
고, 각 구간에 존재하는 데이터 비율(개수)을 표현하는 막대그래프
0.5
0.45
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
-3
-2
-1
0
1
2
3
 우선, 히스토그램의 시작점
x0와 각 구간의 간격(막대-폭) h를 결정
해당 구간에 속하는 데이터 개수
i번째 구간의 확률값
전체 데이터 개수
각 구간에 대한 확률밀도함수 추정식
x에 포함되는 구간에 속하는 데이터 개수
n차원 데이터 x에 대한 확률밀도함수 추정식
데이터 빈도수를 측정하는 구간의 부피
 막대-폭의 변화에 따른 결과
h=0.25
0.5
0.4
0.5
h=0.5
0.45
0.3
0.4
0.35
0.2
0.3
0.25
0.1
0.2
0
-3
0.15
0.1
0.5
0.05
0.45
0
-3
-2
-1
0
1
2
3
-2
-1
0
1
2
3
h=1.0
0.4
0.35
 히스토그램범의 문제점
0.3
0.25
0.2
• 적절한 h값의 선정
• 입력차원의 증가에 따른 계산 구간의 급증
• 불연속적이고 매끄럽지 못한 추정 분포
0.15
0.1
0.05
0
-3
-2
-1
0
1
2
3
2) 히스토그램법의 일반화
 n차원 랜덤벡터 X에 대한 X=x일 때의 확률밀도함수
데이터 빈도수를 측정하는 영역의 부피(V)의 값을 어떻게 선택하느냐?
영역의 부피(V)와 데이터의 개수(K)는 서로 의존적
모든 영역의 V를 하나의 값으로 고정하고, 각 영역에 속하는 데이터의
수 K를 계산해서 추정하는 방법  “커널 밀도 추정법”
한 영역에 속하는 K를 고정하고, K개의 데이터를 가질 수 있도록
체적 V값을 계산함으로써 추정하는 방법  “k-NNR” (5장)
3) 커널 밀도함수 추정법
각 x를 중심으로 부피가 V인
영역 안에 속하는 데이터의 수
K(x)를 계산하는 방법
(커널 함수의 종류에 따라)
초입방체 형태의 커널 함수
파젠창(Parzen window) 방법
가우시안 밀도함수
가우시안 커널 방법
4) 파젠창 방법
커널 함수 φ(x)
V=1인 초입방체 형태의 창
함수 K(x)
너비 h인 초입방체
(V=hn) 안에 속하는
데이터 수 K(x)
확률밀도함수 추정식
5) 파젠창 방법 의한 밀도함수 추정
0.5
추정결과
h=1.0
0.5
0.45
0.45
원래 함수
0.4
0.4
0.35
0.35
0.3
0.3
0.25
0.25
0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0
-3
h=0.5
-2
-1
0
1
2
3
0
-3
-2
-1
0
1
2
3
6) 파젠창 방법 의한 밀도함수 추정
모집단의 확률밀도함수
h=1.0
학습용 데이터 집합
h=0.5
7) 가우시안 커널 방법
 보다 일반적인 커널함수로의 확장
 파젠창의 불연속적인 문제 해결
 새로운 커널함수가 만족해야 할 조건
가우시안 밀도 함수
“가우시안 커널 방법”
확률밀도함수 추정식
8) 가우시안 커널 의한 확률밀도 추정
0.5
h=1.0
0.5
0.45
0.45
원래 함수
0.4
0.4
0.35
0.35
0.3
추정결과
0.3
0.25
0.25
0.2
0.2
0.15
0.15
0.1
0.1
0.05
0.05
0
-3
h=0.5
-2
-1
0
1
2
3
0
-3
-2
-1
0
1
2
3
9) 가우시안 커널 의한 확률밀도 추정
모집단의 확률밀도함수
h=1.0
학습용 데이터 집합
h=0.5
01_우도비 검증
 데이터의 확률밀도함수를 알 경우의 클래스의 분류
→ 우도비 검증 (LRT)
: 우도비(likelihood ratio)
60
01_우도비 검증
 데이터의 확률밀도함수를 알 경우의 클래스의 분류
P(ω1) = P(ω2)
61
01_우도비 검증
 데이터의 확률밀도함수를 알 경우의 클래스의 분류
62
01_우도비 검증
 데이터의 확률밀도함수를 알 경우의 클래스의 분류
63
02_오류확률
분류기: 특징 공간을 결정 영역으로 분할
 특징공간을 (R1, R2) 영역으로 분할하면, 잘못 분류하는 경우
: 클래스 ω1에 속하는 특징 벡터 x를 R2로 결정하는 경우와 ω2의 특징
벡터 x를 R1로 결정하는 경우
 각 클래스에서 발생할 오류확률:
64
02_오류확률
 2-클래스 문제에서의 오류확률:
: 사전확률 같은 경우
LRT 결정규칙 통한 결정 경계는
오류확률 이용해도 구할 수 있음.
→ x의 오류확률을 사후확률로 표현
65
02_오류확률
 오류확률을 통한 결정경계의 결정
 어떤 x가 주어진 경우 P(error)를 사후 확률 P(error|x)로 표현
 최적의 결정경계 = 최소오류확률
→ 적분값 최소되기 위해 P(error | x) 최소되어야.
점 x*에서 오류확률 P(error| x*)는
ω2를 ω1로 선택할 확률 P(ω1| x*) 의미
→ 결국 xB 위치에서 최소: Bayes error rate
66
03_베이즈 위험
 베이즈 위험(risk)의 의미
 패턴 분류기가 잘못 분류하여 발생하는 비용(
적용한 비용의 기대값, R = E[C]
)의 개념을 베이즈 분류기에
Cij: 실제로는 ωj 클래스에 속하지만, 클래스 ωi 를 선택하여 발생하는 비용(벌점)
 위의 두 식을 이용하여 전개하면, 베이즈 위험:
67
03_베이즈 위험
 베이즈 위험을 최소화하는 결정규칙
: 각 영역에서
우도의 합은 항상 1
변형
68
03_베이즈 위험
 각 영역의 우도 합은 1이므로,
12
 위 식에서 처음 두 항은 R1과 무관, 상수에 불과하므로 제거.
→ 적분식을 최소화하는 g(x) < 0 조건을
가진 영역 R1을 선택하는 문제
69
03_베이즈 위험
70
03_베이즈 위험
 베이즈 위험의 최소화 통해 결정경계 결정
71
03_베이즈 위험
72
03_베이즈 위험
참조:
73
03_베이즈 위험
74
04_LRT 결정규칙의 변형
 베이즈 규준
 베이즈 위험을 최소화하는 LRT 결정규칙을 베이즈 규준(Bayes criterion)
 MAP 규준
 대칭적이거나 비용값이 0 아니면 1인 제로-원 비용함수를 사용하면 베이즈 규준은
사후 확률 (P(ωi|x))의 비로 표현. 이는 사후 확률을 최대화한다는 의미에서
MAP(Maximum A Posterior) 규준이라고 함.
75
04_LRT 결정규칙의 변형
 ML 규준
 사전 확률(P(ωi))이 같고 제로-원 비용함수 경우, 베이즈 규준은 우도 (P(x|ωi))의
비로 표현
 이는 우도를 최소화한다는 의미에서 ML(Maximum Likelihood) 규준이라고 함.
76
05_다중 클래스 결정규칙
 오류확률을 이용한 다중 클래스 결정규칙
 오류확률을 최소화하는 결정규칙은 다중 클래스(multi-class) 문제로 쉽게
일반화할 수 있음.
P(correct)를 최대화하려면, 각각의 적분치를 최대화
→ 각 적분치는 P(ωi|x)를 최대로 하는 클래스 ωi를 선택
→ P(ωi|x)가 최대되는 영역 Ri로 선택
→ 결국 P(error)를 최소화하는 결정규칙: MAP 규준
77
05_다중 클래스 결정규칙
78
05_다중 클래스 결정규칙
 베이즈 위험 이용한 다중 클래스 결정규칙
 클래스 ωi를 선택하는 결정: αi.
 특징 x를 클래스 ωi 로 매핑하는 전체 결정규칙: α(x) → {α1, α2, …, αc}
 특징 x를 클래스 ωi 로 할당하는 베이즈 위험:
 전체 결정규칙 α(x)와 관련된 베이즈 위험:
위 식을 최소화 위해
특징공간의 x에서
베이즈 위험 R(α(x)|x) 최소화
→ R(αi|x)이 최소인 ωi 선택
79
06_판별함수
 앞에서 언급된 모든 결정 규칙은 같은 구조: 특징 공간에서 각 점
x에서 판별함수 gi(x)를 최대화(또는 최소화)하는 클래스 ωi를 선택
→ 판별함수 {gi(x), i = 1, …, c} 집합으로
수식화 가능
80
06_판별함수
 c개의 클래스 중 하나로 결정하는 시스템은 c개의 판별함수로 구성된 네트워크로
표현하여 가장 큰 값을 출력하는 카테고리를 선택하는 구조
 최종적으로 판별함수 일반항으로 베이즈, MAP, ML의 세 가지의 규준을 정리
81
07_최우추정법에 의한 확률밀도함수의 추정
 '추정'이란 표본 집합의 데이터들로부터 정확하지는 않지만 대강 그럴듯한 어떤
값을 알아내는 것
 수집된 표본으로부터 확률밀도함수를 추정하는 문제는 확률 통계적 방법을
이용하여 미지의 패턴을 인식하기 위해서 중요한 이론
: 채집된 표본들에서 각 클래스의 확률밀도함수 추정 방법
 베이즈 정리:
: 사전확률과 우도 필요
여기서 우도(해당 클래스의 확률밀도함수)는 표준 데이터에서 추정
모수적 추정법: 데이터 집합 이루는 확률밀도함수가 가우시안 분포라고 가정하고
평균, 공분산 등을 추정
비모수적 방법: 주어진 데이터에서 직접 밀도함수 유도. 예) 히스토그램 방법 등
82
07_최우추정법에 의한 확률밀도함수의 추정
 최대 우도 추정(MLE : Maximum Likelihood Estimation)
 파라미터 θ = (θ1, .., θM)로 구성된 확률밀도함수 P(x| θ)에서 관측된 표본 데이터
집합을 x = (x1, …, xn)라고 할 때, 표본들로부터 파라미터 θ 추정하는 문제
 전체 표본집합:
→ 파라미터 θ에 따른 데이터 집합의 우도 함수
 로그 우도 함수
: 곱으로 구성된 우도함수를 합으로 표현하기 위해 로그
로그함수는 단조증가함수 → 우도 최대화
83
07_최우추정법에 의한 확률밀도함수의 추정
 로그 우도를 사용하는 이유
 확률값과 같이 부동 소수점으로 표현되는 아주 작은 수를 많이 다룸.
 작은 수의 곱셈에서는 필연적으로 수치적 언더플로우(numerical underflow)
문제에 직면
 로그 연산을 행하면 곱셈의 로그값이 덧셈이 되므로 이와 같이 1보다 작은 수를
곱하는 경우에 발생하는 수치적 언더플로우의 문제를 방지할 수 있음.
 로그-우도 함수의 최대값 구하기
 θ에 대한 편미분식을 0으로 두면,
84
07_최우추정법에 의한 확률밀도함수의 추정
(후보)
: 우도 최대화하는 위치와 로그-우도함수의 경우가 동일
85
07_최우추정법에 의한 확률밀도함수의 추정
 최우 추정 단계
D : 데이터 집합
86
07_최우추정법에 의한 확률밀도함수의 추정
 가우시안 확률밀도함수에 대한 최대우도추정
 x = (x1, …, xR)이 x ~ N(μ, σ2)인 상호 독립 및 동일 확률분포 조건에서 생성된
표본이라 가정하면, θ = (θ1, θ2) = (μ, σ) ? i.i.d(independent and identically-distributed)
 로그 우도:
 l(θ)의 그래디언트:
θ1, θ2 에 대해 각각 미분
d
dx
(log u ) 
1 du
u dx
설정
: MLE 결과는 각각 표준과 분산
87
07_최우추정법에 의한 확률밀도함수의 추정
 추정 결과에 대한 기대값과 실제 값을 비교
 표본 평균의 기대값:
→ 표본 평균은 실제 평균과 일치 : 어긋나지 않은 추정, “unbias 추정됨”.
 표본 분산의 기대값:
→ 표본 분산은 실제 분산과 어긋남 : bias 추정됨.
표본 분산의 계산과정에서 실제 평균 대신에 표본 평균 사용하기 때문
표본 데이터 수인 R이 충분히 크면, 오차는 무시 가능
: R이 작으면, 정확한 통계적 처리할 수 없음.
88
07_최우추정법에 의한 확률밀도함수의 추정
 표본 데이터가 다차원의 다변량 데이터인 경우
 x = (x1, …, xR)이 x ~ N(μ, Σ)인 상호 독립 및 동일 확률분포 조건에서 생성된
표본이라 가정하면, θ = (θ1, θ2) = (μ, Σ) ?
 표본과 공분산 행렬:
89
08_MATLAB 실습
90
08_MATLAB 실습
91
Download