• Mindscape ๐Ÿ”ฅ
    • Playlist ๐ŸŽง
  • ๐Ÿค– Artifical Intelligence

    • 1. Basics; Linear Algebra
    • 2. Basics; Linear Algebra (2), Search (1)
    • 3. Search (2)
    • 4. Knowledge and Logic (1)
    • 5. Knowledge and Logic (2)
    • 6. Probability
    • 7. Information Theory
    • 8. Probabilitc Reasoning (2)
    • 9. Probabilitc Reasoning (3)
    • 10. Machine Learning (1)
    • 11. Machine Learning (2)
    • 12. Machine Learning (3)
    • 13. Linear Models
    • 14. Other Classic ML Models (1)
    • 15. Other Classic ML Models (2)
  • ๐Ÿ”’ Computer Security

    • 01. Overview
    • 02. ์ •๋ณด๋ณด์•ˆ์ •์ฑ… ๋ฐ ๋ฒ•๊ทœ
    • 03. Cryptographic Tools
    • 04. User Authentication
    • 05. Access Control
    • 06. Database Security
    • 07. Malicious Software
    • 08. Firmware Analysis
  • ๐Ÿ—„๏ธ Database System

    • 1. Introduction
    • 2. Relational Model
    • 3. SQL
    • 6. E-R Model
    • 7. Relational Database Design (1)
    • 7. Relational Database Design (2)
    • 13. Data Storage Structures
    • 14. Indexing
    • 15. Query Processing
  • ๐Ÿ“ Software Engineering

    • 2. Introduction to Software Engineering
    • 3. Process
    • 4. Process Models
    • 5. Agile
    • 6. Requirements
    • 7. Requirements Elicitation and Documentation
    • 8. Architecture
    • 9. Unified Modelling Language
    • 10. Object-Oriented Analysis
    • Object-Oriented Design
  • ๐Ÿง  Algorithm

    • Python ์‹œ๊ฐ„ ์ดˆ๊ณผ ๋ฐฉ์ง€๋ฅผ ์œ„ํ•œ ํŒ
    • C++ std::vector ์‚ฌ์šฉ๋ฒ• ์ •๋ฆฌ
    • Vim ์‚ฌ์šฉ ๋งค๋‰ด์–ผ
    • 1018๋ฒˆ: ์ฒด์ŠคํŒ ๋‹ค์‹œ ์น ํ•˜๊ธฐ
    • 1966๋ฒˆ: ํ”„๋ฆฐํ„ฐ ํ

8. Probabilitc Reasoning (2)

Revisiting Probabilistic Inference

  • ํ™•๋ฅ ์  ์ถ”๋ก  (Probabilistic Inference) ์‹œ์Šคํ…œ์˜ ๊ธฐ๋ณธ ์ž‘์—…์€ ์‚ฌํ›„ ํ™•๋ฅ  ๋ถ„ํฌ (Posterior Probability Distribution)๋ฅผ ๊ณ„์‚ฐํ•˜๋Š” ๊ฒƒ, ์ฆ‰ P(QโˆฃE=e)\mathbf{P}(Q|E=e)P(QโˆฃE=e)๋ฅผ ๊ตฌํ•˜๋Š” ๊ฒƒ
  • QQQ: Query variables (์งˆ์˜ ๋ณ€์ˆ˜). ๋‹จ์ˆœํ™”๋ฅผ ์œ„ํ•ด ํ•˜๋‚˜์˜ ์งˆ์˜ ๋ณ€์ˆ˜ XXX๋งŒ ๊ณ ๋ ค
  • EEE: Evidence variables (์ฆ๊ฑฐ ๋ณ€์ˆ˜). eee: ์ฆ๊ฑฐ ๋ณ€์ˆ˜์— ํ• ๋‹น๋œ ๊ฐ’
  • YYY: Hidden (Non-evidence, Non-query) variables (์€๋‹‰ ๋ณ€์ˆ˜).
  • ์ „์ฒด ๋ณ€์ˆ˜ ์ง‘ํ•ฉ์€ XโˆชEโˆชYX \cup E \cup YXโˆชEโˆชY์ด๋ฉฐ, ๋ชฉํ‘œ๋Š” P(Xโˆฃe)\mathbf{P}(X|e)P(Xโˆฃe)๋ฅผ ๋„์ถœ

Inference by Enumeration (์—ด๊ฑฐ๋ฅผ ํ†ตํ•œ ์ถ”๋ก )

  • ์ž„์˜์˜ ์กฐ๊ฑด๋ถ€ ํ™•๋ฅ ์€ ์™„์ „ ๊ฒฐํ•ฉ ๋ถ„ํฌ (Full Joint Distribution)์˜ ํ•ญ๋“ค์„ ํ•ฉ์‚ฐํ•˜์—ฌ ๊ณ„์‚ฐ ๊ฐ€๋Šฅ
  • P(Xโˆฃe)=ฮฑP(X,e)=ฮฑโˆ‘yP(X,e,y)\mathbf{P}(X|e) = \alpha\mathbf{P}(X, e) = \alpha \sum_{y} \mathbf{P}(X, e, y)P(Xโˆฃe)=ฮฑP(X,e)=ฮฑโˆ‘yโ€‹P(X,e,y)
  • ๋”ฐ๋ผ์„œ, ๋ฒ ์ด์ฆˆ ๋„ท (Bayes net)์„ ์‚ฌ์šฉํ•˜์—ฌ ์กฐ๊ฑด๋ถ€ ํ™•๋ฅ ์˜ ๊ณฑ์˜ ํ•ฉ์„ ๊ณ„์‚ฐํ•จ์œผ๋กœ์จ ์งˆ์˜์— ์‘๋‹ต ๊ฐ€๋Šฅ
  • ์˜ˆ์‹œ: ๊ฒฝ๋ณด (Alarm) ์˜ˆ์ œ์—์„œ ์งˆ์˜ P(BโˆฃJ=true,M=true)\mathbf{P}(B|J=true, M=true)P(BโˆฃJ=true,M=true), ์€๋‹‰ ๋ณ€์ˆ˜ A,EA, EA,E

    P(bโˆฃj,m)=ฮฑโˆ‘eโˆ‘aP(b,j,m,e,a)P(b|j,m) = \alpha \sum_{e} \sum_{a} P(b, j, m, e, a) P(bโˆฃj,m)=ฮฑeโˆ‘โ€‹aโˆ‘โ€‹P(b,j,m,e,a)

    =ฮฑโˆ‘eโˆ‘aP(b)P(e)P(aโˆฃb,e)P(jโˆฃa)P(mโˆฃa)= \alpha \sum_{e} \sum_{a} P(b)P(e)P(a|b, e)P(j|a)P(m|a) =ฮฑeโˆ‘โ€‹aโˆ‘โ€‹P(b)P(e)P(aโˆฃb,e)P(jโˆฃa)P(mโˆฃa)

    =ฮฑP(b)โˆ‘eP(e)โˆ‘aP(aโˆฃb,e)P(jโˆฃa)P(mโˆฃa)= \alpha P(b) \sum_{e} P(e) \sum_{a} P(a|b, e)P(j|a)P(m|a) =ฮฑP(b)eโˆ‘โ€‹P(e)aโˆ‘โ€‹P(aโˆฃb,e)P(jโˆฃa)P(mโˆฃa)

  • ์ด ๋ฐฉ๋ฒ•์˜ ๊ณ„์‚ฐ ๋ณต์žก๋„๋Š” nnn๊ฐœ์˜ ๋ถˆ๋ฆฌ์–ธ ๋ณ€์ˆ˜์— ๋Œ€ํ•ด O(2n)O(2^n)O(2n)๋กœ, ๋Œ€๊ทœ๋ชจ ๋ฒ ์ด์ฆˆ ๋„ท (Bayesian Networks)์— ๋Œ€ํ•ด์„œ๋Š” ๋‹ค๋ฃจ๊ธฐ ํž˜๋“ฆ (intractable)

Approximate Inference for Bayeisan Networks

Approximate Inference (๊ทผ์‚ฌ ์ถ”๋ก )

  • ๋Œ€๊ทœ๋ชจ ๋ฒ ์ด์ฆˆ ๋„ท (Bayesian networks)์— ๋Œ€ํ•œ ์ •ํ™•ํ•œ ์ถ”๋ก  (Exact Inference)์˜ ๋ณต์žก๋„ O(2n)O(2^n)O(2n) ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ Solution: ๋ฌด์ž‘์œ„ ์ƒ˜ํ”Œ๋ง ์•Œ๊ณ ๋ฆฌ์ฆ˜ (Randomized Sampling Algorithms) ๋˜๋Š” Monte Carlo algorithms
  • Monte Carlo algorithms๋Š” ์ƒ์„ฑ๋œ ์ƒ˜ํ”Œ์˜ ์ˆ˜์— ๋”ฐ๋ผ ์ •ํ™•๋„๊ฐ€ ๋‹ฌ๋ผ์ง€๋Š” ๊ทผ์‚ฌ ํ•ด๋‹ต์„ ์ œ๊ณต
  • ๋ฒ ์ด์ฆˆ ๋„ท (Bayes net)์˜ ํ™•๋ฅ ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ฌด์ž‘์œ„ ์ด๋ฒคํŠธ (Random Events)๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ๋ฐœ๊ฒฌ๋œ ์ƒ์ดํ•œ ํ•ด๋‹ต๋“ค์„ ์นด์šดํŒ… (Counting)ํ•˜์—ฌ ์ž‘๋™
  • ์ถฉ๋ถ„ํ•œ ์ƒ˜ํ”Œ์ด ์žˆ์œผ๋ฉด, ์ฐธ ํ™•๋ฅ  ๋ถ„ํฌ (True Probability Distribution)์— ์ž„์˜๋กœ ๊ฐ€๊น๊ฒŒ ๊ทผ์ ‘ ๊ฐ€๋Šฅ
  • ๋ฒ ์ด์ฆˆ ๋„ท (Bayes nets)์—์„œ ์‚ฌํ›„ ํ™•๋ฅ  P(Xโˆฃe)\mathbf{P}(X|e)P(Xโˆฃe)์˜ ๊ณ„์‚ฐ์— ์ ์šฉ๋˜๋Š” ์ƒ˜ํ”Œ๋ง (Sampling)์— ๊ด€์‹ฌ

Direct Sampling Methods (์ง์ ‘ ์ƒ˜ํ”Œ๋ง ๋ฐฉ๋ฒ•)

  • ์ž„์˜์˜ ์ƒ˜ํ”Œ๋ง (Sampling) ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ๊ธฐ๋ณธ ์š”์†Œ๋Š” ์•Œ๋ ค์ง„ ํ™•๋ฅ  ๋ถ„ํฌ (Probability Distribution)์—์„œ ์ƒ˜ํ”Œ์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ
  • ๋ณ€์ˆ˜๋“ค์„ ์œ„์ƒ ์ˆœ์„œ (Topological Order)๋กœ ์ฐจ๋ก€๋กœ ์ƒ˜ํ”Œ๋ง
  • ๊ฐ’์ด ์ƒ˜ํ”Œ๋ง๋˜๋Š” ํ™•๋ฅ  ๋ถ„ํฌ๋Š” ์ด๋ฏธ ํ• ๋‹น๋œ ๋ถ€๋ชจ ๋ณ€์ˆ˜ (Parents)์˜ ๊ฐ’์— ์กฐ๊ฑดํ™”๋จ

Rejection Sampling (๊ธฐ๊ฐ ์ƒ˜ํ”Œ๋ง)

  • ์ƒ˜ํ”Œ๋งํ•˜๊ธฐ ์–ด๋ ค์šด ๋ถ„ํฌ์—์„œ ์ƒ˜ํ”Œ์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์ผ๋ฐ˜์ ์ธ ๋ฐฉ๋ฒ•. ์‰ฌ์šด ์ƒ˜ํ”Œ๋ง ๋ถ„ํฌ๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ ์‚ฌ์šฉ
    1. ๋„คํŠธ์›Œํฌ์— ๋ช…์‹œ๋œ ์‚ฌ์ „ ๋ถ„ํฌ (Prior Distribution)์—์„œ ์ƒ˜ํ”Œ์„ ์ƒ์„ฑ
    2. ์ฆ๊ฑฐ (Evidence)์™€ ์ผ์น˜ํ•˜์ง€ ์•Š๋Š” ๋ชจ๋“  ์ƒ˜ํ”Œ์„ ๊ธฐ๊ฐ (Reject)
    3. ๋‚จ์•„ ์žˆ๋Š” ์ƒ˜ํ”Œ์—์„œ X=xX=xX=x๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ํšŸ์ˆ˜๋ฅผ ์„ธ์–ด P^(X=xโˆฃe)\hat{P}(X=x|e)P^(X=xโˆฃe)๋ฅผ ์–ป์Œ
  • ์ถ”์ • ๋ถ„ํฌ P^(Xโˆฃe)\hat{\mathbf{P}}(X|e)P^(Xโˆฃe)๋Š” ์ฆ๊ฑฐ eee์™€ ์ผ์น˜ํ•˜๋Š” XXX์˜ ๊ฐ ๊ฐ’์— ๋Œ€ํ•œ ์ƒ˜ํ”Œ ์นด์šดํŠธ ๋ฒกํ„ฐ Nsample(X,e)\mathbf{N}_{sample}(X, e)Nsampleโ€‹(X,e)๋ฅผ ์ •๊ทœํ™” (Normalizing)ํ•˜์—ฌ ๊ณ„์‚ฐ

    P^(Xโˆฃe)=ฮฑNsample(X,e)=Nsample(X,e)Nsample(e)\hat{\mathbf{P}}(X|e) = \alpha \mathbf{N}_{sample}(X, e) = \frac{\mathbf{N}_{sample}(X, e)}{N_{sample}(e)} P^(Xโˆฃe)=ฮฑNsampleโ€‹(X,e)=Nsampleโ€‹(e)Nsampleโ€‹(X,e)โ€‹

Challenges in Rejection Sampling (๊ธฐ๊ฐ ์ƒ˜ํ”Œ๋ง์˜ ์–ด๋ ค์›€)

  • ํ•„์š”ํ•œ ์ƒ˜ํ”Œ์˜ ์ˆ˜ (Complexity)๋Š” ์ฃผ๋กœ ์ˆ˜๋ฝ๋˜๋Š” ์ƒ˜ํ”Œ์˜ ๋น„์œจ์— ์˜์กด
  • ์ด ๋น„์œจ์€ ์ •ํ™•ํžˆ ์ฆ๊ฑฐ์˜ ์‚ฌ์ „ ํ™•๋ฅ  (Prior Probability of the Evidence) P(e)P(e)P(e)์™€ ๊ฐ™์Œ
  • ๋ณต์žกํ•œ ๋ฌธ์ œ์˜ ๊ฒฝ์šฐ (๋งŽ์€ ์ฆ๊ฑฐ ๋ณ€์ˆ˜), ์ด ๋น„์œจ์€ ๋งค์šฐ ์ž‘์•„์ง (Vanishingly Small)
  • ์˜ˆ์‹œ: ์ง€๊ตฌ์— 1km ์ง๊ฒฝ์˜ ์†Œํ–‰์„ฑ ์ถฉ๋Œ ํ›„ ์ธ๊ฐ„ ์ƒ์กด ์กฐ๊ฑด๋ถ€ ํ™•๋ฅ ์„ ์ถ”์ •ํ•˜๋Š” ๊ฒฝ์šฐ, P(e)P(e)P(e)๊ฐ€ ๊ทน๋„๋กœ ์ž‘์•„ ์ถฉ๋ถ„ํ•œ ์ƒ˜ํ”Œ์„ ์–ป๋Š” ๋ฐ ๋งค์šฐ ์˜ค๋žœ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ด๊ฒƒ์ด Rejection Sampling์˜ Weakness

Review of Bayesian Netwokrs Visualized illustrations

Definition of Bayesian Network

  • ๋ฐฉํ–ฅ ๊ทธ๋ž˜ํ”„ (Directed graph)
  • ๊ฐ ๋…ธ๋“œ (Node)๋Š” ํ™•๋ฅ  ๋ณ€์ˆ˜ (Random Variable)๋ฅผ ๋‚˜ํƒ€๋ƒ„
  • XXX์—์„œ YYY๋กœ์˜ ํ™”์‚ดํ‘œ๋Š” XXX๊ฐ€ YYY์˜ ๋ถ€๋ชจ (Parent)์ž„์„ ์˜๋ฏธ
  • ๊ฐ ๋…ธ๋“œ XXX๋Š” ์กฐ๊ฑด๋ถ€ ํ™•๋ฅ  ๋ถ„ํฌ P(XโˆฃParents(X))\mathbf{P}(X|\text{Parents}(X))P(XโˆฃParents(X))๋ฅผ ๊ฐ€์ง

An Appointment Example (์•ฝ์† ์˜ˆ์‹œ)

  • ๋ณ€์ˆ˜:
  • Rain ({none, light, heavy})
  • Maintenance ({yes, no})
  • Train ({on time, delayed})
  • Appointment ({attend, miss})

Conditional Probability Tables (CPTs)

  • Rain: P(Rain)P(\text{Rain})P(Rain)
  • Maintenance: P(MaintenanceโˆฃRain)P(\text{Maintenance}|\text{Rain})P(MaintenanceโˆฃRain)
  • Train: P(TrainโˆฃRain,ย Maintenance)P(\text{Train}|\text{Rain, Maintenance})P(TrainโˆฃRain,ย Maintenance)
  • Appointment: P(AppointmentโˆฃTrain)P(\text{Appointment}|\text{Train})P(AppointmentโˆฃTrain)

Computing Joint Probabilities (๊ฒฐํ•ฉ ํ™•๋ฅ  ๊ณ„์‚ฐ)

  • P(light,ย no,ย delayed,ย miss)=P(light)P(noโˆฃlight)P(delayedโˆฃlight,ย no)P(missโˆฃdelayed)P(\text{light, no, delayed, miss}) = P(\text{light}) P(\text{no}|\text{light}) P(\text{delayed}|\text{light, no}) P(\text{miss}|\text{delayed})P(light,ย no,ย delayed,ย miss)=P(light)P(noโˆฃlight)P(delayedโˆฃlight,ย no)P(missโˆฃdelayed)

Probabilistic Inference

  • Query XXX: ๋ถ„ํฌ๋ฅผ ๊ณ„์‚ฐํ•  ๋ณ€์ˆ˜
  • Evidence variables EEE: ์ด๋ฒคํŠธ eee์— ๋Œ€ํ•ด ๊ด€์ฐฐ๋œ ๋ณ€์ˆ˜
  • Hidden variables YYY: ๋น„-์ฆ๊ฑฐ, ๋น„-์งˆ์˜ ๋ณ€์ˆ˜
  • Goal: P(Xโˆฃe)P(X|e)P(Xโˆฃe) ๊ณ„์‚ฐ

Inference by Enumeration (Exact Inference)

  • ์˜ˆ์‹œ: P(Appointmentโˆฃlight,ย no)P(\text{Appointment}|\text{light, no})P(Appointmentโˆฃlight,ย no)

    P(Appointmentโˆฃlight,ย no)=ฮฑP(Appointment,ย light,ย no)P(\text{Appointment}|\text{light, no}) = \alpha P(\text{Appointment, light, no}) P(Appointmentโˆฃlight,ย no)=ฮฑP(Appointment,ย light,ย no)

    =ฮฑ[P(Appointment,ย light,ย no,ย onย time)+P(Appointment,ย light,ย no,ย delayed)]= \alpha [P(\text{Appointment, light, no, on time}) + P(\text{Appointment, light, no, delayed})] =ฮฑ[P(Appointment,ย light,ย no,ย onย time)+P(Appointment,ย light,ย no,ย delayed)]

  • P(Xโˆฃe)=ฮฑP(X,e)=ฮฑโˆ‘yP(X,e,y)\mathbf{P}(X|e) = \alpha \mathbf{P}(X, e) = \alpha \sum_{y} \mathbf{P}(X, e, y)P(Xโˆฃe)=ฮฑP(X,e)=ฮฑโˆ‘yโ€‹P(X,e,y)
  • XXX: ์งˆ์˜ ๋ณ€์ˆ˜
  • eee: ์ฆ๊ฑฐ
  • yyy: ์€๋‹‰ ๋ณ€์ˆ˜์˜ ๊ฐ’์— ๊ฑธ์นœ ๋ฒ”์œ„
  • ฮฑ\alphaฮฑ: ๊ฒฐ๊ณผ๋ฅผ ์ •๊ทœํ™”

Approximate Inference: Sampling

  • ๋ฒ ์ด์ฆˆ ๋„ท (Bayesian Network)์˜ ํ† ํด๋กœ์ง€ ์ˆœ์„œ์— ๋”ฐ๋ผ ๊ฐ ๋ณ€์ˆ˜๋ฅผ ์ƒ˜ํ”Œ๋งํ•˜์—ฌ ์™„์ „ํ•œ ์ƒ˜ํ”Œ โŸจR=r,M=m,T=t,A=aโŸฉ\langle R=r, M=m, T=t, A=a \rangleโŸจR=r,M=m,T=t,A=aโŸฉ์„ ์ƒ์„ฑ
  • P(Train=onย time)P(\text{Train} = \text{on time})P(Train=onย time)์™€ ๊ฐ™์€ ํ™•๋ฅ ์€ ์ƒ์„ฑ๋œ ์ƒ˜ํ”Œ ์ค‘ ํ•ด๋‹น ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•œ ๋น„์œจ๋กœ ์ถ”์ •
  • Rejection Sampling: P(Rain=lightโˆฃTrain=onย time)P(\text{Rain}=\text{light}|\text{Train}=\text{on time})P(Rain=lightโˆฃTrain=onย time)
  • ์ƒ˜ํ”Œ ์ค‘ Train=onย time\text{Train}=\text{on time}Train=onย time์ธ ์ƒ˜ํ”Œ๋งŒ ๋‚จ๊ธฐ๊ณ , ๊ทธ ์ค‘์—์„œ Rain=light\text{Rain}=\text{light}Rain=light์ธ ์ƒ˜ํ”Œ์˜ ๋น„์œจ์„ ๊ณ„์‚ฐํ•˜์—ฌ ์ถ”์ •
์ตœ๊ทผ ์ˆ˜์ •: 25. 11. 6. ์˜คํ›„ 12:07
Contributors: kmbzn
Prev
7. Information Theory
Next
9. Probabilitc Reasoning (3)

BUILT WITH

CloudflareNode.jsGitHubGitVue.jsJavaScriptVSCodenpm

All trademarks and logos are property of their respective owners.
ยฉ 2025 kmbzn ยท MIT License