통계이론

Probability

2023. 1. 14. 22:17
목차
  1. 1. 확률이란?
  2. 2. 확률 이론 기초
  3. 1) Random Variable
  4. 2) Fundamental rules
  5. 3) Bayes rule
  6. 4) Independence and conditional independence
  7. 5) Continuous random variables
  8. 6) Mean and variance
  9. 3. 대표적인 확률 분포
  10. 1) discrete distributions
  11. 2) continuous distributions
  12. 4. 결합 확률 분포
  13. 1) Covariance and correlation
  14. 2) multivariate Gaussian
  15. 5. Transformations of random variables
  16. 1) Linear transformations
  17. 2) Central Limit Theorem(중심극한정리)
  18. 6. Monte Carlo approximation

확률 기초 이론을 정리해두고자 한다. 머피 책 Machine Learning - A Probabilistic Perspective, 위키피디아를 참고하였다.

 

1. 확률이란?

Probability theory is nothing but common sense reduced to calculation. — Pierre Laplace, 1812

 

확률(probability)에는 두 가지 관점이 있다.

  • frequentist interpretation: it defines an event's probability as the limit of its relative frequency in many trials (the long-run probability)
  • Bayesian interpretation: probability is used to quantify our uncertainty about something; hence it is fundamentally related to information rather than repeated trials

 

2. 확률 이론 기초

1) Random Variable

  • mathematical formalization of a quantity or object which depends on random events
  • a mapping or a function from possible outcomes in a sample space to a measurable space, often the real numbers
  • Discrete or Continuous

 

2) Fundamental rules

◉ Probability of a union of two events

P(A∪B)=P(A)+P(B)−P(A∩B)=P(A)+P(B). if A and B are mutually exclusive

 

◉ Joint probabilities

  • product rule:  p(A,B)=p(A∩B)=p(A|B)P(B)
  • marginal distribution:  p(A)=∑bp(A,B)=∑bp(A|B=b)p(B=b) (rule of total probability)
  • chain rule:  p(X1:D)=p(X1)p(X2|X1)p(X3|X2,X1)p(X4|X1,X2,X3)⋯p(XD|X1:D−1)

 

◉ Conditional probability

p(A|B)=p(A,B)p(B) .if p(B)>0

 

3) Bayes rule

p(X=x|Y=y)=p(X=x,Y=y)p(Y=y)=p(X=x)p(Y=y|X=x)∑x´p(X=x´)p(Y=y|X=x´)

 

4) Independence and conditional independence

두 확률변수 X,Y가 독립(unconditionally independent, marginally independent)일 때, 결합확률분포를 marginal 확률의 곱으로 표현할 수 있다.

X⊥Y ⇔ p(X,Y)=p(X)p(Y)

 

두 확률변수 X,Y가 Z에 대해 독립일 때(conditionally independent)일 때, 결합확률분포를 conditional margiinal 확률의 곱으로 표현할 수 있다.

X⊥Y|Z ⇔ p(X,Y|Z)=p(X|Z)p(Y|Z)

 

5) Continuous random variables

확률변수 X의 cumulative distribution function을 F(q)=p(X≤q)이라고 하자. 구간 (a,b]의 확률은 p(a<X≤b)=F(b)−F(a)로 표현할 수 있다. 이때 f(x)=ddxF(x)인 f를 probability density function이라고 하며 확률을 다음과 같이 정의할 수 있다.

p(a<X≤b)=∫abf(x)dx

 

6) Mean and variance

◉ mean

평균은 확률변수 x의 기대값(expected value)이다.

μ=E[x]=∑x∈xx⋅p(x)

 

◉ variance

분산은 확률변수 x의 퍼짐의 정도이다('spread' of distribution).

σ2 = var[X]=E[(X−μ)2]=∫(x−μ)2p(x)dx = E[X2]−μ2

 

3. 대표적인 확률 분포

1) discrete distributions

◉ Bernoulli and binomial distributions

𝕩𝟙Ber(x|θ)=θI(x=1)(1−θ)I(x=0)={θif x=11−θif x=0

 

Bin(k|n,θ)=(nk)θk(1−θ)n−k,where (nk)=n!(n−k)!k!

 

◉ Poisson distribution

Poi(x|λ)=e−λλxx!

 

◉ empirical distribution

pemp(A)=1N∑i=1Nδxi(A)δx(A)={1if x∈00if x∉0

 

2) continuous distributions

◉ Gaussian (normal) distribution

N(x|μ,σ2)=12πσ2e−12σ2(x−μ)2

 

◉ Laplace distribution

Lap(x|μ,b)=12be−|x−μ|b

 

4. 결합 확률 분포

1) Covariance and correlation

◉ covariance

cov[X,Y]=E[(X−E[X])(Y−E[Y])]=E[XY]−E[X]E[Y]

 

◉ covariance matrix

cov[x]=E[(x−E[x])(x−E[x])T]=(var[X1]cov[X1,X2]⋯cov[X1,Xd]cov[X2,X1]var[X2]⋯cov[X2,Xd]⋮⋮⋱⋮cov[Xd,X1]cov[Xd,X2]⋯var[Xd])

 

◉ Pearson correlation coefficient

corr[X,Y]=cov[X,Y]var[X]var[Y]

 

R=(corr[X1,X1]corr[X1,X2]⋯corr[X1,Xd]⋮⋮⋱⋮corr[Xd,X1]corr[X1,X2]⋯corr[Xd,Xd])

 

2) multivariate Gaussian

N(x|μ,Σ)=1(2π)D/2|Σ|1/2exp[−12(x−μ)TΣ−1(x−μ)]

 

5. Transformations of random variables

1) Linear transformations

f()를 y=f(x)=Ax+b와 같은 linear funcion이라고 하자. 이때 y의 mean, covariance는 다음과 같이 정의할 수 있다.

  • E[y]=E[Ax+b]=Aμ+b
  • cov[y]=cov[Ax+b]=AΣAT, Σ=cov[x]

 

2) Central Limit Theorem(중심극한정리)

CLT는 어떤 집단(population)이 있을 때 해당 집단의 분포가 아닌 집단의 sampling distribution에 관한 정리이다. 어떤 집단의 분포를 모르는 상황에서 ➀매번 N개의 sample을 i.i.d.(independent and identically distributed)하게 뽑고 ➁각 sample들의 평균을 계산한다고 하자. 그리고 SN=∑i=1NXi라는 새로운 random variable을 정의하고, 각 sample mean을 X¯=1N∑i=1Nxi이라는 random variable로 정의하자. 이때 N이 커질수록 SN은 다음의 분포를 따른다.

p(SN=s)=12πNσ2exp(−(s−Nu)22Nσ2)

 

이때 ZN=SN−NuσN=X¯−μσN이라는 random variable은 standard normal distribution으로 수렴한다.

 

위 내용은 책의 설명인데 조금 어렵게 설명되어있는 듯 하다. CLT의 핵심은 다음과 같다(참고).

sampling distribution of the mean will always be normally distributed, as long as the sample size is large enough. Regardless of whether the population has a normal, Poisson, binomial, or any other distribution, the sampling distribution of the mean will be normal.

모집단(population)의 평균을 μ, 표준편차를 σ라고 하자. 이때 sampling distribution의 평균과 분산은 각각 다음과 같다.

μx¯=μσx¯=σn

이때 samping distribution of the mean은 X¯∼N(μ,σn)와 같은 분포를 따른다. 

 

그럼 CLT는 언제쓰냐? 글1, 글2과 같이 모집단의 분포 정보(μ,σ)를 추정하고, 이를 활용하여 hypothetical testing 등에 활용된다.

 

6. Monte Carlo approximation

몬테카를로 방법(Monte Carlo method)은 반복된 무작위 추출(repeated random sampling)을 이용하여 함수의 값을 수리적으로 근사하는 알고리즘을 부르는 용어이다.

일반적으로 어떤 random variable X가 있을 때, 이에 대한 함수 f(X)를 계산하는 것은 어렵다. 이를 수학적으로 계산하기 위해서 Monte Carlo approximation을 사용할 수 있다. 먼저 ➀f(X)로 부터 S개의 sample x1,⋯,xS를 얻는다. ➁그리고 empirical distribution {f(xs)}s=1S를 사용하여 f(X)의 분포를 추정한다.

 

Monte Carlo approximation를 사용하면 어떠한 function of a random variable이 있어도 expected value를 추정할 수 있다. 예를 들어 sample들을 통해 함수의 수학적 평균을 다음과 같이 계산할 수 있다.

E[f(X)]=∫f(x)p(x)dx≈1S∑s=1Sf(xs), where xs∼p(X)

뿐만 아니라 아래와 같이 다양한 quantity를 추정할 수 있다.

  • x¯=1S∑s=1Sxs→E[X]
  • 1S∑s=1S(xs−x¯)2→var[X]
  • 1S#{xs≤c}→P(X≤c)
  • median{x1,⋯,xS}→median(X)

 

Monte Carlo는 수학적 분석에서도 많이 사용된다(참고: Monte Carlo integration)

 

 

 

728x90
저작자표시 비영리 변경금지 (새창열림)

'통계이론' 카테고리의 다른 글

Bayesian view of the probability  (0) 2023.01.21
  1. 1. 확률이란?
  2. 2. 확률 이론 기초
  3. 1) Random Variable
  4. 2) Fundamental rules
  5. 3) Bayes rule
  6. 4) Independence and conditional independence
  7. 5) Continuous random variables
  8. 6) Mean and variance
  9. 3. 대표적인 확률 분포
  10. 1) discrete distributions
  11. 2) continuous distributions
  12. 4. 결합 확률 분포
  13. 1) Covariance and correlation
  14. 2) multivariate Gaussian
  15. 5. Transformations of random variables
  16. 1) Linear transformations
  17. 2) Central Limit Theorem(중심극한정리)
  18. 6. Monte Carlo approximation
'통계이론' 카테고리의 다른 글
  • Bayesian view of the probability
Fine애플
Fine애플
이것저것
끄적끄적이것저것
Fine애플
끄적끄적
Fine애플
전체
오늘
어제
  • 분류 전체보기 (167)
    • 논문 및 개념 정리 (27)
    • Pattern Recognition (8)
    • 개발 (57)
    • python 메모 (45)
    • pytorch, tensorflow (5)
    • 알고리즘 (9)
    • Toy Projects (4)
    • 통계이론 (2)
    • Reinforcement Learning (10)

블로그 메뉴

  • 홈

공지사항

인기 글

태그

  • miniconda
  • Docker
  • 개발환경
  • Bert
  • PyTorch
  • 언어모델
  • tensorflow
  • container
  • 딥러닝
  • reinforcement learning
  • 자연어
  • GPU
  • transformer
  • pandas
  • ubuntu
  • BigBird
  • python
  • 알고리즘
  • Probability
  • nlp

최근 댓글

최근 글

hELLO · Designed By 정상우.
Fine애플
Probability
상단으로

티스토리툴바

개인정보

  • 티스토리 홈
  • 포럼
  • 로그인

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.