AI-04 · ARTIFICIAL INTELLIGENCE

베이즈 네트워크·추론·시간 모형Bayesian networks, inference and temporal models

우산 일곱 날의 비 세 날에서 정확한 추론과 시간 갱신까지From three rainy umbrella days to exact inference and temporal updates

실습 6종 · 풀이 포함 연습문제 60개6 labs · 60 exercises with solutions

기초Foundations

1. 우산 일곱 날 중 비가 온 세 날1. Three rainy days among seven umbrella days

학교에 가기 전 우산을 든 친구를 보았습니다. 비가 올 가능성을 어떻게 바꿀까요? 실제 조사 대신, 먼저 정확히 스무 날로 만든 가정 표를 봅니다. 비 온 네 날에는 우산이 세 번, 비가 오지 않은 열여섯 날에는 우산이 네 번입니다. 우산을 본 날만 모으면 일곱 날이고 그중 비 온 날은 세 날입니다.

가정한 스무 날의 빈도표 · 관측 조사 자료가 아님
날씨우산 있음우산 없음합
비314
비 없음41216
합71320

스무 날에서 한 날을 같은 확률로 뽑는 실험이라면 우산을 보았을 때 비일 조건부 확률은 3/7입니다. 비 온 날에 우산을 들 확률 3/4와 다릅니다. 조건부라는 말은 먼저 남길 날을 정한 뒤 그 안에서 비중을 다시 계산한다는 뜻입니다.

You see a schoolmate carrying an umbrella. How should this change your belief about rain? Start with a hypothetical table of exactly twenty days, not an actual survey. Of four rainy days, three have umbrellas. Of sixteen dry days, four have umbrellas. The seven umbrella days contain three rainy days.

Hypothetical twenty-day counts, not measured survey data
WeatherUmbrellaNo umbrellaTotal
Rain314
Dry41216
Total71320

If one of these days is drawn uniformly, the conditional probability of rain after seeing an umbrella is 3/7. This differs from the umbrella rate of 3/4 among rainy days. Conditioning first chooses which days remain, then recomputes shares inside that set.

기초Foundations

2. 네 칸의 합과 주변확률2. Four cells and their marginals

표의 각 수를 20으로 나누면 비·우산의 결합확률표입니다. 결합은 두 질문의 답을 함께 적는다는 뜻입니다. 비이면서 우산일 확률은 3/20입니다. 우산 여부를 무시하고 비의 확률만 원하면 두 칸 3/20+1/20=1/5를 더합니다. 더해서 없앤 변수를 주변화했다고 말합니다.

P(R=1,U=1)=3/20P(R=1)=3/20+1/20=1/5P(U=1)=3/20+4/20=7/20\begin{gathered}P(R=1,U=1)=3/20\\P(R=1)=3/20+1/20=1/5\\P(U=1)=3/20+4/20=7/20\end{gathered}

네 칸은 모두 비음수이고 합은 1입니다. 확률표가 되려면 두 조건이 함께 필요합니다. 0.3, 0.1, 0.4, 0.3처럼 합이 1.1인 표를 그대로 확률로 부를 수 없습니다. 이번 장에서는 유한 표를 정확한 분수로 계산해, 표시 반올림과 실제 합을 구별합니다.

Dividing each count by twenty gives the joint probability table of rain R and umbrella U. Joint means recording both answers together. Rain with an umbrella has probability 3/20. To ignore umbrellas and ask only about rain, add 3/20+1/20=1/5. Summing over a variable is marginalization.

P(R=1,U=1)=3/20P(R=1)=3/20+1/20=1/5P(U=1)=3/20+4/20=7/20\begin{gathered}P(R=1,U=1)=3/20\\P(R=1)=3/20+1/20=1/5\\P(U=1)=3/20+4/20=7/20\end{gathered}

Every cell must be nonnegative and the total must be one. Both conditions matter. Numbers 0.3, 0.1, 0.4, 0.3 sum to 1.1 and cannot be used unchanged as probabilities. Exact fractions in our finite calculations distinguish mathematical totals from rounded displays.

기초Foundations

3. 남은 무게를 합으로 나눈다3. Divide remaining weights by their sum

우산이 있다는 관측 U=1을 고정합니다. 남은 비·맑음의 무게는 3/20과 4/20입니다. 합 7/20으로 각각 나누면 3/7과 4/7이 됩니다. 이 공통 나눗셈을 정규화라고 합니다. 원래 표에서 비일 확률 1/5를 그대로 가져오면 우산이라는 정보를 쓰지 않은 셈입니다.

P(R=r∣U=1)=P(R=r,U=1)P(U=1)P(U=1)>0\begin{gathered}P(R=r\mid U=1)=\frac{P(R=r,U=1)}{P(U=1)}\\P(U=1)>0\end{gathered}

반대로 우산이 없으면 비일 확률은 1/13입니다. 어느 열을 남겼는지에 따라 분모도 달라집니다. 이미 관측한 변수 자체를 물으면 양의 확률인 관측 아래에서는 그 관측값에 확률 1이 놓입니다. 이것은 모든 관측의 확률이 1이라는 뜻이 아닙니다.

Fix the evidence U=1. The remaining rain and dry weights are 3/20 and 4/20. Dividing both by their sum, 7/20, gives 3/7 and 4/7. This common division is normalization. Reusing the original rain probability 1/5 would ignore the umbrella evidence.

P(R=r∣U=1)=P(R=r,U=1)P(U=1)P(U=1)>0\begin{gathered}P(R=r\mid U=1)=\frac{P(R=r,U=1)}{P(U=1)}\\P(U=1)>0\end{gathered}

With no umbrella, rain instead has probability 1/13. The retained column determines the denominator. Asking about an already observed variable places probability one on its observed value, provided the evidence has positive probability. This does not make every evidence event certain.

기초Foundations

4. 방향을 바꾸는 베이즈 식4. Reverse conditioning with Bayes’ rule

비의 사전 비중은 1/5, 비일 때 우산의 비중은 3/4입니다. 둘을 곱한 3/20은 비와 우산이 함께인 무게입니다. 맑을 때의 경로도 (4/5)(1/4)=4/20입니다. 두 경로를 더해 우산의 전체 무게를 얻은 뒤 나누면 3/7입니다. 베이즈 식은 이런 곱셈과 나눗셈을 한 줄로 적습니다.

P(R=1∣U=1)=P(U=1∣R=1)P(R=1)∑rP(U=1∣R=r)P(R=r)\begin{gathered}P(R=1\mid U=1)\\=\frac{P(U=1\mid R=1)P(R=1)}{\sum_r P(U=1\mid R=r)P(R=r)}\end{gathered}

가능도는 상태를 고정했을 때 관측의 무게를 말합니다. 여기서 3/4는 비라는 상태 아래의 우산 가능도입니다. 관측을 고정한 뒤 상태들의 비중을 구한 사후확률 3/7과 바꾸어 쓰지 않습니다. 사전확률이 달라지면 같은 가능도에서도 사후확률이 달라집니다.

The prior rain share is 1/5, and the umbrella share given rain is 3/4. Their product, 3/20, is the joint rain-and-umbrella weight. The dry route contributes (4/5)(1/4)=4/20. Add both routes to obtain the total umbrella weight, then divide to get 3/7. Bayes’ rule writes these operations compactly.

P(R=1∣U=1)=P(U=1∣R=1)P(R=1)∑rP(U=1∣R=r)P(R=r)\begin{gathered}P(R=1\mid U=1)\\=\frac{P(U=1\mid R=1)P(R=1)}{\sum_r P(U=1\mid R=r)P(R=r)}\end{gathered}

A likelihood gives an observation’s weight with the state held fixed. Here 3/4 is the umbrella likelihood under rain. The posterior 3/7 instead fixes the observation and compares states. Different priors can produce different posteriors even with unchanged likelihoods.

기초Foundations

5. 확률 0인 관측에는 나누지 않는다5. Do not divide by zero-probability evidence

두 값 H,T를 가진 변수가 반드시 H라고 선언되어 P(H)=1, P(T)=0이라고 합시다. T를 관측했다는 조건의 분모는 0입니다. 유한 조건부 확률의 비율은 0/0이라 정해지지 않습니다. 모든 상태를 같은 비중으로 채우거나, 가장 그럴듯한 상태를 임의로 고르는 것은 원래 비율의 계산이 아닙니다.

실습은 관측 무게 0과 사후분포 미정의를 함께 표시합니다. 입력값이 정의역 밖인 오류와도 다릅니다. T는 올바른 상태 토큰이지만 선언 모형에서 불가능한 사건입니다. 실제로 이런 관측이 들어오면 기록 오류·관측 모형·확률 0 선언을 다시 살펴볼 이유가 생깁니다. 그 이유만으로 어느 하나가 틀렸다고 특정할 수는 없습니다.

Suppose a variable with values H,T is declared certain to be H: P(H)=1 and P(T)=0. Conditioning on T has denominator zero. The finite conditional-probability ratio becomes 0/0 and is undefined. Filling every state with equal weight or choosing a favorite state would introduce another convention.

The lab displays evidence mass zero together with an undefined posterior. This differs from an out-of-domain input error: T is a valid state token but an impossible event under the declared model. Such a real observation motivates rechecking the record, observation model or zero-probability assumption. It does not by itself identify which one failed.

기초Foundations

6. 화살표와 조건부 표를 함께 준다6. Supply arrows together with conditional tables

비 R에서 우산 U로 화살표를 그리고 P(R), P(U|R)의 표를 줍니다. 그러면 P(R,U)=P(R)P(U|R)로 네 칸을 복원합니다. 이것이 이 예의 베이즈 네트워크입니다. 일반적으로 각 변수는 부모 변수들의 값이 주어졌을 때 자기 값의 확률표를 가집니다. 화살표만 있고 숫자표가 없으면 이번 날의 사후확률을 계산할 수 없습니다.

P(x1,…,xn)=∏i=1nP(xi∣xpa(i))P(x_1,\ldots,x_n)=\prod_{i=1}^n P(x_i\mid x_{\mathrm{pa}(i)})

그래프는 방향 순환이 없어야 합니다. 부모가 먼저인 순서로 변수를 생성할 수 있는 유향 비순환 그래프, DAG입니다. 모든 노드에 들어오는 화살표의 꼬리가 부모입니다. 노드를 화면에서 왼쪽에 그렸다는 사실은 부모 관계를 정하지 않습니다. 관측에서 조건부 표를 얻는 방법과 그래프의 인과적 의미는 별도 모형 선택입니다.

Draw an arrow from rain R to umbrella U and supply P(R) and P(U|R). Their product reconstructs all four joint cells. This is the Bayesian network for our example. In general, each variable has a probability table for its values given its parents. Arrows without numerical tables cannot determine today’s posterior.

P(x1,…,xn)=∏i=1nP(xi∣xpa(i))P(x_1,\ldots,x_n)=\prod_{i=1}^n P(x_i\mid x_{\mathrm{pa}(i)})

The graph must have no directed cycle: it is a directed acyclic graph, or DAG, with an ordering in which parents precede children. Parents are the tails of incoming arrows, regardless of drawing positions. Estimating conditional tables and assigning causal meaning to a graph require additional modeling choices.

기초Foundations

7. 부모의 각 경우마다 합이 1이다7. Each parent configuration has its own row sum

우산의 조건부 표에는 비인 행과 비가 아닌 행이 따로 있습니다. 비인 행은 (3/4,1/4), 맑은 행은 (1/4,3/4)입니다. 각 행을 따로 더하면 1이고, 표 전체를 더하면 2입니다. 조건부 표 전체가 1이어야 한다고 강제하면 서로 다른 조건을 잘못 합친 것입니다.

부모 경우별 조건부 확률
부모 RP(U=1|R)P(U=0|R)
비3/41/4
맑음1/43/4

두 이진 부모이면 네 가지 부모 조합을 모두 적어야 합니다. 조합이 중복되거나 빠지면 입력을 거절합니다. 부모 사건의 실제 무게가 0이어도 엔진의 생성 모형을 완전히 정의하려면 그 행을 줍니다. 그 행의 숫자가 자료에서 관측된 조건부 확률이라는 뜻은 아닙니다. 양의 부모 무게가 없는 곳에서는 조건부 비율이 원표만으로 정해지지 않습니다.

The umbrella CPT has separate rain and dry rows: (3/4,1/4) and (1/4,3/4). Each row sums to one, while the entire table sums to two. Requiring the whole CPT to total one would incorrectly merge different conditions.

Conditional probabilities for each parent configuration
Parent RP(U=1|R)P(U=0|R)
Rain3/41/4
Dry1/43/4

Two binary parents require all four parent configurations, with no duplicate or missing row. Even a zero-mass parent context needs a normalized row to specify a complete generative model. Its numbers need not be observed conditional probabilities: the original joint table does not determine a conditional ratio at a zero-mass context.

기초Foundations

8. 실습 A · 표와 그래프의 전체 합8. Lab A · The total mass of a network

비·우산 표에서 사전 비 확률을 먼저 바꾸고, 우산의 두 조건부 행은 유지하세요. 전체 결합표의 합은 여전히 1이어야 하지만 P(R=1,U=1)과 우산 관측 후의 비중은 달라집니다. 두 노드의 네 칸을 손으로 먼저 쓴 뒤 결과를 비교합니다.

순환 예도 시험합니다. 두 이진 변수가 서로를 부모로 가지고 각 조건부 표가 A=B를 확률 1로 강제하면, 단순 곱은 (0,0)과 (1,1)에 각각 무게 1을 주어 전체 합 2가 됩니다. 행별 합만으로 순환 그래프의 곱을 결합확률로 만들 수 없습니다. 실습은 이런 순환 입력을 거절합니다. 실시간 표는 브라우저 JavaScript가 계산하며 Python/R의 보관 실행은 별도입니다.

Change the prior rain probability while leaving both umbrella likelihood rows fixed. The joint table still totals one, but the rain-and-umbrella cell and the posterior rain share change. Write all four cells by hand before comparing the output.

Also consider a cycle: two binary variables are parents of each other, with both CPTs forcing A=B. Their naive product puts weight one on each of (0,0) and (1,1), totaling two. Row normalization alone cannot make a cyclic product a joint probability law. The lab rejects directed cycles. Live tables are calculated by browser JavaScript; archived Python/R executions are separate.

기초Foundations

9. 가능한 모든 줄에 곱을 적는다9. Write a product on every possible row

비 R와 우산 U의 이진 값은 네 가지 조합입니다. 줄마다 P(R)P(U|R)를 곱하면 차례로 3/20, 1/20, 4/20, 12/20입니다. 예측하고 싶은 변수가 늘어도 원리는 같습니다. 이진 변수 셋이면 여덟 줄, 열 개이면 1,024줄입니다. 이처럼 가능한 줄을 모두 방문하는 방법을 열거라고 합니다.

열거의 장점은 계산 과정을 표로 확인하기 쉽다는 점입니다. 단점은 변수 개수에 따라 줄 수가 급격히 늘어난다는 점입니다. 각 변수의 상태 수가 dᵢ이면 전체 줄 수는 ∏ᵢdᵢ입니다. 표의 많은 칸이 0이더라도 현재 실습의 완전 열거는 그 칸도 방문합니다. 0인 줄을 알고 있다는 것과 그 줄을 계산하지 않았다는 것을 구별합니다.

The two binary variables R and U have four assignments. Multiplying P(R)P(U|R) on each row gives 3/20, 1/20, 4/20 and 12/20. The principle is unchanged with more variables: three binary variables have eight rows, and ten have 1,024. Visiting every assignment is enumeration.

Enumeration makes the calculation easy to audit as a table, but its row count grows rapidly. For state counts dᵢ, the total is ∏ᵢdᵢ. Our exhaustive implementation visits zero-weight rows too. Knowing that a row has zero mass differs from never calculating that row.

기초Foundations

10. 묻지 않은 변수는 더해 없앤다10. Sum out variables that are not queried

이진 변수 A,B,C의 결합표에서 P(A,C)를 묻는다면 B=0과 B=1인 두 줄을 더합니다. C=c를 관측하고 A만 묻는다면, 먼저 C=c인 줄만 남기고 B를 더한 뒤 남은 A의 무게를 정규화합니다. 관측하지도 묻지도 않은 B를 숨은 변수라고 부릅니다. 이것은 B가 세상에 존재하지 않는다는 말이 아닙니다.

w(a)=∑bP(a,b,c)P(A=a∣C=c)=w(a)∑a~w(a~)P(C=c)>0\begin{gathered}w(a)=\sum_b P(a,b,c)\\P(A=a\mid C=c)=\frac{w(a)}{\sum_{\tilde a}w(\tilde a)}\\P(C=c)>0\end{gathered}

아직 값이 알려지지 않은 모든 변수를 관측값처럼 고정하면 필요한 경우들을 버립니다. 예를 들어 비의 가능성을 계산할 때 우산을 본 사실은 고정하지만, 관측하지 않은 다른 상태는 가능한 값들에 걸쳐 더합니다. 두 값의 평균을 내는 것이 아니라 원래 확률 무게를 합칩니다.

To obtain P(A,C) from a joint table of binary A,B,C, add the B=0 and B=1 rows. To query A after observing C=c, retain those C rows, sum over B, then normalize the remaining A weights. B is called hidden because it is neither observed nor queried, not because it does not exist.

w(a)=∑bP(a,b,c)P(A=a∣C=c)=w(a)∑a~w(a~)P(C=c)>0\begin{gathered}w(a)=\sum_b P(a,b,c)\\P(A=a\mid C=c)=\frac{w(a)}{\sum_{\tilde a}w(\tilde a)}\\P(C=c)>0\end{gathered}

Fixing an unobserved variable to a favorite value would discard required possibilities. Evidence is fixed; other unobserved states are summed over. We add their original probability weights rather than taking an unweighted average of their numerical labels.

기초Foundations

11. 같은 우산 정보에도 사전 비중이 다르다11. The same umbrella evidence can meet a different prior

우산의 두 가능도 3/4와 1/4는 유지하되 비의 사전확률을 1/100으로 바꿉니다. 비 경로의 무게는 3/400, 맑은 경로는 99/400입니다. 우산 뒤 비일 확률은 3/102=1/34입니다. 가능도 3/4가 그대로라고 사후확률도 3/4가 되지는 않습니다.

확률을 비와 비 아님의 오즈로 쓰면 계산이 짧아집니다. 원래 사전 오즈 1:4에 가능도 비 3을 곱하면 사후 오즈 3:4, 즉 확률 3/7입니다. 새 사전 오즈 1:99에서는 3:99, 즉 1/34입니다. 여기의 새 사전은 다른 선언 모형이며, 실제 날씨가 변했다고 관측한 결과가 아닙니다.

P(R=1∣U=1)P(R=0∣U=1)=P(R=1)P(R=0)P(U=1∣R=1)P(U=1∣R=0)\frac{P(R=1\mid U=1)}{P(R=0\mid U=1)}=\frac{P(R=1)}{P(R=0)}\frac{P(U=1\mid R=1)}{P(U=1\mid R=0)}

Keep umbrella likelihoods 3/4 and 1/4 but change the prior rain probability to 1/100. The rain route weighs 3/400 and the dry route 99/400. The posterior becomes 3/102=1/34. An unchanged likelihood of 3/4 does not make the posterior equal to 3/4.

Odds give another hand calculation. Original prior odds 1:4 multiplied by likelihood ratio three become posterior odds 3:4, hence probability 3/7. New prior odds 1:99 become 3:99, hence 1/34. This alternative prior defines another model; it is not an observed change in the weather.

P(R=1∣U=1)P(R=0∣U=1)=P(R=1)P(R=0)P(U=1∣R=1)P(U=1∣R=0)\frac{P(R=1\mid U=1)}{P(R=0\mid U=1)}=\frac{P(R=1)}{P(R=0)}\frac{P(U=1\mid R=1)}{P(U=1\mid R=0)}
기초Foundations

12. 독립은 곱이 맞는지 묻는 말이다12. Independence asks whether the product matches

두 유한 변수가 독립이면 모든 값 a,b에서 P(a,b)=P(a)P(b)입니다. 우산 예의 비·우산 칸은 3/20이지만 주변확률의 곱은 (1/5)(7/20)=7/100이므로 두 변수는 독립이 아닙니다. 비가 언제나 우산을 뜻한다는 결정적 관계가 아니어도 독립은 실패할 수 있습니다.

조건부 독립 A⊥B|C는 양의 무게를 가진 C=c 각각에서 남은 A,B 표가 곱으로 나뉜다는 뜻입니다. 단 한 c에서 맞는 것과 모든 양의 c에서 맞는 것은 다릅니다. 나눗셈 없이 확인하려면 아래 교차곱을 쓸 수 있습니다. P(c)=0에서는 두쪽이 0이어도 조건부 분포 자체가 정해진 것은 아닙니다.

P(a,b,c)P(c)=P(a,c)P(b,c)for P(c)>0P(a,b,c)P(c)=P(a,c)P(b,c)\quad\text{for }P(c)>0

Finite variables A and B are independent when P(a,b)=P(a)P(b) for every value pair. The rain-and-umbrella cell is 3/20, while the product of marginals is (1/5)(7/20)=7/100. They are dependent without having a deterministic relationship.

Conditional independence A⊥B|C requires a product table at every positive-mass context C=c. Agreement at one context is insufficient. The cross-product below avoids division. At P(c)=0 both sides vanish, but that equality does not define a conditional distribution there.

P(a,b,c)P(c)=P(a,c)P(b,c)for P(c)>0P(a,b,c)P(c)=P(a,c)P(b,c)\quad\text{for }P(c)>0
기초Foundations

13. 중간 값을 알면 두 끝이 분리된다13. Knowing the middle can separate the ends

공정한 이진 X에서 Y가 X를 확률 3/4로 복사하고, Z가 Y를 확률 3/4로 복사한다고 선언합니다. 각 복사의 난수는 그 부모가 주어졌을 때 독립입니다. X→Y→Z의 결합은 P(X)P(Y|X)P(Z|Y)입니다. 두 번 복사한 끝이 처음과 같을 확률은 (3/4)²+(1/4)²=5/8입니다.

Y=y가 주어지면 Z의 분포는 이미 y로 정해져 X의 추가 정보가 바꾸지 않습니다. 양의 조건 사건에서 P(x,z|y)=P(x|y)P(z|y)이므로 X⊥Z|Y입니다. Y가 두 끝 X,Z의 공통 부모인 갈래 X←Y→Z도 P(y)P(x|y)P(z|y)로 같은 분리를 줍니다. 이름이 사슬·갈래라는 사실보다 곱이 어떻게 나뉘는지 확인하는 것이 핵심입니다.

Let fair binary X be copied by Y with probability 3/4, and let Z copy Y with probability 3/4. The random draws are independent given their respective parents. The chain X→Y→Z has joint P(X)P(Y|X)P(Z|Y). The final value matches the first with probability (3/4)²+(1/4)²=5/8.

Once Y=y is known, Z’s distribution is specified by y, so extra information about X cannot change it. At positive conditioning events, P(x,z|y)=P(x|y)P(z|y), giving X⊥Z|Y. A fork X←Y→Z likewise factors as P(y)P(x|y)P(z|y). The important point is how the probability product separates, not just the diagram’s name.

기초Foundations

14. 공통 결과를 보면 두 원인이 엮일 수 있다14. Observing a common effect can connect its inputs

A와 B를 독립인 공정한 이진 변수로 두고 C는 둘 중 하나라도 1이면 1인 OR이라고 선언합니다. 처음에는 (A,B)의 네 경우가 각각 1/4입니다. C=1인 세 경우 (1,0),(0,1),(1,1)만 남기면 A=1의 비중은 2/3입니다. 여기에 B=0까지 알면 A=1이어야 하고, B=1까지 알면 A=1의 비중은 1/2입니다.

독립한 두 입력과 선언한 공통 결과
ABC=A OR B
000
011
101
111

A→C←B처럼 화살표가 마주치는 C를 충돌점이라고 합니다. 두 입력이 원래 독립이어도 공통 결과를 조건으로 남기는 과정에서 의존이 생길 수 있습니다. 이 예는 수학적 가정 표이며 실제 원인이라는 주장을 실측 자료에서 얻은 것이 아닙니다.

Let A and B be independent fair binary variables, and define C as their OR. All four input pairs initially have probability 1/4. Conditioning on C=1 leaves (1,0),(0,1),(1,1), so P(A=1|C=1)=2/3. Adding B=0 forces A=1, whereas adding B=1 leaves P(A=1)=1/2.

Two independent inputs and their declared common effect
ABC=A OR B
000
011
101
111

The meeting-arrow node C in A→C←B is a collider. Originally independent inputs can become dependent after conditioning on their common effect. This is a declared mathematical table, not an empirical causal finding.

기초Foundations

15. 그래프의 보장과 우연한 같은 표15. A graphical guarantee and an accidental numerical equality

그래프만으로 독립이 보장되는지 묻는 d-분리와, 지금 주어진 숫자표에서 독립이 맞는지 묻는 검사는 다릅니다. 사슬의 중간을 관측하면 양끝이 분리되고, 충돌점이나 그 자손을 관측하면 막혔던 길이 열릴 수 있습니다. 여기서 길이 열렸다는 말은 의존할 수 있다는 뜻이며 반드시 의존한다는 뜻은 아닙니다.

예를 들어 A→B 화살표가 있어도 P(B=1|A=0)=P(B=1|A=1)=1/2로 두면 B는 A와 독립입니다. 화살표가 표현상 허용하는 관계가 그 숫자에서 실제로 작동하지 않습니다. 그래프에서 분리되지 않으면 항상 의존한다고 추가로 가정하는 성질을 충실성이라고 하는데, 이번 장의 도구는 이를 자동 가정하지 않습니다.

조건 변수는 값 하나가 아니라 변수의 집합으로 줍니다. 수치 독립 검사는 그 변수들의 모든 양의 무게 경우를 확인합니다. 한 관측값 아래에서 나온 우연한 곱의 일치를 전체 조건부 독립으로 확대하지 않습니다.

D-separation asks whether the graph guarantees independence; a numerical test asks whether this particular probability table is independent. Observing a chain’s middle separates its ends, while observing a collider or its descendant can open a previously blocked path. An open path permits dependence but does not force it.

For example, A→B can still have P(B=1|A=0)=P(B=1|A=1)=1/2, making B independent of A. A dependency allowed by the graph need not operate at those parameter values. Faithfulness would add a converse link from graphical connection to numerical dependence; our tools do not silently assume it.

Conditioning sets specify variables, not one selected value. Numerical conditional-independence checks cover every positive-mass configuration of those variables. A product equality at one observed configuration is insufficient for the full statement.

기초Foundations

16. 실습 B · 관측과 질문을 따로 고른다16. Lab B · Choose evidence separately from the query

첫 질문은 비 R이고 관측은 우산 U=1입니다. 관측을 U=0으로 바꾸어 3/7과 1/13을 비교하세요. 질문을 U 자체로 바꾸고 U=1을 계속 관측하면, 양의 사건 아래 결과는 그 값에 몰린 분포입니다. 그런 다음 확률 0인 관측을 가진 선언 표를 선택해 사후분포가 미정의인지 확인합니다.

각 줄의 원래 결합 무게, 관측을 만족하는 줄, 더한 무게와 정규화 분모를 차례로 보세요. 첫 몇 줄만 화면에 보여도 전체 합은 모두 계산합니다. 입력 예산을 넘으면 끝나지 않은 답을 0으로 채우지 않고 작업 한도 오류로 알립니다. 브라우저 계산과 별도 Python/R 실행기록의 같은 가정·입력이 일치하는지 비교할 수 있습니다.

First query rain R with umbrella evidence U=1. Change the evidence to U=0 and compare 3/7 with 1/13. Query U itself while retaining U=1: at this positive event the distribution concentrates on the observed value. Then try a declared table with impossible evidence and verify that the posterior is undefined.

Follow original joint weights, evidence-compatible rows, summed weights and the normalizing denominator. Showing only a few trace rows does not truncate the calculation. A work-budget failure reports an error rather than filling an unfinished answer with zeros. Compare the same declared assumptions and inputs against the separately archived Python/R executions.

기초Foundations

17. 확률이 아닌 중간 무게도 쓸 수 있다17. Intermediate factors need not be probability distributions

우산 관측 뒤 비·맑음의 무게 (3/20,4/20)는 합이 7/20이라 아직 분포가 아닙니다. 그래도 이 두 수는 정규화 전 계산에 꼭 필요합니다. 변수 값에 비음수 무게를 대응시킨 이런 작은 표를 인수라고 부릅니다. 인수의 합이 언제나 1이어야 한다고 강제하면 관측의 전체 무게를 잃습니다.

고정한 우산 U=1의 조건부 인수 P(U=1|R)는 R=비에서 3/4, 맑음에서 1/4입니다. 이것을 R에 걸쳐 더해 1이 된다고 해서 P(R) 분포라는 뜻은 아닙니다. 어느 변수가 행의 좌표이고 어떤 관측이 고정되었는지 적어야 합니다. 인수의 변수 목록은 화폐 단위처럼 계산 의미를 정하는 일부입니다.

After observing an umbrella, weights (3/20,4/20) total 7/20, so they are not yet a distribution. They are nevertheless essential before normalization. A nonnegative table indexed by variable values is a factor. Forcing every intermediate factor to sum to one would discard evidence weights.

The likelihood factor P(U=1|R) equals 3/4 under rain and 1/4 under dry weather. Summing these entries over R happens to give one, but that does not make the factor a prior distribution P(R). State its indexing variables and fixed evidence. A factor’s scope is part of its meaning.

기초Foundations

18. 같은 변수 값끼리 인수를 곱한다18. Multiply factors at matching variable values

인수 f(R)=P(R)와 g(R)=P(U=1|R)를 곱할 때 비 행끼리, 맑은 행끼리 곱합니다. 결과는 비 3/20, 맑음 4/20입니다. 서로 다른 R 값을 섞어 (1/5)(1/4)를 비의 관측 무게라고 쓰면 잘못된 행을 고른 것입니다.

더 일반적으로 f(A,B)와 g(B,C)를 결합하면 h(A,B,C)=f(A,B)g(B,C)입니다. B 값이 같은 조합만 곱하고, 공통 B를 두 번 다른 변수처럼 만들지 않습니다. 모든 변수가 이진이면 f,g는 각각 네 칸, 곱은 여덟 칸일 수 있습니다. 작은 인수 두 개를 곱해도 중간 표가 커질 수 있는 이유입니다.

h(a,b,c)=f(a,b)g(b,c)h(a,b,c)=f(a,b)g(b,c)

Multiply f(R)=P(R) by g(R)=P(U=1|R) using matching rain rows and matching dry rows. This yields 3/20 and 4/20. Multiplying the rain prior by the dry likelihood would select inconsistent rows.

More generally, joining f(A,B) and g(B,C) gives h(A,B,C)=f(A,B)g(B,C). Shared B has one common value, not two independent copies. With binary variables each original factor has four entries, while the joined table can have eight. Multiplying small tables can therefore create a larger intermediate table.

h(a,b,c)=f(a,b)g(b,c)h(a,b,c)=f(a,b)g(b,c)
기초Foundations

19. 관련 인수를 모은 뒤 숨은 값을 더한다19. Collect relevant factors before summing a hidden variable

B를 없애려면 B가 들어 있는 인수를 먼저 모두 곱한 뒤 B의 값들을 더합니다. f(A,B)와 g(B,C)를 따로 더한 뒤 결과를 곱하면 보통 다른 답입니다. B가 0일 때와 1일 때 같은 조합 안에서 함께 쓰인다는 정보를 잃기 때문입니다.

k(a,c)=∑bf(a,b)g(b,c)generally k(a,c)≠(∑bf(a,b))(∑bg(b,c))\begin{gathered}k(a,c)=\sum_b f(a,b)g(b,c)\\\text{generally }k(a,c)\ne\left(\sum_b f(a,b)\right)\left(\sum_b g(b,c)\right)\end{gathered}

두 이진 B 인수가 모두 b=0일 때 1, b=1일 때 2라고 해 봅시다. 같은 값끼리 곱해 더하면 1·1+2·2=5입니다. 따로 더해 곱하면 (1+2)(1+2)=9입니다. 작은 숫자만으로도 제거 순서에서 곱과 합의 위치를 지켜야 하는 이유를 확인할 수 있습니다.

To eliminate B, first join every factor containing B, then sum over B. Summing f(A,B) and g(B,C) separately and multiplying the results generally gives another answer: it loses the requirement that both factors use the same B value.

k(a,c)=∑bf(a,b)g(b,c)generally k(a,c)≠(∑bf(a,b))(∑bg(b,c))\begin{gathered}k(a,c)=\sum_b f(a,b)g(b,c)\\\text{generally }k(a,c)\ne\left(\sum_b f(a,b)\right)\left(\sum_b g(b,c)\right)\end{gathered}

Let both binary-B factors have entries one and two. Joining first gives 1·1+2·2=5. Summing separately gives (1+2)(1+2)=9. This small calculation explains why factor elimination must preserve the placement of multiplication and summation.

기초Foundations

20. 분배법칙으로 반복 계산을 줄인다20. Use distributivity to avoid repeated calculation

질문이 Q이고 관측이 E=e라면 나머지 변수들을 하나씩 제거할 수 있습니다. 먼저 각 인수에 관측값을 대입합니다. 제거할 H가 포함된 인수들만 곱해 H를 더하고, 새 인수를 원래 인수들 대신 넣습니다. 모든 숨은 변수를 없앤 마지막 Q 표를 한 번 정규화합니다.

이 방법을 변수 제거라고 합니다. 유한 합의 순서를 바꾸고 분배법칙을 적용하므로, 정확히 계산한 결과는 결합표 전체 열거와 같습니다. 제거한 변수가 질문이나 관측 변수였다면 다른 문제를 푼 것입니다. 실습은 숨은 변수의 완전한 순열만 제거 순서로 받습니다. 값을 모르는 변수를 무조건 최대값으로 바꾸는 방법과도 다릅니다. 여기서는 합을 씁니다.

For query Q and evidence E=e, eliminate other variables one at a time. Substitute evidence in each factor. Join only factors containing hidden variable H, sum out H, and replace those factors with the result. After all hidden variables are gone, normalize the final Q table once.

This is variable elimination. Finite sums can be reordered and distributivity applied, so exact results agree with full-joint enumeration. Eliminating a query or evidence variable would answer another problem. The lab requires an exact permutation of hidden variables as its order. This procedure sums hidden states; replacing them by their maximum would compute something different.

기초Foundations

21. 비·버스·지각을 손으로 제거한다21. Eliminate a bus-delay variable by hand

비 R의 확률은 1/5입니다. 버스 지연 B의 확률은 비일 때 3/4, 맑을 때 1/4입니다. 지각 L의 확률은 버스 지연이면 2/3, 아니면 1/6이며, 주어진 B 밖의 R은 L에 추가 영향을 주지 않는다고 선언합니다. 그래프 R→B→L에서 L=1을 관측하고 R을 묻습니다.

가정한 세 변수의 제거 계산
RB를 합한 P(L=1|R)P(R)와 곱한 무게
비(3/4)(2/3)+(1/4)(1/6)=13/2413/120
맑음(1/4)(2/3)+(3/4)(1/6)=7/2428/120

두 무게의 합은 41/120이고 비의 사후확률은 13/41입니다. L을 고정한 뒤 B를 합할 때의 큰 인수는 R,B의 네 칸입니다. 세 이진 변수의 전체 여덟 칸을 끝까지 저장할 필요는 없습니다. 비의 실제 인과효과를 관측한 자료가 아니라 선언한 모형의 계산입니다.

Set P(R=rain)=1/5. Bus delay B has probability 3/4 under rain and 1/4 under dry weather. Lateness L has probability 2/3 when the bus is delayed and 1/6 otherwise. Declare L independent of extra R information given B. In R→B→L, observe L=1 and query R.

Elimination in a hypothetical three-variable model
RP(L=1|R) after summing BWeight after multiplying P(R)
Rain(3/4)(2/3)+(1/4)(1/6)=13/2413/120
Dry(1/4)(2/3)+(3/4)(1/6)=7/2428/120

The weights total 41/120, giving posterior rain probability 13/41. Once L is fixed, the largest joined factor for B has four R,B cells, rather than the complete eight-cell joint. This is a declared-model calculation, not an observed causal effect of rain.

기초Foundations

22. 제거 순서가 중간 표 크기를 바꾼다22. Elimination order changes intermediate table size

이진 H가 이진 A,B,C의 공통 부모라고 합시다. 인수는 P(H), P(A|H), P(B|H), P(C|H)이며 A만 묻고 관측은 없습니다. H부터 없애면 H,A,B,C 네 변수의 16칸을 한꺼번에 곱할 수 있습니다. B와 C부터 없애면 각각의 조건부 행 합이 1이 되어 큰 표를 만들지 않고 사라집니다.

그 뒤 H,A의 네 칸만 다루어 A를 얻습니다. 두 순서는 정확한 같은 답을 주지만 저장할 표의 크기와 연산 횟수가 다릅니다. 이 예의 이득이 모든 그래프에서 같은 속도 향상을 보장하지는 않습니다. 연결이 조밀하면 중간 인수가 다시 커집니다. 실습은 실제 중간 범위와 칸 수를 보여 주며, 단순히 변수 개수만으로 성능을 단정하지 않습니다.

Let binary H be the common parent of binary A,B,C. Factors are P(H), P(A|H), P(B|H), P(C|H); query A without evidence. Eliminating H first can join all sixteen H,A,B,C assignments. Eliminating B and C first sums their conditional rows to one, removing them without that large table.

Only a four-cell H,A factor then remains before obtaining A. Both orders give the same exact answer but use different intermediate storage and arithmetic. This example does not guarantee the same speedup on every graph. Dense connections can produce large factors again. The lab reports actual factor scopes and sizes rather than inferring performance from node count alone.

기초Foundations

23. 영확률 부모 행의 숫자는 원표가 정하지 않는다23. A zero-mass parent row is not identified by the joint table

X가 반드시 0이고 P(Y=1|X=0)=1/5인 모형을 봅니다. X=1일 때 Y=1의 행을 9/10으로 두거나 1/10으로 두어도 X=1인 결합 칸은 모두 0입니다. 양의 무게를 가진 관측에서의 답은 같습니다. 이 두 조건부 행 중 어느 것이 실제인지 원래 결합표만으로 구별할 수 없습니다.

유한 경험표를 베이즈망으로 바꿀 때도 같은 문제가 생깁니다. 부모 조합에 해당하는 기록이 없으면 그 행의 분모는 0입니다. 이번 장의 saturated 경험표 모형은 그 행에 균등한 확률을 채우는 관례를 별도로 기록합니다. 이 채움이 없던 관측을 새로 만든 것은 아니며, 그 부모를 강제로 만들었을 때의 효과를 뜻하지도 않습니다.

Suppose X is always zero and P(Y=1|X=0)=1/5. Setting the unused X=1 row to P(Y=1|X=1)=9/10 or 1/10 leaves every X=1 joint cell zero. Answers at positive-mass observations are unchanged. The original joint table cannot distinguish the unused conditional rows.

The same issue occurs when turning finite empirical counts into a Bayesian network. A parent configuration with no records has denominator zero. Our saturated empirical model separately records a uniform-fill convention for that row. Filling it does not create an observation or identify what would happen if the parent were externally forced to that value.

기초Foundations

24. 실습 C · 열거와 변수 제거의 같은 답24. Lab C · Match enumeration and variable elimination

비·버스·지각 모형에서 L=1 관측 뒤 R의 확률 13/41을 열거로 구하고 B 제거로 다시 구합니다. 정규화 전 두 무게와 전체 관측 무게 41/120도 같아야 합니다. 사후확률만 비교하면 서로 다른 잘못된 무게를 우연히 같은 비율로 만든 경우를 놓칠 수 있습니다.

공통 부모와 세 자식 모형에서는 숨은 변수 순서를 바꾸어 중간 인수의 칸 수를 비교합니다. 추적 출력의 줄 수 한도를 낮춰도 답과 계산 순서는 변하지 않습니다. 반면 실제 작업 한도를 낮춰 중단되면 미완료 확률표를 답으로 쓰지 않습니다. 이 구별은 표시를 줄이는 것과 계산을 덜 하는 것의 차이입니다.

In the rain-bus-lateness model, query R after L=1. Obtain 13/41 by enumeration and again by eliminating B. The two unnormalized weights and total evidence mass 41/120 must match too. Comparing only posteriors can miss proportional errors in intermediate weights.

In the common-parent model, reorder hidden variables and compare intermediate factor sizes. Reducing the number of displayed trace rows changes neither the answer nor computation order. A genuine work-budget failure, however, cannot be used as a completed probability table. Showing less differs from calculating less.

기초Foundations

25. 그래프 분리를 유한 절차로 확인한다25. Check graphical separation with a finite procedure

d-분리를 확인하는 한 방법은 질문 두 집합 A,B와 조건 집합 Z의 조상만 남기는 것입니다. 조상은 부모를 거슬러 도달하는 변수이며 자기 자신도 포함합니다. 남은 그래프에서 같은 자식의 부모끼리 연결하고 모든 화살표를 무방향 선으로 바꿉니다. 이를 조상 도덕 그래프라고 부릅니다. Z의 노드를 지운 뒤 A에서 B로 길이 없으면 d-분리입니다.

A→C←B에서 아무 관측이 없으면 A,B의 조상에 C가 없어 두 입력이 분리됩니다. C를 관측하면 C도 조상 집합에 들어가고 두 부모 A,B 사이 선이 생깁니다. C를 지운 뒤에도 그 선이 남습니다. 이 절차는 유한 DAG의 d-분리 판정 정리를 사용합니다. 몇 개 숫자표를 시험한 결과를 모든 확률표에 대한 증명으로 바꾸지는 않습니다.

One finite test for d-separation keeps only ancestors of query sets A,B and conditioning set Z, including the sets themselves. Connect parents sharing a child, and replace arrows with undirected edges. This forms the ancestral moral graph. Delete Z; if no path joins A to B, the sets are d-separated.

For A→C←B without evidence, C is absent from the ancestors of A,B, so the inputs separate. Conditioning on C includes it in the ancestor set and creates an A–B parent edge. That edge survives deletion of C. This procedure uses the d-separation criterion for finite DAGs. Testing a few numerical tables is not a proof about every possible parameterization.

심화Extension

26. 결합표의 합이 1인 이유를 거꾸로 더한다26. Sum backward to prove joint normalization

유한 DAG의 부모 우선 순서를 하나 택합니다. 그 순서의 마지막 변수는 뒤에 자식이 없으므로, 모든 결합값을 더할 때 그 변수의 조건부 표만 먼저 더할 수 있습니다. 부모 값을 고정한 행 합은 1입니다. 그 변수를 없애면 같은 모양의 더 작은 DAG 곱이 남습니다. 이를 반복해 마지막 상수 1을 얻습니다.

∑x1,…,xn∏iP(xi∣xpa(i))=1\sum_{x_1,\ldots,x_n}\prod_i P(x_i\mid x_{\mathrm{pa}(i)})=1

이 논증은 행별 비음수와 정확한 합 1, 유한한 상태 수, 비순환성에 의존합니다. 모든 확률이 엄격히 양수일 필요는 없습니다. 확률 0인 행이나 상태가 있어도 합을 수행할 수 있습니다. 반대로 순환에서는 어떤 변수가 마지막인지 보장할 수 없어 같은 제거 논증이 성립하지 않습니다. 앞의 A=B 순환 곱 합 2가 그 차이를 보여 줍니다.

Choose a parent-before-child ordering of a finite DAG. Its last variable has no later children, so in the joint sum we can first sum its own CPT row with parents fixed. The row sum is one. Removing that variable leaves the same product on a smaller DAG. Repeating reaches the scalar one.

∑x1,…,xn∏iP(xi∣xpa(i))=1\sum_{x_1,\ldots,x_n}\prod_i P(x_i\mid x_{\mathrm{pa}(i)})=1

This argument needs nonnegative normalized CPT rows, finite domains and acyclicity. Strictly positive probabilities are unnecessary: zero states cause no problem for summation. A cycle has no guaranteed last variable for this argument. The earlier equality-forcing cyclic product with total mass two illustrates the difference.

기초Foundations

27. 화살표가 있어도 숫자가 독립일 수 있다27. An arrow can coexist with numerical independence

A가 공정한 이진 변수이고 B의 두 조건부 행이 모두 (1/2,1/2)이면 네 결합 칸은 모두 1/4입니다. A→B 그래프는 의존을 허용하지만 그 숫자에서는 P(A,B)=P(A)P(B)입니다. 따라서 그래프에서 연결되었다는 이유만으로 이 표의 독립을 거절하면 안 됩니다.

반대로 d-분리되어 있으면 그래프에 따라 곱해 만든 모든 분포에서 해당 조건부 독립이 성립합니다. 수치 검사는 주어진 한 분포의 교차곱만 확인합니다. 구조 보장, 숫자에 우연히 맞는 등식, 실제 자료의 표본 오차는 세 가지 다른 문제입니다. 실습의 정확한 유한 경험표 검사는 그 표 안의 등식이지 모집단 독립성에 대한 통계적 검정이 아닙니다.

Let A be fair binary and give B the same conditional row (1/2,1/2) under both A values. All four joint cells equal 1/4. A→B permits dependence, but these numbers satisfy P(A,B)=P(A)P(B). Graphical connection alone cannot reject independence of this table.

In contrast, d-separation guarantees the corresponding conditional independence in every distribution factorizing over the graph. Numerical checks test one distribution’s cross-products. Structural guarantees, parameter-specific equalities and sampling uncertainty are distinct issues. An exact check of a retained empirical table is not a statistical test of population independence.

기초Foundations

28. 상관 0도 독립과 다르다28. Zero correlation is different from independence

X가 −1,0,1을 각각 1/3로 갖고 Y=X²라고 합시다. E[X]=0, E[Y]=2/3, E[XY]=0이라 공분산은 0입니다. 두 분산은 양수여서 상관도 0입니다. 그런데 X=0이면 반드시 Y=0이고, 전체에서 Y=0의 확률은 1/3뿐입니다.

실제로 P(X=0,Y=0)=1/3은 두 주변확률의 곱 1/9와 다릅니다. 한 개의 공분산 등식보다 독립의 모든 칸 곱 등식이 훨씬 많은 것을 요구합니다. 베이즈망에서 조건부 독립을 선언하는 것은 단순히 회귀계수나 상관 하나를 0으로 놓는 것보다 강한 분포 가정입니다. 이 예에서도 X→Y의 표는 결정적이지만 계산 규칙은 일반 CPT와 같습니다.

Let X take −1,0,1 with probability 1/3 each, and let Y=X². Then E[X]=0, E[Y]=2/3 and E[XY]=0, so covariance is zero. Both variances are positive and correlation is zero too. Yet X=0 forces Y=0, whereas the unconditional probability of Y=0 is only 1/3.

Indeed P(X=0,Y=0)=1/3 differs from the marginal product 1/9. Independence requires all cell-product identities, much more than a single covariance identity. A Bayesian-network conditional-independence assumption is stronger than setting one correlation or regression coefficient to zero. Deterministic CPTs such as X→Y still use the same finite calculation rules.

기초Foundations

29. 보았다는 조건과 바꾸었다는 행동29. Observing a value and changing it are different operations

공정한 H가 A와 B에 그대로 복사되는 가정 모형 H→A,H→B를 봅니다. A=1을 관측하면 H=1이고 따라서 B=1의 확률도 1입니다. 하지만 H의 생성은 그대로 두고 A의 값만 외부에서 1로 바꾸면 B는 여전히 H를 따라 확률 1/2로 1입니다.

관측은 원래 결합표에서 줄을 남기는 작업이고, 외부 변경은 A를 만드는 규칙 자체를 바꾸는 새 모형입니다. 그래프를 인과적으로 해석할 근거가 없으면 첫 작업만으로 둘째 결과를 얻을 수 없습니다. 이번 장의 추론 API는 관측에 대한 확률을 계산합니다. 실제 임금·픽셀·고객 기록에서 발견한 비중을 행동의 성공 확률이나 개입 효과로 바꾸지 않습니다.

In a hypothetical fork H→A,H→B, let fair binary H be copied perfectly to both children. Observing A=1 reveals H=1 and hence makes P(B=1)=1. If instead an external action sets A=1 while leaving H’s generation unchanged, B still follows H and is one with probability 1/2.

Observation selects rows of the existing joint table; an external change replaces the rule generating A. Without support for a causal interpretation, the first calculation cannot establish the second. Our inference APIs condition on observations. Shares in wage, pixel or customer records are not automatically action-success probabilities or intervention effects.

기초Foundations

30. 같은 소식을 두 번 곱하지 않는다30. Do not multiply the same report twice

원래 우산 예에서 한 우산을 두 화면이 똑같이 전해 주었다면, 두 화면을 봐도 같은 정보 U=1입니다. 사후확률은 3/7 그대로입니다. 이를 비가 주어졌을 때 독립인 두 우산 관측이라고 잘못 모형화하면 가능도 비 3을 두 번 곱해 사후 오즈 9:4, 확률 9/13이 됩니다.

두 독립 관측과 같은 관측의 복사본은 서로 다른 결합분포입니다. 각각의 센서 정확도만 같다고 두 관측의 조건부 독립이 보장되지는 않습니다. 중복 기록·같은 출처의 재전송·공통 센서 고장은 별도 관계를 요구할 수 있습니다. 확률망을 작성할 때 변수 이름만 늘리기보다 무엇을 서로 다른 관측으로 셌는지 먼저 설명해야 합니다.

If two screens repeat the same umbrella report, both reveal the single event U=1. The posterior remains 3/7. Mistakenly treating them as conditionally independent umbrella observations multiplies likelihood ratio three twice, giving posterior odds 9:4 and probability 9/13.

Independent observations and copies of one report define different joint distributions. Matching individual sensor accuracies does not establish conditional independence. Duplicate records, retransmission from one source or common sensor faults may require additional dependence. Before adding variable names, explain what counts as a distinct observation.

심화Extension

31. 사전 확률을 조금 바꾸어 본다31. Perturb the prior probability

우산 가능도는 비에서 3/4, 맑음에서 1/4로 두고 비의 사전확률을 π∈[0,1]라 놓습니다. 비의 관측 무게는 3π/4, 전체 우산 무게는 (1+2π)/4이므로 사후확률은 f(π)=3π/(1+2π)입니다. 분모는 항상 1 이상이어서 이 우산 모형에서는 모든 π에서 정해집니다.

f(π)=3π1+2π,0≤π≤1f′(π)=3(1+2π)2≤3\begin{gathered}f(\pi)=\frac{3\pi}{1+2\pi},\quad 0\le\pi\le1\\f\prime(\pi)=\frac{3}{(1+2\pi)^2}\le3\end{gathered}

따라서 평균값 정리를 쓰면 사전 확률의 변화가 δ일 때 사후 변화의 절댓값은 3|δ| 이하입니다. 이 상계는 이번 고정 가능도 모형의 결과입니다. 일반 모형에서 관측 분모가 0에 가까우면 정규화가 작은 입력 차이에 민감할 수 있습니다. 이 유한 예의 안정성을 모든 희귀 관측에 확대하지 않습니다.

Keep umbrella likelihoods 3/4 under rain and 1/4 under dry weather, and let the rain prior be π∈[0,1]. The rain-and-umbrella weight is 3π/4 and the total umbrella weight is (1+2π)/4. Thus f(π)=3π/(1+2π), with a positive denominator throughout this example.

f(π)=3π1+2π,0≤π≤1f′(π)=3(1+2π)2≤3\begin{gathered}f(\pi)=\frac{3\pi}{1+2\pi},\quad 0\le\pi\le1\\f\prime(\pi)=\frac{3}{(1+2\pi)^2}\le3\end{gathered}

The mean value theorem bounds a posterior change by three times the absolute prior change. This bound belongs to these fixed likelihoods. In other models, an evidence denominator near zero can amplify small input changes. Stability of this finite example does not establish stability for every rare observation.

기초Foundations

32. 실습 D · 구조 보장과 교차곱을 비교한다32. Lab D · Compare graphical guarantees with cross-products

사슬에서 중간 변수를 조건으로 주고 d-분리와 수치 조건부 독립이 함께 나오는지 봅니다. 충돌점 OR 예에서는 공통 결과를 조건으로 주기 전과 후를 비교합니다. 마지막으로 A→B에 같은 조건부 행 두 개를 주면 그래프에서는 분리되지 않아도 숫자 독립은 맞습니다.

실습은 양의 조건 사건 개수와 무게 0이라 비율을 정의하지 않은 사건 개수를 구별합니다. 독립이 실패하면 처음 발견한 값 조합과 두 교차곱을 보여 줍니다. 그래프·정확표·관측 자료의 통계적 불확실성을 하나의 통과 표식으로 합치지 말고, 어떤 질문에 답했는지 읽으세요.

In a chain, condition on the middle and compare d-separation with numerical conditional independence. In the OR collider, compare before and after conditioning on the common effect. Finally give A→B identical CPT rows: the graph remains connected while numerical independence holds.

The lab distinguishes positive-mass conditioning contexts from zero-mass contexts where conditional ratios are undefined. When independence fails, it shows the first value configuration and the two unequal cross-products. Read which question was answered rather than merging graphical guarantees, exact table identities and sampling uncertainty into a single pass label.

기초Foundations

33. 다음 날은 현재 상태에서 한 번 이동한다33. Advance one step from the current state

비·맑음 두 상태를 가진 가정 시간 모형을 만듭니다. 오늘 비이면 내일 비 확률은 3/4, 오늘 맑으면 내일 비 확률은 1/4입니다. 행은 오늘, 열은 내일이며 행 순서는 비·맑음입니다. 오늘 비의 비중이 q이면 내일은 (3/4)q+(1/4)(1−q)=1/4+q/2입니다.

A=(3/41/41/43/4)qt+1=1/4+qt/2qt=1/2+(q0−1/2)2−t\begin{gathered}A=\begin{pmatrix}3/4&1/4\\1/4&3/4\end{pmatrix}\\q_{t+1}=1/4+q_t/2\\q_t=1/2+(q_0-1/2)2^{-t}\end{gathered}

현재 상태를 알면 그 이전 경로를 알아도 다음 상태의 분포가 더 바뀌지 않는다는 것이 일차 Markov 가정입니다. 여기서 전이표는 모든 날에 같습니다. 이를 시간 동질 모형이라고 합니다. 상태 분포가 매일 같다는 뜻은 아닙니다. q₀=1/5라면 q₁=7/20으로 변합니다. 처음부터 불변분포 q₀=1/2로 두어야 이 예의 상태 분포도 일정합니다.

Construct a hypothetical two-state weather model. Rain follows rain with probability 3/4 and follows dry weather with probability 1/4. Rows are today and columns tomorrow, both ordered rain,dry. If today’s rain share is q, tomorrow’s is (3/4)q+(1/4)(1−q)=1/4+q/2.

A=(3/41/41/43/4)qt+1=1/4+qt/2qt=1/2+(q0−1/2)2−t\begin{gathered}A=\begin{pmatrix}3/4&1/4\\1/4&3/4\end{pmatrix}\\q_{t+1}=1/4+q_t/2\\q_t=1/2+(q_0-1/2)2^{-t}\end{gathered}

The first-order Markov assumption says that knowing the current state makes older history unnecessary for predicting the next state. The same transition table on every day is time homogeneity. It does not make state distributions constant: q₀=1/5 gives q₁=7/20. Starting at the invariant distribution q₀=1/2 would keep this example’s state distribution constant.

기초Foundations

34. 상태는 숨기고 관측을 붙인다34. Hide the state and attach an observation

친구의 우산만 보고 실제 비 상태를 직접 보지 못한다고 합시다. 숨은 상태 Hₜ는 비·맑음이고 관측 Oₜ는 우산 있음·없음입니다. 상태 전이는 앞 절의 A이고, 관측 확률은 비일 때 우산 3/4, 맑을 때 1/4입니다. 상태가 주어지면 그 시점 관측은 다른 상태·관측들에 추가로 의존하지 않는다고 선언합니다.

P(h0:T−1,o0:T−1)=π(h0)bh0(o0)∏t=1T−1Aht−1,htbht(ot)P(h_{0:T-1},o_{0:T-1})=\pi(h_0)b_{h_0}(o_0)\prod_{t=1}^{T-1}A_{h_{t-1},h_t}b_{h_t}(o_t)

이것이 유한 숨은 Markov 모형, HMM입니다. 초기분포 π는 첫 시점 t=0의 관측을 보기 전 분포입니다. 먼저 O₀를 반영하고 t=1로 이동합니다. 첫 관측 전에 전이를 한 번 더 하는 관례와 혼합하면 날짜가 어긋납니다. 전이표와 관측표를 고정한 것은 이 연습의 가정이며 실제 기록에서 숨은 날씨와 두 표를 추정했다는 뜻은 아닙니다.

Suppose umbrellas are visible but the weather state is hidden. Hₜ is rain or dry, and Oₜ is umbrella or no umbrella. Use the preceding transition matrix A, with umbrella likelihood 3/4 under rain and 1/4 under dry weather. Given its current state, each observation is declared independent of the other states and observations.

P(h0:T−1,o0:T−1)=π(h0)bh0(o0)∏t=1T−1Aht−1,htbht(ot)P(h_{0:T-1},o_{0:T-1})=\pi(h_0)b_{h_0}(o_0)\prod_{t=1}^{T-1}A_{h_{t-1},h_t}b_{h_t}(o_t)

This is a finite hidden Markov model, or HMM. Initial π is the distribution before observing time t=0. Incorporate O₀ first, then transition to t=1. Mixing this with a convention that transitions before the first observation shifts the timeline. Fixed transition and observation tables are assumptions, not tables learned from actual hidden weather records.

기초Foundations

35. 예측하고 관측 무게를 곱한다35. Predict, then multiply observation weights

αₜ(j)를 지금까지의 관측과 현재 상태 j가 함께인 무게로 둡니다. 첫 시점은 π(j)에 첫 관측 가능도를 곱합니다. 다음 시점은 이전 상태 i 각각의 α를 전이 Aᵢⱼ와 곱해 더하고, 새 관측 가능도 bⱼ를 곱합니다. 합을 쓰는 이유는 어느 이전 상태였는지 관측하지 않았기 때문입니다.

α0(j)=π(j)bj(o0)αt(j)=bj(ot)∑iαt−1(i)AijP(o0:t)=∑jαt(j)\begin{gathered}\alpha_0(j)=\pi(j)b_j(o_0)\\\alpha_t(j)=b_j(o_t)\sum_i\alpha_{t-1}(i)A_{ij}\\P(o_{0:t})=\sum_j\alpha_t(j)\end{gathered}

마지막 합이 양수이면 α를 그 합으로 나누어 현재 상태의 필터링 분포를 얻습니다. 단계마다 정규화해도 같은 분포를 계산할 수 있지만, 전체 관측의 가능도를 얻으려면 단계별 나눗셈 상수도 보존해야 합니다. 이번 정확분수 엔진은 정규화 전 무게와 전체 가능도를 보존하므로 작은 수를 중간 표시로 먼저 0으로 만들지 않습니다.

Let αₜ(j) be the joint weight of all observations so far and current state j. At time zero multiply π(j) by the first observation likelihood. At later times sum incoming weights αₜ₋₁(i)Aᵢⱼ over previous states, then multiply by the new observation likelihood bⱼ. We sum because the previous state was not observed.

α0(j)=π(j)bj(o0)αt(j)=bj(ot)∑iαt−1(i)AijP(o0:t)=∑jαt(j)\begin{gathered}\alpha_0(j)=\pi(j)b_j(o_0)\\\alpha_t(j)=b_j(o_t)\sum_i\alpha_{t-1}(i)A_{ij}\\P(o_{0:t})=\sum_j\alpha_t(j)\end{gathered}

If the final sum is positive, dividing α by it gives the filtering distribution. Stepwise normalization can compute the same distribution, but recovering the full evidence likelihood also requires retaining normalization constants. Our exact-rational engine preserves unnormalized weights and likelihoods rather than rounding tiny intermediate weights to displayed zeros.

기초Foundations

36. 우산 있음 다음 없음의 두 번 갱신36. Update on umbrella, then no umbrella

초기 비 확률 1/5와 앞의 HMM에서 첫 우산 있음 관측을 반영하면 필터링은 (3/7,4/7)입니다. 한 번 전이한 다음 비 예측 비중은 (3/4)(3/7)+(1/4)(4/7)=13/28입니다. 다음 우산 없음 가능도는 비에서 1/4, 맑음에서 3/4입니다.

가정 HMM의 두 시점 필터링
단계비맑음
첫 관측 뒤3/74/7
다음 관측 전 예측13/2815/28
다음 관측 없음의 무게13/11245/112
두 번째 필터링13/5845/58

두 번째 관측의 조건부 가능도는 29/56입니다. 첫 관측 가능도 7/20와 곱하면 전체 관측 가능도는 29/160입니다. 우산 없음이 비를 완전히 배제하지는 않습니다. 비인데 우산을 들지 않을 확률을 1/4로 허용했기 때문입니다.

With initial rain probability 1/5, the first umbrella observation produces filtering distribution (3/7,4/7). One transition predicts rain share (3/4)(3/7)+(1/4)(4/7)=13/28. The next no-umbrella likelihoods are 1/4 under rain and 3/4 under dry weather.

Two-time filtering in the hypothetical HMM
StageRainDry
After first observation3/74/7
Next prediction13/2815/28
No-umbrella weights13/11245/112
Second filtering13/5845/58

The second observation has conditional likelihood 29/56. Multiplying by the first likelihood 7/20 gives full likelihood 29/160. No umbrella does not completely rule out rain because the model allows no umbrella under rain with probability 1/4.

심화Extension

37. 나중 정보를 써서 과거를 다시 본다37. Use later evidence to revisit the past

두 번째 날에 우산이 없었다는 정보는 첫날 비에 대한 믿음도 바꿀 수 있습니다. 첫 상태가 비일 때 다음 우산 없음의 가능도는 (3/4)(1/4)+(1/4)(3/4)=3/8입니다. 첫 상태가 맑음이면 (1/4)(1/4)+(3/4)(3/4)=5/8입니다. 이를 첫 α=(3/20,4/20)에 곱하면 (9/160,20/160)입니다.

βT−1(i)=1βt(i)=∑jAijbj(ot+1)βt+1(j)P(Ht=i∣o0:T−1)=αt(i)βt(i)P(o0:T−1)\begin{gathered}\beta_{T-1}(i)=1\\\beta_t(i)=\sum_j A_{ij}b_j(o_{t+1})\beta_{t+1}(j)\\P(H_t=i\mid o_{0:T-1})=\frac{\alpha_t(i)\beta_t(i)}{P(o_{0:T-1})}\end{gathered}

전체 가능도 29/160로 나누면 첫날 스무딩은 (9/29,20/29)입니다. 당시 정보만 쓴 필터링 (3/7,4/7)과 다릅니다. 이것은 과거 날씨를 바꾸는 것이 아니라, 나중 정보를 더 가진 사람이 과거 상태에 대한 분포를 다시 계산한 것입니다. 마지막 시점의 스무딩은 그때까지의 필터링과 같습니다.

The second day’s no-umbrella evidence can revise beliefs about the first day. Its likelihood given first-day rain is (3/4)(1/4)+(1/4)(3/4)=3/8; given first-day dry weather it is (1/4)(1/4)+(3/4)(3/4)=5/8. Multiply first α=(3/20,4/20) by these likelihoods to obtain (9/160,20/160).

βT−1(i)=1βt(i)=∑jAijbj(ot+1)βt+1(j)P(Ht=i∣o0:T−1)=αt(i)βt(i)P(o0:T−1)\begin{gathered}\beta_{T-1}(i)=1\\\beta_t(i)=\sum_j A_{ij}b_j(o_{t+1})\beta_{t+1}(j)\\P(H_t=i\mid o_{0:T-1})=\frac{\alpha_t(i)\beta_t(i)}{P(o_{0:T-1})}\end{gathered}

Dividing by full likelihood 29/160 gives first-day smoothing (9/29,20/29), different from filtering (3/7,4/7) based only on information available then. The past weather is unchanged; a better-informed observer recomputes its distribution. Smoothing at the last time equals filtering there.

기초Foundations

38. 한 시점 최대와 전체 경로 최대38. A marginal mode and a whole-path mode

두 관측 있음·없음의 HMM에서 비→비, 비→맑음, 맑음→비, 맑음→맑음의 관측 포함 결합 무게는 각각 9/320,9/320,4/320,36/320입니다. 가장 큰 전체 경로는 맑음→맑음이고, 관측을 조건으로 한 그 경로 확률은 (36/320)/(29/160)=18/29입니다.

각 시점에서 가장 가능성 큰 상태를 따로 고르는 것과 전체 경로의 최대는 일반적으로 다릅니다. 예를 들어 두 시점 경로 무게가 (비비,비맑음,맑음비,맑음맑음)=(2/5,0,7/20,1/4)이면 시점별 최대는 맑음→비지만 경로 최대는 비→비입니다. 실제로 두 최대값의 무게는 7/20와 2/5로 다릅니다.

Viterbi는 각 끝 상태에 도달하는 최선 경로의 무게를 보관하며 합 대신 최댓값으로 갱신합니다. 확률표 전체를 구하는 필터링과 다른 질문입니다. 동률이면 선언한 상태 순서의 사전식 첫 경로를 대표로 보여 주고, 전체 동률 경로 수를 별도로 기록합니다.

For umbrella followed by no umbrella, path weights including evidence for rain–rain, rain–dry, dry–rain and dry–dry are 9/320,9/320,4/320,36/320. The whole-path mode is dry–dry, with conditional probability (36/320)/(29/160)=18/29.

Choosing the most probable state separately at each time need not maximize the whole path. If two-time path masses in that same order are (2/5,0,7/20,1/4), marginal modes give dry–rain while the path mode is rain–rain. Their masses are 7/20 and 2/5.

Viterbi stores the best path reaching each end state, updating with maxima rather than sums. This answers a different question from filtering distributions. Ties use the lexicographically first path under declared state order as a representative, with the complete tied-path count reported separately.

기초Foundations

39. 빠진 관측과 불가능 관측을 구별한다39. Distinguish a missing observation from impossible evidence

특정 시점의 관측을 하지 않았다면 그때의 관측 가능도 인수를 1로 둡니다. 상태 전이는 그대로 수행하며, 분포를 균등하게 초기화하지 않습니다. 실습의 null은 이 미관측 표지입니다. 문자 상태 이름 "null"과도 다릅니다. 관측 시점의 순서와 누락 위치를 보존해야 합니다.

어느 접두 관측의 가능도가 0이 되면 그 이후 필터링은 원래 모형에서 정의되지 않습니다. 그 전까지 양수였던 접두 필터링은 여전히 당시 정보에 대한 유효한 계산입니다. 반면 전체 불가능 관측을 조건으로 한 모든 시점의 스무딩과 경로 사후분포는 미정의입니다. T=0인 빈 관측열의 가능도는 빈 곱 1이고 유일한 빈 경로도 무게 1입니다. 상태를 관측했다는 뜻은 아닙니다.

At a time with no observation, use likelihood factor one. Still perform state transitions; do not reset beliefs to uniform. The lab’s null marks this missing observation and differs from the literal symbol name "null". Preserve observation order and missing positions.

Once a prefix has zero likelihood, subsequent filtering is undefined under the model. Earlier positive-prefix filtering remains valid for the information available then. Conditioning on the impossible full sequence makes every smoothed distribution and latent-path posterior undefined. An empty T=0 sequence has likelihood one and a unique empty path of mass one; it observes no state.

기초Foundations

40. 실습 E · 필터링·스무딩·경로를 나란히40. Lab E · Compare filtering, smoothing and paths

초기분포 (1/5,4/5), 전이와 관측 행의 3/4·1/4를 놓고 관측 [있음,없음]을 입력하세요. 첫 필터링 3/7, 두 번째 비 예측 13/28, 두 번째 필터링 13/58, 첫 스무딩 9/29와 전체 경로 맑음→맑음을 각각 찾습니다. 서로 다른 시점과 정보 집합을 쓰므로 같은 값이어야 하는 숫자들이 아닙니다.

관측 하나를 null로 바꿀 때와 가능도 0인 관측을 넣을 때를 비교합니다. 상태 순서만 뒤집어 동률 대표 경로가 그 선언 순서에 따라 바뀌는지도 확인합니다. 동률 대표의 변경은 최대 무게나 동률 수의 변경을 뜻하지 않습니다. 그림에는 현재 폭에 맞춘 시점 축과 상태별 비중을 보여 줍니다.

Use prior (1/5,4/5), transition and observation rows with 3/4 and 1/4, and observations [umbrella,no umbrella]. Locate first filtering 3/7, second rain prediction 13/28, second filtering 13/58, first smoothing 9/29 and the dry–dry path mode. Different times and information sets need not give equal numbers.

Compare a null observation with a zero-likelihood observation. Reverse declared state order and inspect a tied representative path. Changing the representative does not change the maximum weight or tie count. The plot shows time and state shares using the current available width.

기초Foundations

41. 국가 16개에서 두 지표의 교차표를 만든다41. Cross-tabulate two indicators for sixteen countries

보관 World Bank 원 응답에서 2024년 1인당 GDP와 출생 시 기간 기대수명을 같은 국가에 맞춥니다. GDP는 2015년 불변 미국 달러/명, 기대수명은 년입니다. GDP가 30,000 이상이면 high, 수명이 80년 이상이면 atLeast80으로 표시합니다. 이는 이 장에서 고른 경계이며 공식 국가 분류가 아닙니다.

실제 16개 관측의 선택 범주 교차표
선택 GDP 범주수명 80 미만수명 80 이상합
low707
high189
합8816

16개 기록 중 하나를 같은 확률로 뽑는 유한 실험을 정하면 high와 atLeast80의 결합확률은 8/16=1/2입니다. 수명 80 이상이라는 관측 아래 high의 비중은 8/8=1입니다. GDP를 올리는 개입이 수명을 올린다는 결론은 이 표로 정해지지 않습니다. 두 변수의 같은 연도 측정, 선택된 국가 범위, 개인 수가 아닌 국가 하나당 같은 무게라는 조건을 함께 읽어야 합니다.

Match retained original World Bank GDP per capita and period life expectancy at birth for the same sixteen countries in 2024. GDP is in constant 2015 US dollars per person; life expectancy is in years. Mark GDP at least 30,000 as high and life expectancy at least eighty as atLeast80. These thresholds are chosen for this chapter, not official country classifications.

Chosen-category table of sixteen actual records
Chosen GDP bandLife below80Life atLeast80Total
low707
high189
Total8816

Declare a finite experiment drawing each retained country record with equal probability. The joint high/atLeast80 probability is 8/16=1/2, and the conditional high share given atLeast80 is 8/8=1. This does not identify an effect of intervening on GDP. Read the same-year measurement, selected-country scope and equal country weights rather than population weights alongside the table.

기초Foundations

42. 두 실제 픽셀을 본 뒤 숫자 라벨을 갱신한다42. Update digit labels after observing two actual pixels

UCI optdigits의 제공 시험 파일 1,797행에서 실제 라벨과 0부터 세는 p18·p45 두 픽셀을 읽습니다. 원 강도는 0~16이며 8 이상을 ink, 나머지를 pale로 선택합니다. 두 칸이 ink인 기록은 757개이고 라벨 0이 149개입니다. 따라서 이 유한 기록 표에서 P(Digit=0|두 ink)=149/757입니다. 149/1,797은 조건부확률이 아니라 결합확률입니다.

포화 모형 Digit→P18, Digit→P45, P18→P45는 전체 관측 교차표를 정확히 재표현합니다. 마지막 화살표를 없애고 두 픽셀이 라벨 아래 조건부 독립이라고 가정하면 naïve 모형입니다. 그 확률표는 일반적으로 달라집니다. 이 차이는 구조 근사에 따른 계산 차이이며 제공 시험 표에 맞춘 값을 새로운 필기 자료의 성능으로 보고하지 않습니다. 원 라벨을 조건부표 작성에 썼으므로 이 표를 독립적인 최종 평가 자료라고 다시 부를 수도 없습니다.

Read labels and zero-based pixels p18 and p45 from all 1,797 rows of the provided UCI optdigits test file. Original intensities range from zero to sixteen; choose ink for values at least eight. Both cells are ink in 757 records, including 149 label-zero records. Thus the finite-table conditional probability is 149/757. The denominator 1,797 instead gives their joint probability.

A saturated graph with Digit→P18, Digit→P45 and P18→P45 exactly re-expresses the observed joint table. Deleting the last arrow assumes the two pixels are conditionally independent given the label, producing a naïve model whose probabilities generally differ. This is a structural approximation comparison, not performance on new handwriting. Labels already used to form these tables cannot also supply an untouched final evaluation set.

기초Foundations

43. 민원·상태·이탈 기록을 한 표로 읽는다43. Read complaints, status and churn in one table

실제 고객 3,150개 행에서 원 Complains, Status, Churn 세 열을 그대로 보존합니다. 민원 1·상태 2인 행은 158개이고 이탈 1이 141개이므로 해당 유한 기록의 조건부 비중은 141/158입니다. 상태 2만으로 고른 집합이나 민원 1만으로 고른 집합은 분모가 다릅니다. Status의 시점과 Churn과의 관계를 해석하기 전에 원 자료사전을 읽어야 합니다.

세 변수의 포화 분해는 한 가지 순서의 연쇄법칙일 뿐 민원이 상태를 일으킨다는 인과 순서가 아닙니다. 비교용 naïve 구조는 Churn을 공통 부모로 두고 Complains와 Status를 조건부 독립으로 놓습니다. 이것은 계산에 추가한 가정입니다. 같은 데이터에서 표를 만들고 다시 조회한 확률을 미래 고객의 검증 성능이나 민원 대응 정책 효과로 확대하지 않습니다. 개인 고유 식별자도 원 파일에서 확인되지 않으므로 같은 값이 반복된다고 행을 합치지 않습니다.

Preserve original Complains, Status and Churn tokens for all 3,150 customer rows. There are 158 rows with complaint 1 and status 2, including 141 churn 1 rows, giving 141/158 within this finite table. Conditioning on only status 2 or only complaint 1 uses a different denominator. Consult the data dictionary before interpreting status timing or its relation to churn.

The saturated factorization is a chain-rule ordering, not a causal claim that complaints cause status. The comparison naïve structure takes Churn as a common parent and assumes Complains and Status conditionally independent given it. This is an added modeling assumption. Querying a table constructed from these records is neither future-customer validation nor an estimate of a complaint-response intervention. No verified unique person ID is supplied; repeated values do not justify deduplicating rows.

기초Foundations

44. 표에 없는 조합의 조건부확률44. Conditionals in an unobserved empirical context

16국 표에는 low이면서 수명 80 이상인 기록이 없습니다. 결합 셀 비중 0은 정의되지만, 그 조합을 부모 문맥으로 삼은 다음 변수의 경험 조건부확률은 분모 0으로 정해지지 않습니다. 그래프 계산용 CPT의 모든 문맥 행을 채워야 하므로 엔진은 이때 균등한 행을 하나의 명시적 규약으로 둡니다. 그 문맥의 결합 무게가 0이면 이 행을 달리 채워도 원 경험 결합표는 같습니다.

이 규약은 관측하지 않은 조합에서 각 결과가 실제로 같은 확률이라는 추정이 아닙니다. 불가능한 증거를 조건으로 조회하면 정규화할 분모가 0이라 posterior는 미정의로 표시합니다. 임의의 균등 CPT 행과 불가능 증거의 균등 사후분포를 혼동하지 마세요. 새로운 사례로 일반화하려면 표본 설계, 평활화나 모수 가정과 별도 검증이 필요합니다.

The sixteen-country table contains no low-GDP/atLeast80 record. Its joint cell probability is defined as zero. But using that zero-mass combination as a parent context leaves any subsequent empirical conditional unidentified because its denominator is zero. A complete computational CPT still needs a row, so the engine uses an explicitly arbitrary uniform row there. If the parent context has zero joint mass, changing that row leaves the empirical joint unchanged.

This convention does not estimate equal real-world outcome probabilities in an unseen context. Querying impossible evidence yields an undefined posterior because its normalizing mass is zero. Distinguish a computational zero-parent-context row from a uniform posterior for impossible evidence. Generalization needs sampling, smoothing or parametric assumptions and separate validation.

기초Foundations

45. 행 순서를 시간 전이로 바꾸지 않는다45. Do not turn row order into temporal transitions

국가 행의 알파벳 순서, 제공 시험 숫자의 저장 순서, 고객 파일의 원위치는 재현을 위한 식별 정보입니다. 같은 개인이나 회사의 연속 시점이라는 증거가 없습니다. 따라서 인접 행의 범주 변화율을 바로 HMM 전이 확률이라고 부르지 않습니다. 반복 측정 단위와 실제 시간, 관측 간격이 먼저 필요합니다.

이 장의 시간 실습은 명시적으로 가정한 날씨 모형을 쓰고 실제 세 자료 실습은 유한 교차표를 씁니다. 서로 다른 두 계산을 같은 그래프로 그릴 수 있다는 사실이 자료의 시간 의미를 만들어 주지는 않습니다. 대학원 수준으로 확장하면 HMM 모수 식별, 라벨 교환, 비정상 전이와 누락 관측의 메커니즘을 추가로 연구합니다. 그때도 모형 적합과 모형의 실질 타당성은 따로 논증합니다.

Alphabetical country order, stored digit-test order and original customer row position are reproducibility labels. They do not verify repeated times for the same person or firm. An adjacent-row category change rate therefore cannot simply be called an HMM transition probability. Establish repeated units, timestamps and observation intervals first.

Temporal labs here use an explicitly hypothetical weather model; the three actual-data labs use finite cross-tables. The ability to draw both computations does not create temporal meaning in the records. Graduate extensions include HMM parameter identification, label switching, nonstationary transitions and missing-observation mechanisms. Fitting a model and justifying its substantive assumptions remain separate arguments.

기초Foundations

46. 실습 F · 실제 표와 근사 모형을 비교한다46. Lab F · Compare an actual table and a model approximation

국가를 선택해 수명 80 이상 조건에서 high 확률 1과 결합 셀 8/16을 확인하세요. 개인 자료에서는 두 ink 조건의757행·라벨0의149행을 찾아149/757을 직접 구합니다. 기업 자료에서는 원 민원1·상태2의158행 중 이탈141행을 세어141/158을 확인합니다. 관측 조건을 바꾸면 새 분모를 먼저 적습니다.

개인·기업에서 포화와 naïve를 번갈아 보고, 같은 조건·변수 순서에서 enumeration과 elimination 결과가 같은지 확인합니다. 근사 구조를 바꾸면 결과가 달라질 수 있지만 정확 추론 방법만 바꾸면 같은 확률이 나와야 합니다. 고정 Python/R 예는 따로 보관한 실제 실행이며 현재 슬라이더·입력은 JavaScript 계산입니다.

For countries check high probability 1 under atLeast80 and joint cell 8/16. For digit records recover 757 matching rows and 149 label-zero rows, hence 149/757. For customers recover 141 churn rows among 158 complaint 1/status 2 rows, hence 141/158. Write the changed denominator before interpreting a changed evidence condition.

Compare saturated and naïve structures for digits and customers. Enumeration and elimination should agree for the same structure, query and evidence; changing a structural approximation may change the answer. Fixed Python/R examples are separately archived actual runs. Current controls compute JavaScript.

기초Foundations

47. 국가·개인 자료·기업의 관측과 가정47. Observed and assumed parts of country, individual-record and company cases

국가 · GDP와 수명의 유한 교차표

세계의 나라들을 비교할 때 한 나라의 통계가 한 사람의 결과처럼 읽히지 않도록, 먼저 추출 단위를 고릅니다. 이 사례의 유한 실험은 보관된 16개 국가 기록 중 하나를 같은 확률로 고르는 것입니다. 원 World Bank JSON의 2024년 GDP와 수명을 국가 코드로 맞추며, GDP는 2015년 불변 USD/명, 수명은 출생 시 기간 기대수명(년)입니다.

아래 표에는 원 응답의 두 위치와 읽기용 반올림값을 보입니다. 원 토큰은 CSV에 그대로 있고 문턱 판정은 그 정확한 수치로 계산합니다. GDP 30,000·수명80은 이번 학습의 선택 경계이며 공식 소득 분류나 개인의 생존 예측 기준이 아닙니다.

실제16국의 두 원지표와 선택 범주
국가GDP원위치수명원위치2015 USD/명수명 년선택 범주
AUS21612881≈61486.38≈83.051high/atLeast80
BRA22062926≈9566.75≈76.023low/below80
CAN22512971≈45061.39≈82.108high/atLeast80
CHN22963016≈13119.11≈78.017low/below80
DEU23413061≈44027.76≈80.793high/atLeast80
FRA23863106≈39683.40≈82.980high/atLeast80
GBR24313151≈47900.97≈81.387high/atLeast80
IDN24763196≈4367.95≈71.288low/below80
IND25213241≈2366.83≈72.235low/below80
JPN25663286≈37976.64≈84.036high/atLeast80
KOR26113331≈37048.43≈83.629high/atLeast80
MEX26563376≈10284.03≈75.264low/below80
SGP27013421≈68129.70≈83.346high/atLeast80
USA27463466≈66856.51≈78.890high/below80
VNM27913511≈4012.51≈74.736low/below80
ZAF28363556≈5715.48≈66.312low/below80

네 셀을 세면 high/80이상8, high/80미만1, low/80미만7, low/80이상0입니다. 전체16을 분모로 쓰는 결합비중과 관측 조건이 남긴 부분집합을 분모로 쓰는 조건부비중을 나란히 계산합니다.

실제 관측에서 계산한 유한 교차표
GDP / 수명 범주기록 수동일국가무게 결합비중
low / below8077/16
low / atLeast8000
high / below8011/16
high / atLeast8081/2

수명80이상 조건을 받으면 남는8개 모두 high여서 조건부확률1입니다. 반대 방향 P(80이상|high)는8/9입니다. 포화분해 P(GDP)P(Life|GDP)는 같은 교차표를 정확히 재표현합니다. 숫자가1인 셀도 특정한16국·문턱·보관 시점의 기록 범위에서 읽습니다.

국가를 인구수로 가중하면 다른 실험입니다. 현재 표로 GDP 정책의 수명 효과, 국가 안 개인의 수명, 미래국가의 범주를 판정했다고 말할 수 없습니다. 같은 연도 지표의 통계적 연관과 개입의 효과를 구별해야 합니다.

직접 해보기

low/80이상 셀이0이면 P(GDP=low,Life=80이상)과 그 두 값을 동시에 증거로 준 사후는 어떻게 다른가?

결합비중0은 정의됩니다. 하지만 그 불가능한 조합을 조건으로 한 사후는 분모0이라 미정의입니다. 균등한 값을 넣지 않고 실습의 impossible evidence 표시를 확인합니다. 원자료의 범위 밖 일반화는 추가 자료와 설계가 필요합니다.

개인 자료 · 두 실제 픽셀의 관측 정보

한 장의 손글씨 숫자 영상은 여러 픽셀의 조합입니다. 여기서는 원 UCI optdigits.zip의 제공 시험 파일 optdigits.tes 전체1,797행을 읽고, 라벨과0부터 세는 p18,p45 두 칸을 선택했습니다. 강도0~16의 원값은 보존하고 8이상을 ink로 부르는 이진 표현을 따로 만듭니다.

제공 시험 파일 첫 여섯 실제 기록
원행실제 라벨p18원값p45원값선택 표현
101512ink/ink
2136pale/pale
3280ink/pale
43110pale/ink
54116pale/ink
651316ink/ink

두 칸 모두 ink인 조건은757행을 남깁니다. 이 중 라벨0이149행이어서 P(Digit=0|ink,ink)=149/757입니다. 모든 라벨별 조건부를 더하면1입니다. 이 확률은 이 파일 안에서 같은 무게로 한 행을 뽑는 실험이며 필기 작성자의 신원이나 일반적 숫자 인식 성능을 뜻하지 않습니다.

같은 실제 관측 조건에서 포화표와 독립 근사를 비교
라벨전체 라벨 도수두ink 도수포화 조건부 정확값naïve 조건부 근삿값
0178149149/757≈0.19772141
11823535/757≈0.04276143
217788/757≈0.01157886
31833636/757≈0.04655363
41819191/757≈0.13587564
5182108108/757≈0.14228296
6181113113/757≈0.14930039
71792222/757≈0.01737628
81748585/757≈0.11259622
9180110110/757≈0.14395319

포화 모형은 P(Digit)P(P18|Digit)P(P45|Digit,P18)입니다. 마지막 가능도에서 P18을 지우면 두 픽셀이 라벨 아래 독립이라는 naïve 가정을 추가합니다. 실제 두 픽셀의 도수는 그 독립을 자동으로 만족하지 않습니다. 따라서 같은 조건을 조회해도 두 모형의 사후가 달라질 수 있습니다.

예를 들어 라벨0의 전체178행 중 두 ink는149행입니다. 두 픽셀 각각의 ink 도수는174행과151행이라 독립 근사는 공동 ink 가능도를(174/178)(151/178)으로 놓습니다. 실제149/178과 다른 값입니다. 실습에서 조건을 한 칸씩 바꾸어 왜 분모와 사후가 달라지는지 확인합니다.

원 파일의 이름 test는 제공자의 분할 표지입니다. 이번에는 그 라벨을 확률표 작성에 사용했으므로 그대로 다시 조회한 결과를 손대지 않은 최종 평가 성능이라고 부르지 않습니다. 신규 필기의 검증에는 별도 학습·조정·평가 분리와 적절한 표본이 필요합니다.

직접 해보기

라벨2의 네 픽셀범주 중 일부 도수가 작다면 0셀을 매우 확실한 불가능성으로 해석해도 될까요?

관측되지 않은 셀은 현재 유한 경험표에서0입니다. 새 표본의 확률0을 입증한 것은 아닙니다. 평활화를 적용하면 새 모형 가정을 추가하는 것이므로 원 도수와 구분하여 비교해야 합니다.

기업 · 민원·상태·이탈의 같은 기록 표

실제 UCI 고객 이탈 자료의3,150행에서 Complains,Status,Churn의 원 문자열 세 필드를 읽습니다. 이 표의 한 행을 같은 무게로 뽑는 실험을 정의합니다. 원위치와 토큰을 유지하며 같은 세 값이 반복된다는 이유로 서로 다른 행을 하나로 합치지 않습니다.

세 원필드의 전체 여덟 결합 도수
민원상태이탈실제 기록 수
0102219
01166
020395
021229
11024
11159
12017
121141

민원1·상태2라는 증거는158행이고 이탈1이141행입니다. 따라서 이 유한 표의 이탈 사후는141/158입니다. 민원이 없는 집단을 섞거나 상태 조건을 제거하면 선택된 집합의 분모가 달라집니다. 데이터사전의 상태 의미와 측정 시점을 확인해야 하며, Status를 곧바로 미래에 이용 가능한 예측변수라고 가정하지 않습니다.

증거 네 문맥의 경험 조건부와 구조 근사
민원 / 상태 증거남은 기록 수이탈1 수포화 이탈 조건부naïve 이탈 조건부 근삿값
0/122856666/2285≈0.03263233
0/2624229229/624≈0.35216420
1/1835959/83≈0.59318111
1/2158141141/158≈0.95917845

포화 분해는 원 세 변수의 결합표를 정확히 보존합니다. 비교용 naïve 모형은 Churn을 공통 부모로 두고 민원과 상태가 Churn 아래 독립이라고 정합니다. 그때 민원1·상태2의 이탈 사후는1091500/1137953으로141/158과 다릅니다. 독립 근사와 정확 알고리즘의 차이를 혼동하지 마세요.

조건부 비중이 크다는 사실만으로 민원을 없애면 이탈이 이만큼 줄어든다는 정책 효과가 정해지지 않습니다. 민원·상태·이탈의 시점, 선택, 미관측 차이와 어떤 개입인지가 필요합니다. 원 행의 순서도 동일 고객의 시간 기록이라는 증거가 아니므로 여기서 HMM 전이를 추정하지 않습니다.

직접 해보기

같은 포화 모형에 enumeration과 variable elimination을 적용했더니 다른 이탈 확률이 나온다면 먼저 무엇을 확인하나요?

세 변수의 상태 순서, 원 도수, 증거 토큰과 질의를 같게 고정했는지 확인합니다. 입력이 같고 두 계산이 완료되었다면 답은 일치해야 합니다. naïve로 구조를 바꿨을 때의 차이는 그와 별도로 비교합니다.

Country · a finite GDP/life-expectancy table

Begin by naming the drawing unit. This finite experiment uniformly selects one of sixteen retained country records. Match World Bank 2024 GDP and life-expectancy observations by country code. GDP uses constant 2015 US dollars per person; life expectancy is period life expectancy at birth in years, not an observed individual lifetime.

The table preserves both original response positions and shows rounded values for reading. Exact original tokens remain in CSV and determine threshold membership. GDP 30,000 and life 80 are authored thresholds rather than official income classifications or individual survival rules.

Two actual source indicators and chosen bands for sixteen countries
CountryGDP positionLife position2015 USD/personLife yearsChosen bands
AUS21612881≈61486.38≈83.051high/atLeast80
BRA22062926≈9566.75≈76.023low/below80
CAN22512971≈45061.39≈82.108high/atLeast80
CHN22963016≈13119.11≈78.017low/below80
DEU23413061≈44027.76≈80.793high/atLeast80
FRA23863106≈39683.40≈82.980high/atLeast80
GBR24313151≈47900.97≈81.387high/atLeast80
IDN24763196≈4367.95≈71.288low/below80
IND25213241≈2366.83≈72.235low/below80
JPN25663286≈37976.64≈84.036high/atLeast80
KOR26113331≈37048.43≈83.629high/atLeast80
MEX26563376≈10284.03≈75.264low/below80
SGP27013421≈68129.70≈83.346high/atLeast80
USA27463466≈66856.51≈78.890high/below80
VNM27913511≈4012.51≈74.736low/below80
ZAF28363556≈5715.48≈66.312low/below80

Counting gives eight high/atLeast80, one high/below80, seven low/below80 and zero low/atLeast80 records. Compare joint shares with denominator sixteen and conditional shares with the subset retained by evidence.

Finite cross-table calculated from retained observations
GDP / Life bandsRecordsEqual-country joint share
low / below8077/16
low / atLeast8000
high / below8011/16
high / atLeast8081/2

All eight records satisfying atLeast80 have high GDP, giving conditional probability one. Reversing the question gives P(atLeast80|high)=8/9. Saturated factorization P(GDP)P(Life|GDP) exactly re-expresses this table. Even probability one retains its specific country frame, thresholds and retained vintage.

Weighting countries by population would define another experiment. This table does not identify a GDP-policy effect, an individual lifetime or future-country probabilities. Same-year statistical association and intervention effects remain distinct.

Try it

How does zero joint mass for low/atLeast80 differ from conditioning on that impossible combination?

The joint probability zero is defined. A posterior conditional on that combination has zero denominator and is undefined. Check the impossible-evidence output rather than filling a uniform distribution. Extending beyond the retained frame requires additional design and evidence.

Individual record · evidence in two actual pixels

A handwritten digit image contains a configuration of pixels. Read all 1,797 rows of the original UCI optdigits.tes provided-test file and select its label plus zero-based pixels p18,p45. Preserve original intensities from zero to sixteen and separately choose ink for values at least eight.

First six actual provided-test records
Source rowActual labelOriginal p18Original p45Chosen representation
101512ink/ink
2136pale/pale
3280ink/pale
43110pale/ink
54116pale/ink
651316ink/ink

Both pixels are ink in 757 rows, including 149 label-zero rows, so P(Digit=0|ink,ink)=149/757. Posterior shares across all ten labels sum to one. This refers to uniformly drawing a retained record, not writer identity or general digit-recognition performance.

Saturated and independence-approximation answers under the same actual evidence
LabelAll label rowsBoth-ink rowsExact saturated posteriorApproximate naïve posterior
0178149149/757≈0.19772141
11823535/757≈0.04276143
217788/757≈0.01157886
31833636/757≈0.04655363
41819191/757≈0.13587564
5182108108/757≈0.14228296
6181113113/757≈0.14930039
71792222/757≈0.01737628
81748585/757≈0.11259622
9180110110/757≈0.14395319

The saturated model is P(Digit)P(P18|Digit)P(P45|Digit,P18). Dropping P18 from the last conditional adds the naïve conditional-independence assumption. Actual pixel counts need not satisfy it, so identical evidence can yield different model posteriors.

For example, among 178 label-zero rows 149 have both pixels ink. The individual ink counts are 174 and 151. Independence uses(174/178)(151/178), differing from the observed joint ink likelihood 149/178. Change evidence one pixel at a time and follow the changed denominators.

The source name test is a provider split label. Because this analysis used those labels to construct its tables, querying them again is not untouched final evaluation. New-handwriting validation needs separate fitting/tuning/evaluation roles and an appropriate sample.

Try it

May a small or zero observed cell be called a certain impossibility for a new handwritten digit?

It is zero in this finite empirical table, not proof of population probability zero. Smoothing would add a modeling choice and should be compared with the unchanged observed counts.

Company · the same complaint/status/churn records

Read the original Complains, Status and Churn tokens for all 3,150 UCI customer-churn rows. Define uniform drawing of one retained record. Keep source positions and do not merge separate rows merely because these three values repeat.

All eight joint counts from three original fields
ComplaintsStatusChurnActual records
0102219
01166
020395
021229
11024
11159
12017
121141

Complaint 1/status 2 evidence retains 158 rows,141 of them churn 1, yielding finite-table posterior 141/158. Changing or dropping an evidence condition changes the selected denominator. Consult status semantics and measurement timing rather than automatically treating it as an available future-prediction feature.

Empirical conditional and structural approximation in four evidence contexts
Complaint / Status evidenceRetained recordsChurn 1 recordsExact saturated conditionalApproximate naïve conditional
0/122856666/2285≈0.03263233
0/2624229229/624≈0.35216420
1/1835959/83≈0.59318111
1/2158141141/158≈0.95917845

Saturated factorization preserves the full three-variable table. A comparison naïve model takes Churn as a common parent and declares Complains and Status conditionally independent given it. Its default-evidence posterior 1091500/1137953 differs from 141/158. Distinguish the structural approximation from the choice of exact inference algorithm.

A large conditional churn share does not identify the effect of eliminating complaints. Timing, selection, unobserved differences and the intervention require further assumptions. Row order is not verified repeated-customer time, so no HMM transition is inferred from these records.

Try it

What should be checked first if enumeration and variable elimination produce different churn probabilities for the same saturated model?

Fix identical state ordering, counts, query and evidence tokens. If both methods complete for the same model their exact answers must agree. Changing to a naïve structure is a separate model comparison.

기초Foundations

48. 공식 강의와 학자를 읽고 가정을 점검한다48. Read official lectures and scholars to inspect assumptions

CS50의 Uncertainty 강의는 확률·조건부확률에서 Bayes 망과 HMM까지 연결합니다. 본문 재생창에서 필요한 구간을 보고 같은 수치를 직접 계산하세요. UCLA의 Judea Pearl 공식 소개에는 지식 표현과 확률·인과 추론이 연구 관심으로 나옵니다. 이 장은 그 관심을 확률표와 인과 질문의 구분에 연결하지만 확률망 하나를 그려 인과성을 증명했다고 말하지 않습니다.

Berkeley CS188의 Exact Inference에서 숨은 변수에 관련된 인수를 먼저 결합하고 더하는 순서를 확인합니다. 최대 인수 크기에 따라 계산 이득이 달라진다는 마지막 문장까지 읽어 보세요. HMM 읽기에서는 먼저 전이하는 강의의 W₀→W₁ 관례와 이 장의 t=0에서 첫 관측을 붙이는 관례를 시간축에 나란히 적습니다. 둘 다 쓸 수 있지만 초기분포가 어느 순간인지 섞지 않아야 합니다.

CS50 공식 강의 · UCLA 공식 소개 · 정확 추론 읽기 · HMM 읽기

Python · R · 원자료·단위·가공·출처

CS50 Uncertainty connects probability and conditioning to Bayes networks and HMMs. Use the in-page player and reproduce a selected calculation. UCLA’s official Judea Pearl profile lists knowledge representation and probabilistic/causal reasoning among his interests. We connect those interests to distinguishing probability tables from causal questions, without claiming that drawing a graph proves causality.

In Berkeley CS188 Exact Inference, follow joining factors that contain a hidden variable and then summing it out. Read the final qualification about the largest factor size. In the HMM reading compare its transition-first W₀→W₁ convention with this chapter’s first observation at t=0. Both conventions work; state when the initial distribution applies and keep the timeline consistent.

Official CS50 lecture · Official UCLA profile · Exact inference reading · HMM reading

Python · R · Inputs, units, transformations and sources

Python·R 코드 실행 방법Run the Python/R companions

자료 묶음을 풀고 코드와 실제데이터 폴더를 함께 두세요. 터미널에서 코드 파일이 있는 폴더로 이동해 아래 명령을 실행합니다. 코딩이 처음이라면 손계산과 웹 실습을 먼저 하고, 데이터 사이언스 입문에서 코드를 배운 뒤 돌아와도 됩니다.Extract the bundle, keeping the scripts beside the data folder. In a terminal, enter the script folder and run the commands below. Beginners can complete hand calculations and browser labs first, returning to code after studying introductory data science.

python ai04-reproduce.py
Rscript --vanilla --encoding=UTF-8 ai04-reproduce.R

결과 파일은 각 코드에 지정된 결과 폴더에 저장됩니다. CSV 원자료는 덮어쓰지 않습니다.Result files are saved in the result directory specified by each script; the input CSVs are not overwritten.

영상·학자·함께 읽기Videos, thinkers and guided reading

본문의 질문을 넓히는 선택 학습입니다. 영상을 보기 전 질문을 먼저 읽고, 자신의 답을 쓴 뒤 해설과 비교하세요. 자료의 언어·선수 지식은 각 항목에 표시했습니다.Optional extensions to the chapter. Read the question first, write your answer, then compare with the explanation. Language and prerequisites are indicated below.

관측을 받고 확률을 갱신하기Update probability after observing evidence

Harvard CS50 AI · Uncertainty

조건부확률·Bayes 망·Markov/HMM 구간을 보고 우산 스무 날 표와 연결합니다. 초기분포가 어느 시점인지 먼저 적으세요.Connect the conditional-probability,Bayes-network and Markov/HMM sections to the twenty-day umbrella table. State the timing of the initial distribution first.

교재 안의 YouTube 플레이어에서 재생합니다. 원영상에서 제공하는 자막은 플레이어의 CC·설정에서 선택할 수 있습니다.Playback stays in this chapter’s YouTube player. Available captions can be selected through CC/settings.

보고 읽은 뒤 답하기Respond after watching/reading P(우산|비)와P(비|우산)이 같은가요?Are P(umbrella|rain)and P(rain|umbrella)equal?

생각을 점검하는 해설Check your reasoning

조건이 남기는 집합과 분모가 달라 일반적으로 다릅니다. 이 예에서는3/4와3/7입니다.They generally differ because conditioning retains different sets. Our example gives 3/4 and 3/7.

Judea Pearl · 확률과 인과의 질문을 구분한다Judea Pearl · distinguish probabilistic and causal questions

UCLA Samueli · official profile

공식 소개의 지식 표현과 확률·인과 추론 연구 관심을 읽고 이 장의 관측 질의와 개입 질문을 비교하세요.Read the profile’s knowledge-representation and probabilistic/causal-reasoning interests,then contrast an observational query with an intervention question.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 연쇄법칙으로 그린 화살표가 실제 인과성을 증명하나요?Do arrows drawn from a chain-rule factorization prove causality?

생각을 점검하는 해설Check your reasoning

인수분해 순서만으로는 증명하지 않습니다. 개입 의미와 구조·식별 가정을 더 정당화해야 합니다.Factorization order alone does not. Intervention semantics and structural/identification assumptions need justification.

인수 결합·주변화·제거 순서Join,marginalize and choose an elimination order

UC Berkeley CS188 · Exact Inference

숨은 변수에 관련된 인수를 모아 곱하고 더하는 과정을 읽으세요. 최대 인수 크기에 따른 계산 이득의 조건도 확인합니다.Read how factors involving a hidden variable are joined and summed. Include the qualification about maximum factor size.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 변수 제거는 언제나 더 빠른가요?Is variable elimination always faster?

생각을 점검하는 해설Check your reasoning

구조와 순서가 큰 중간 인수를 만들 수 있습니다. 같은 답을 내는 것과 작은 계산량은 별도 주장입니다.Structure and order can create large intermediate factors. Exact-answer agreement and lower computation cost are separate claims.

전이 뒤 관측을 반영하는 forward 알고리즘Forward prediction and observation update

UC Berkeley CS188 · Hidden Markov Models

전이·관측 독립 가정과 두 단계 갱신을 읽습니다. 강의의W0→W1과 이 장의t0 첫 관측 관례를 나란히 적으세요.Read transition/emission assumptions and the two-step update. Compare the reading’s W0→W1 convention with our first observation at t0.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 전이표가 시간에 따라 같으면 상태 분포도 같은가요?Does a fixed transition table make state marginals constant?

생각을 점검하는 해설Check your reasoning

초기분포가 불변분포가 아닐 수 있습니다. 가정한 전이는 같아도 분포는 움직일 수 있습니다.The initial law need not be invariant. Marginals may change under a time-homogeneous transition.

연습문제 · 계산에서 설명과 증명까지Exercises: calculation, explanation and proof

먼저 혼자 풀고 풀이를 여세요. 숫자와 함께 단위·포함 기준·계산 이유를 확인하세요.Attempt each problem before opening its solution. Check units, inclusion rules and the reason for the calculation.

1. 우산 표의 분모Denominators in an umbrella table

가정한 스무 날 중 비·우산3, 비·우산없음1, 맑음·우산4, 맑음·우산없음12이다. 비와 우산의 결합확률, 우산 아래 비 확률, 비 아래 우산 확률을 각각 구하라.

Among twenty hypothetical days the rain/umbrella, rain/no-umbrella, dry/umbrella and dry/no-umbrella counts are 3,1,4,12. Find the joint probability and both directional conditionals.

풀이와 확인할 이유Solution and explanation

결합은 전체20일을 분모로 하여3/20이다. 우산이라는 조건은3+4=7일만 남기므로 비의 비중은3/7이다. 비라는 조건은3+1=4일만 남기므로 우산 비중은3/4이다. 분자가 같아도 남긴 집합이 다르므로 두 조건부확률은 다르다.

The joint probability is 3/20. Conditioning on umbrella retains 3+4=7 days, giving 3/7 rain. Conditioning on rain retains 3+1=4 days, giving 3/4 umbrella. The same numerator does not imply the same conditional because the retained sets differ.

2. 여사건도 같은 표에서Complements from the same table

앞 문제의 네 도수3,1,4,12를 사용한다. 우산이 없는 날의 비 확률과 비가 아닌 확률을 구하고 합을 확인하라.

Using counts 3,1,4,12 in the preceding order, find rain and not-rain probabilities conditional on no umbrella.

풀이와 확인할 이유Solution and explanation

우산 없는 날은1+12=13일이다. 비는1/13, 맑음은12/13이며 합은1이다. 전체 비 비중4/20을 여기 분모로 쓰면 조건에 따른 재정규화를 하지 않은 것이다.

There are 1+12=13 no-umbrella days. Rain has probability 1/13 and dry weather 12/13, summing to one. Reusing the unconditional rain share 4/20 would omit renormalization after conditioning.

3. 희귀 사건과 양성 신호A rare event and a positive signal

가정 집단에서 사건 비중1/100, 사건일 때 양성9/10, 사건 아닐 때 양성1/20이다. 양성 아래 사건 확률을 구하라. 실제 진단 성능을 뜻하는 문제는 아니다.

In a hypothetical population an event has probability 1/100, a positive signal has likelihood 9/10 under the event and 1/20 otherwise. Find the event posterior; these are not actual diagnostic claims.

풀이와 확인할 이유Solution and explanation

양성·사건 무게는9/1000이다. 양성·비사건은99/2000이므로 총117/2000이다. 따라서 (18/2000)/(117/2000)=2/13이다. 가능도9/10은 사건을 조건으로 한 값이지 양성을 조건으로 한 사후확률이 아니다.

The event-positive weight is 9/1000; the no-event-positive weight is 99/2000. Their sum is 117/2000, so the posterior is 18/117=2/13. Likelihood 9/10 conditions on the event and must not be mistaken for this posterior.

4. 같은 가능도비The same likelihood ratio

사전 사건 확률1/5이다. 한 신호의 두 가능도는3/10,1/10이고 다른 신호는9/10,3/10이다. 두 사후확률이 같은지 계산하라.

An event prior is 1/5. One signal has event/non-event likelihoods 3/10,1/10; another has 9/10,3/10. Compare their posteriors.

풀이와 확인할 이유Solution and explanation

첫 무게는3/50와4/50여서3/7이다. 둘째는9/50와12/50여서 역시3/7이다. 두 가능도가 공통 양수3배로 바뀌어도 정규화 후 비중은 같다. 다만 각 신호 자체의 주변확률7/50와21/50는 다르다.

First weights 3/50 and 4/50 normalize to 3/7; second weights 9/50 and 12/50 do likewise. A common positive scale cancels. The marginal signal probabilities 7/50 and 21/50 nevertheless differ.

5. 불가능 조건의 나눗셈Division under impossible evidence

유한 표에서 E에 해당하는 행의 무게가 모두0이다. P(A∩E)=0이면 P(A|E)를0,1/2,미정의 중 무엇으로 보고해야 하는가?

Every row satisfying E has zero weight. With P(A∩E)=0, should P(A|E) be zero, one-half or undefined?

풀이와 확인할 이유Solution and explanation

표준 비율 정의는0/0이므로 미정의이다. 0이나 균등1/2를 출력하면 자료와 모형이 정하지 않은 값을 보탠다. 추가 규약으로 정규조건부 버전을 고를 수 있는 별도 이론과 이 유한 관측 비율을 구별한다.

The finite conditional ratio is 0/0 and undefined. Zero or one-half would supply information absent from the model. Separate this finite observational ratio from other theories that may select versions of conditional kernels under additional conventions.

6. 주변확률에서 독립 검사Check independence from marginals

A,B가 이진이며 (0,0),(0,1),(1,0),(1,1)의 확률이3/10,2/10,1/10,4/10이다. A와 B는 독립인가?

For binary A,B the ordered joint probabilities are 3/10,2/10,1/10,4/10. Are they independent?

풀이와 확인할 이유Solution and explanation

P(A=0)=1/2, P(B=0)=2/5이다. 독립이면(0,0)셀은1/5이어야 하지만 실제3/10이다. 한 셀의 불일치만으로 독립이 아님을 보인다. 모든 셀이 곱과 같아야 독립이다.

P(A=0)=1/2 and P(B=0)=2/5. Independence would give 1/5 in cell(0,0), whereas the table gives 3/10. One counterexample disproves independence; establishing it requires every cell to factor.

7. CPT 행의 정확한 합Exact normalization of a CPT row

세 상태의 CPT 행을1/10,2/10,7/10으로 입력했다. 합과 마지막 상태의 비중을 구하라. 대신0.1,0.2,0.699를 입력하면 왜 거절되는가?

A three-state CPT row is 1/10,2/10,7/10. Check its sum. Why reject 0.1,0.2,0.699 instead?

풀이와 확인할 이유Solution and explanation

첫 행은10/10=1이고 마지막 비중7/10이다. 둘째 행의 정확한 십진 합은999/1000으로1이 아니다. 가까운 값이라는 이유로 몰래 나누어 정상화하면 입력한 모형이 달라진다. 계산용 일반 인수는 비정규화가 가능하지만 CPT 확률 행은 정규화가 필요하다.

The first row sums to one and its last share is 7/10. The decimal alternative sums exactly to 999/1000. Silently normalizing it would alter the supplied model. General computational factors may be unnormalized; a conditional probability row must be normalized.

8. 확률0인 부모 문맥A zero-probability parent context

A는 확률1로0이고 B의 부모는 A이다. A=1에서 B의 CPT 행을 채워야 하는가? 그 행이 관측으로 식별되는가?

A equals zero with probability one and is B’s parent. Must the A=1 CPT row be supplied? Is it identified by observations?

풀이와 확인할 이유Solution and explanation

완전한 이 실습 모형은 가능한 모든 부모 상태 행을 요구하므로 채운다. 그러나 P(A=1)=0이라 그 문맥의 경험 조건부는 정해지지 않는다. 어느 정규화 행을 넣어도 결합 무게P(A=1,B=b)는0이다. 계산 규약과 관측 식별을 분리한다.

This complete model requires a normalized row for every declared parent state. But the observational conditional at A=1 is unidentified because its context has zero mass. Any such row still yields zero joint mass there. Computational completion is separate from identification.

9. 두 노드의 역방향 조회Query a two-node network backwards

P(A=1)=1/4, P(B=1|A=1)=4/5, P(B=1|A=0)=1/5이다. P(B=1)과 P(A=1|B=1)을 구하라.

Let P(A=1)=1/4, P(B=1|A=1)=4/5 and P(B=1|A=0)=1/5. Find P(B=1) and P(A=1|B=1).

풀이와 확인할 이유Solution and explanation

B=1의 두 무게는1/5와3/20여서 합7/20이다. 그중 A=1 무게1/5를 나누면4/7이다. 그래프를 반대로 조회할 수 있으며 화살표를 뒤집어 같은 CPT 수치를 쓰는 연산은 아니다.

The B=1 weights are 1/5 and 3/20, totaling 7/20. Normalizing the A=1 weight gives 4/7. A network permits reverse-direction queries; that does not mean reversing arrows while retaining the same CPT numbers.

10. 부모 순서가 있는 행An ordered parent context

C의 부모 선언은[B,A]이고 주어진 행 given=["1","0"]이다. 어느 조건을 뜻하는가? 노드 목록이[A,B,C]이면 해석이 바뀌는가?

C declares parents[B,A], and one CPT row has given=["1","0"]. Which condition does it encode? Does node order[A,B,C] change it?

풀이와 확인할 이유Solution and explanation

B=1,A=0이다. 부모 문맥은 부모 선언 순서에 맞추므로 전체 노드 순서와 다를 수 있다. A=1,B=0으로 읽으면 다른 행의 확률을 곱한다. 각 부모의 이름과 값을 짝지어 확인해야 한다.

It means B=1,A=0. Parent-context coordinates follow the parent declaration, independently of the full node list. Reading A=1,B=0 would use another row. Check each parent-name/value pair explicitly.

11. 자유 모수의 수Count free parameters

세 이진 변수에 대해 완전 순서 DAG A→B,A→C,B→C와 사슬 A→B→C의 자유 CPT 모수 수를 구하라.

Count free CPT parameters for binary A,B,C under the complete ordered DAG A→B,A→C,B→C and under chain A→B→C.

풀이와 확인할 이유Solution and explanation

이진 정규화 행마다 하나가 자유다. 완전 DAG는1+2+4=7개, 사슬은1+2+2=5개이다. 사슬의 적은 모수는 C가 A에 추가 의존하지 않는 조건부 독립 제약과 연결된다. 숫자가 적다는 사실만으로 실제 자료에 적절한 구조라고 정해지지는 않는다.

Each normalized binary row contributes one parameter. The complete DAG uses 1+2+4=7; the chain uses 1+2+2=5. Fewer chain parameters reflect a conditional-independence restriction. A smaller count alone does not justify that restriction for actual records.

12. 연쇄법칙과 구조 가정Chain rule versus structural assumptions

모든 결합분포를 P(A)P(B|A)P(C|A,B)로 쓰는 것과 P(A)P(B|A)P(C|B)로 쓰는 것은 어떻게 다른가? 양의 문맥에서 설명하라.

How does the full chain rule P(A)P(B|A)P(C|A,B) differ from P(A)P(B|A)P(C|B)? Discuss positive contexts.

풀이와 확인할 이유Solution and explanation

첫 분해는 정한 순서의 연쇄법칙이다. 두 번째는 C의 조건부에서 A를 지워 C와 A가 B 아래 독립이라는 추가 제약을 둔다. 실제 표가 그 제약을 만족하지 않으면 두 번째 곱은 원래 결합표를 바꾼다. 확률0 문맥은 조건부 비율을 따로 정하지 못하므로 별도 규약을 표시한다.

The first is the chain rule for a chosen ordering. The second removes A from C’s conditional and adds C⊥A|B. If the observed table violates that restriction, the product changes its joint law. Zero-mass contexts require separately stated completion conventions.

13. 같은 표와 다른 개입The same table and different interventions

A=B인 두 이진 변수가(0,0),(1,1)에 각각1/2이다. 모형1은 A를 뽑고 B=A, 모형2는 B를 뽑고 A=B이다. 관측분포와 A를1로 강제한 뒤 B의 분포를 비교하라.

A=B with probability one and equal mass on(0,0),(1,1). Model 1 draws A then sets B=A; model 2 draws B then sets A=B. Compare observation and intervention setting A=1.

풀이와 확인할 이유Solution and explanation

관측 표는 같다. 모형1에서 A를1로 바꾸면 B도1이다. 모형2에서 B의 추첨은 그대로라 B는1/2씩이다. 같은 관측 확률망 적합만으로 개입 효과의 방향을 정하지 못한다. 구조 방정식과 개입 의미를 추가로 정해야 한다.

The observational tables agree. In model 1 forcing A=1 forces B=1. In model 2 B’s original fair draw remains. Thus observational fitting alone does not identify this intervention. Structural equations and intervention semantics are additional information.

14. 빈 확률망An empty network

노드가0개인 확률망에서 결합 배정 수와 빈 증거의 확률을 구하라. 관측 상태가 하나 있다는 뜻인가?

How many joint assignments does a zero-node network have, and what is empty-evidence probability? Does that observe one state?

풀이와 확인할 이유Solution and explanation

값을 쓸 칸이 없는 빈 배정 하나가 있다. 빈 곱은1이므로 질량1이고 빈 증거도1이다. 변수나 관측 상태를 새로 만든 것이 아니라 곱셈·조합의 항등원 규약이다. 질의도 빈 목록이면 확률1의 빈 좌표 한 행이 나온다.

There is one empty assignment. Its empty product has mass one, as does empty evidence. This creates no observed variable or state; it is the multiplicative and combinatorial identity. An empty query has one empty-coordinate row of probability one.

15. 질의 변수가 이미 관측되면Query an observed variable

P(A=1)>0인 모형에서 증거 A=1을 주고 A 자체를 질의한다. 두 상태의 사후확률은? P(A=1)=0일 때와 비교하라.

With P(A=1)>0, supply evidence A=1 and query A itself. What are its two posterior probabilities? Compare a zero-probability A=1 event.

풀이와 확인할 이유Solution and explanation

양의 증거이면 A=0은0, A=1은1인 퇴화 분포다. 증거와 모순된 질의 행은0이다. 반면 증거 확률이0이면 두 행 모두 조건부 미정의이며, 같은 좌표라는 이유로1을 줄 수 없다.

For positive evidence the posterior is zero at A=0 and one at A=1. Incompatible query rows have zero weight. With impossible evidence both conditionals are undefined; matching the supplied label does not rescue a zero denominator.

16. 표시0과 정확한 양수Displayed zero and exact positive mass

정확한 두 가설 무게가 각각10의−400승이다. 화면 binary64가0을 표시하더라도 정규화한 두 사후확률은 얼마인가?

Two exact hypothesis weights are both 10 to the power−400. What are their normalized probabilities even if binary 64 displays each as zero?

풀이와 확인할 이유Solution and explanation

총 무게는2×10의−400승으로 수학적으로 양수다. 각 비중은1/2이다. 표시값으로 먼저0+0을 만들면 잘못 미정의라고 판단한다. 정확분수와 displayUnderflow 표지를 유지한 뒤 나누어야 한다.

Their total is the mathematically positive 2×10⁻⁴⁰⁰, so each posterior is one-half. Summing already rounded display zeros would incorrectly report an undefined result. Preserve exact fractions and underflow metadata until after normalization.

17. 중복 CPT 행Duplicate CPT rows

부모 A의 상태가0,1인데 B의 CPT에 given=[0]인 행을 두 번 쓰고[1]은 빠뜨렸다. 각 행의 합이1이면 받아들여도 되는가?

A has states 0,1, but B’s CPT supplies context 0 twice and omits context 1. If every row sums to one, should it be accepted?

풀이와 확인할 이유Solution and explanation

아니다. 행 정규화와 부모 문맥의 정확한 덮기는 별도 조건이다. 중복을 덮어쓰면 빠진 문맥을 숨기고 선언한 모형을 바꾼다. A=1의 주변질량이0이어도 완전 CPT 계약에서는 모든 선언 문맥을 요구한다.

No. Row normalization and complete unique parent-context coverage are separate requirements. Overwriting duplicates hides missing contexts and changes the declared model. The complete-CPT contract requires every declared context even if A=1 has zero marginal mass.

18. 한 결합 행의 곱Multiply one joint row

사슬 A→B→C에서 P(A=1)=1/5, P(B=1|A=1)=3/4, P(C=1|B=1)=1/2이다. 세 변수가 모두1인 결합확률을 구하라.

In chain A→B→C let P(A=1)=1/5, P(B=1|A=1)=3/4 and P(C=1|B=1)=1/2. Find the all-one joint probability.

풀이와 확인할 이유Solution and explanation

선택한 한 행에서는(1/5)(3/4)(1/2)=3/40이다. C=1의 주변확률은 다른 A,B 행들도 더해야 하므로 이 한 곱과 다르다. 모든 결합 행의 곱을 더하면 정규화된 CPT 모형의 전체 질량1을 확인할 수 있다.

For this row multiply(1/5)(3/4)(1/2)=3/40. The marginal probability of C=1 additionally sums other A,B configurations. Summing every joint-row product checks total mass one in the normalized network.

19. 국가 무게와 인구 무게Country weights and population weights

선택16국 중 high GDP 국가가9개다. 같은 확률로 국가를 뽑는 실험의 high 확률을 구하라. 이를 세계 인구 중 high 국가 거주자의 비중이라고 불러도 되는가?

Nine of sixteen retained countries have high GDP. Find the high probability under uniform country sampling. Is it the share of the world population living in those countries?

풀이와 확인할 이유Solution and explanation

이 실험에서는9/16이다. 인구 비중은 각국 인구를 무게로 사용하고 대상 국가 범위도 정해야 한다. 같은 자료표라도 추출 단위와 가중 방식이 달라지면 다른 확률 질문이다. 선택되지 않은 나라까지 일반화하는 근거도 별도다.

The specified probability is 9/16. A population share would require country populations as weights and a defined target-country frame. Sampling units and weights change the estimand even with the same table. Extending to unretained countries also requires justification.

20. 확률 인수와 확률 행Probability factors and CPT rows

증거를 반영한 두 가설의 비정규화 인수가3과2이다. 이를 조건부확률 행처럼 합1이 아니라고 거절해야 하는가? 사후비중은?

Two evidence-weighted hypothesis factors are 3 and 2. Must they be rejected for not summing to one like a CPT row? Find normalized shares.

풀이와 확인할 이유Solution and explanation

일반 인수의 두 값은 아직 확률 행이 아니므로 합5이어도 된다. 전체 합이 양수5라 정규화하면3/5와2/5이다. 어떤 객체가 CPT이고 어떤 객체가 곱셈·덧셈 중간 인수인지 구분해야 한다.

General intermediate factors need not sum to one; these sum to five. Normalizing by the positive total yields 3/5 and 2/5. Distinguish a CPT probability row from a computational factor produced during multiplication and summation.

21. 사슬의 숨은 변수 합Sum a hidden chain variable

A→B→C에서 P(A=1)=1/5, P(B=1|A=1)=3/4, P(B=1|A=0)=1/4, P(C=1|B=1)=3/4, P(C=1|B=0)=1/4이다. P(A=1|C=1)을 구하라.

In chain A→B→C take prior A=1 of 1/5, B=1 likelihoods 3/4 and 1/4 under A=1 and 0, and C=1 likelihoods 3/4 and 1/4 under B=1 and 0. Find P(A=1|C=1).

풀이와 확인할 이유Solution and explanation

A=1 아래 C=1은(3/4)(3/4)+(1/4)(1/4)=5/8이다. A=0에서는3/8이다. 사전무게를 곱하면1/8과3/10, 합17/40이다. 따라서(1/8)/(17/40)=5/17이다. 숨은 B를 더한 뒤 증거에 맞춰 다시 나눈다.

Summing hidden B gives C=1 likelihood 5/8 under A=1 and 3/8 under A=0. Multiply by prior masses to obtain 1/8 and 3/10, total 17/40. Normalization yields 5/17. Hidden-variable summation precedes evidence normalization.

22. 제거 뒤 남는 인수The factor remaining after elimination

앞 문제의 사슬에서 B를 먼저 제거하면 A의 두 상태에 남는 인수 g(A)=Σ_b P(b|A)P(C=1|b)는 얼마인가? 이것만 사후분포인가?

For the preceding chain eliminate B to form g(A)=Σ_b P(b|A)P(C=1|b). What are its two values, and is g already a posterior?

풀이와 확인할 이유Solution and explanation

g(1)=5/8, g(0)=3/8이다. 이 둘은 서로 다른 A 아래 증거의 가능도다. P(A)를 아직 곱하지 않았으므로 사후가 아니다. 사전1/5,4/5를 곱하고 합17/40으로 나누어 앞의5/17,12/17을 얻는다.

The likelihood factor gives g(1)=5/8 and g(0)=3/8. These are evidence likelihoods under different A values, not the posterior. Multiply prior 1/5,4/5 and normalize by 17/40 to obtain 5/17 and 12/17.

23. 올바른 제거 순서 목록A valid elimination-order list

노드는 A,B,C,D, 질의는 A, 증거는 D=1이다. hidden 변수의 명시적 제거 순서로[B,C], [C,B], [A,B,C], [B] 중 허용되는 것을 고르라.

Nodes are A,B,C,D, query A and evidence D=1. Which explicit elimination orders are valid: [B,C], [C,B], [A,B,C], [B]?

풀이와 확인할 이유Solution and explanation

숨은 변수는 B,C이므로 앞의 두 순서가 허용된다. 질의 A를 지우거나 C를 빠뜨리는 나머지는 거절된다. 모든 숨은 변수를 한 번씩 제거해야 같은 질의표를 남긴다. 관측 D는 먼저 증거 값으로 제한하므로 목록에 넣지 않는다.

Hidden variables are B,C, so the first two orders are valid. Eliminating query A or omitting C is invalid. Every hidden variable must appear once to leave the intended query table. Evidence D is restricted to its observed value before elimination.

24. 긴 사슬의 작은 인수Small factors in a long chain

다섯 이진 변수 A→B→C→D→E에서 A만 질의하고 증거는 없다. E,D,C,B 순으로 제거하면 최대 결합 인수의 셀 수를 전체 결합표32셀과 비교하라.

For binary chain A→B→C→D→E query A without evidence. Compare largest joined factor size under order E,D,C,B with the 32-cell joint table.

풀이와 확인할 이유Solution and explanation

E를 지울 때 P(E|D)는 D,E 두 변수4셀이다. 더한 뒤 D만 남고, 다음에는 C,D 두 변수4셀을 결합한다. 같은 과정이 이어져 최대4셀이다. 전체32행을 만들지 않아도 같은 주변분포를 얻는다. 단, 모든 그래프가 이런 사슬 구조인 것은 아니다.

Eliminating E starts with a four-cell D,E factor and leaves only D. The next join involves C,D and again four cells. Continuing keeps the maximum at four instead of 32. This benefit follows from the chain structure; arbitrary graphs need not share it.

25. 나쁜 순서의 큰 인수A large factor from a poor order

A가 세 이진 자녀 B,C,D의 부모이며 자녀마다 CPT P(child|A)가 있다. 결합표에는16셀이 있다. A를 먼저 제거할 때와 B,C,D를 먼저 제거할 때 최대 인수 크기는?

Binary A is parent of binary B,C,D with separate child CPTs. Compare the largest factor under eliminating A first versus eliminating all children first; the full joint has 16 cells.

풀이와 확인할 이유Solution and explanation

A를 먼저 지우려면 P(A)와 세 자녀 인수를 모두 곱해 A,B,C,D의16셀을 만들고 합한다. 자녀를 하나씩 먼저 지우면 각각 A와 그 자녀의4셀만 필요하다. 이 예는 제거 순서가 최대 인수 크기와 연산량을 바꾼다는 것을 보이며 답의 확률을 바꾸지는 않는다.

Eliminating A first joins all factors into a16-cell A,B,C,D table. Removing each child first needs only its four-cell A,child factor. Elimination order changes intermediate size and work here, while the final exact probability is unchanged.

26. 인수 곱의 좌표 맞추기Align coordinates when joining factors

f(A=0)=1/5,f(A=1)=4/5이고 g(B=1|A=0)=1/4,g(B=1|A=1)=3/4이다. B=1을 관측한 두 A 무게와 정규화 비중을 구하라.

Take f(A=0)=1/5,f(A=1)=4/5 and B=1 likelihoods 1/4,3/4 under A=0,1. Compute the two weights and posterior.

풀이와 확인할 이유Solution and explanation

같은 A좌표끼리 곱해1/20와3/5=12/20을 얻는다. 합13/20으로 나누면1/13와12/13이다. 행 순서를 따로 뒤집은 표의 같은 위치끼리 곱하면 다른 결과가 되므로 상태 이름을 기준으로 결합한다.

Match A states to get 1/20 and 3/5=12/20. Normalizing by 13/20 yields 1/13 and 12/13. Joining by unrelated physical row positions instead of state labels could multiply mismatched coordinates.

27. 증거 제한 뒤 모두0All zeros after restricting evidence

관측 E=e로 CPT와 인수를 제한한 뒤 최종 질의 인수의 모든 값이0이다. 변수 제거가 끝났으므로 균등 분포를 반환해도 되는가?

After restricting evidence E=e, every final query-factor entry is zero. May completed variable elimination return a uniform posterior?

풀이와 확인할 이유Solution and explanation

안 된다. 제거 계산이 끝났다는 것은 이 모형의 증거 질량0을 계산했다는 뜻이다. 정규화 분모0으로 사후는 미정의다. 실패 없이 계산한 불가능성과 연산 예산 때문에 계산하지 못한 경우도 구별해 보고해야 한다.

No. Completed elimination has established zero evidence mass under this model. Its posterior is undefined. Distinguish a successfully computed impossible event from an atomic failure to finish within the computation budget.

28. 추적 기록 한도와 답Trace storage versus the answer

같은 망·질의·증거에서 maxTrace를64에서0으로 바꾼다. 제거의 숨은 변수나 계산 예산은 바꾸지 않았다. 사후확률과 보이는 추적 목록은 어떻게 되어야 하는가?

Change maxTrace from 64 to zero while leaving network, query, evidence and work budget fixed. What happens to the answer and displayed trace?

풀이와 확인할 이유Solution and explanation

추적 저장만 하지 않으므로 보이는 목록은 빈다. 실제 계산이 같은 조건에서 완료되면 사후와 증거확률은 같아야 한다. 저장할 줄 수와 수행할 연산 수를 혼동하여0개 추적을0번 계산으로 해석하지 않는다.

The stored trace becomes empty, but the completed calculation retains the same posterior and evidence mass. A display-storage limit is not a computation limit. Zero trace rows must not be interpreted as zero inference work.

29. 사슬에서 중간 변수 조건Conditioning on a chain middle

A→B→C로 인수분해되는 유한 분포에서 P(B=b)>0이다. 왜 A와 C가 B=b 아래 독립인지 식으로 설명하라.

For a finite law factorizing over A→B→C and a positive-mass B=b, explain why A and C are independent given B=b.

풀이와 확인할 이유Solution and explanation

P(a,b,c)=P(a)P(b|a)P(c|b)이다. b를 고정하고 P(b)로 나누면 P(a|b)P(c|b)가 된다. 따라서 같은 양의 b문맥에서 결합 조건부가 두 주변 조건부의 곱이다. P(b)=0인 문맥에는 이 비율 증명이 적용되지 않는다.

Divide P(a)P(b|a)P(c|b) by positive P(b) to get P(a|b)P(c|b). The conditional joint therefore factors in each positive b context. The ratio proof does not define conditionals when P(b)=0.

30. 공통 부모를 조건으로Condition on a common parent

B→A,B→C의 분포 P(B)P(A|B)P(C|B)를 생각한다. B를 모를 때와 알 때 A,C 독립은 어떻게 다른가?

Consider fork B→A,B→C with law P(B)P(A|B)P(C|B). Compare A,C independence before and after conditioning on B.

풀이와 확인할 이유Solution and explanation

양의 B문맥에서는 CPT두 개의 곱이라 독립이다. B를 더해 없애면 서로 다른 공통 원인 상태가 섞여 일반적으로 독립이 아닐 수 있다. 예를 들어 A=B,C=B와 공정 B이면 A=C가 항상 성립해 주변에서는 의존한다.

Within a positive B context the two CPTs multiply, giving independence. Summing B mixes common-parent states and may create marginal dependence. For example, A=B and C=B with fair B makes A=C always, so the marginal variables are dependent.

31. 충돌 변수의 선택Selecting a collider

독립 공정 이진 A,B에서 C는 OR(A,B)이다. C=1 아래 P(A=1),P(B=1),P(A=1,B=1)을 구하여 독립을 검사하라.

Independent fair binary A,B feed C=OR(A,B). Find both marginals and the joint all-one probability given C=1, then test independence.

풀이와 확인할 이유Solution and explanation

C=1에 남는(0,1),(1,0),(1,1)은 각각1/3이다. 두 주변은2/3, 결합은1/3이다. 주변 곱4/9와 다르므로 조건 뒤 의존한다. 원래 독립이었다는 사실이 공통 결과를 선택한 뒤의 독립을 보장하지 않는다.

The retained(0,1),(1,0),(1,1) rows each have probability 1/3. Both marginals are 2/3, but the joint is 1/3 rather than 4/9. Conditioning on a shared effect has created dependence despite original independence.

32. 퇴화 문맥의 우연한 독립Accidental independence in a degenerate context

앞 OR모형에서 C=0이면 A,B는 어떤 값을 갖는가? 이 문맥의 독립을 C를 조건으로 한 모든 양의 문맥의 독립과 동일시해도 되는가?

In the OR model what happens when C=0? Does independence in that context establish conditional independence across every positive C context?

풀이와 확인할 이유Solution and explanation

C=0이면 둘 다0으로 고정되어 그 문맥에서는 퇴화 독립이다. 그러나 C=1 문맥은 앞 문제에서 의존했다. 일반적인 A⊥B|C는 모든 양의 C문맥을 검사해야 하므로 성립하지 않는다. 특정 관측값에서의 성질과 변수집합 조건부 독립을 구별한다.

Both are forced to zero, so that specific context is degenerately independent. The positive C=1 context remains dependent. General A⊥B|C requires independence in all positive C contexts and therefore fails here. Distinguish context-specific from variable-level conditional independence.

33. XOR 충돌 변수An XOR collider

A,B는 독립 공정 이진이고 C는 A와 B가 다를 때1이다. C=0과 C=1에서 A,B의 관계를 설명하라.

A,B are independent fair binary variables and C=1 exactly when they differ. Describe their relationship under C=0 and C=1.

풀이와 확인할 이유Solution and explanation

C=0에서는(0,0),(1,1)이 각각1/2이므로 같고, C=1에서는(0,1),(1,0)이 각각1/2이므로 반대다. 두 문맥 모두 주변은1/2이지만 결합 셀은0 또는1/2로 주변 곱1/4와 다르다. 두 양의 문맥에서 모두 조건부 의존한다.

C=0 retains equal pairs with mass 1/2 each; C=1 retains unequal pairs with mass 1/2 each. Marginals stay one-half, but cells are zero or one-half instead of one-quarter. Both positive contexts exhibit dependence.

34. 열린 경로가 의존을 증명하나Does an open path prove dependence?

그래프에 A→B 화살표가 있지만 B의 CPT가 A=0과1에서 모두(1/2,1/2)이다. A가 공정이면 그래프적 d-separation과 분포 독립은?

Graph A→B has identical B CPT rows(1/2,1/2) under A=0 and 1, with fair A. Compare graph separation and numerical independence.

풀이와 확인할 이유Solution and explanation

두 노드는 직접 연결되어 d-separated가 아니다. 그러나 네 결합 셀은1/4씩이라 실제 이 모형의 분포에서는 독립이다. d-separation은 인수분해하는 모든 분포에 대한 독립 보장이고, 연결 경로만으로 특정 모수에서의 의존을 보장하지 않는다.

The adjacent nodes are not d-separated. Yet their four joint cells are all one-quarter, giving numerical independence. D-separation guarantees independence across all factorizing laws; a connecting path does not prove dependence for every parameter choice.

35. 모수 상쇄의 예An example of parameter cancellation

공정 A에서 B=A로 두고 C=XOR(A,B)로 정의한다. 그래프에는 A→B,A→C,B→C가 있다. A,C의 관측 독립과 직접 화살표를 비교하라.

Let fair A generate B=A and define C=XOR(A,B), with graph edges A→B,A→C,B→C. Compare the direct edge with observed A,C independence.

풀이와 확인할 이유Solution and explanation

A와 B가 항상 같아 C는 항상0이다. 상수 C는 A와 독립이지만 그래프에는 직접 경로가 있다. 이 모형은 그래프와 분포의 독립이 정확히 일치한다는 faithfulness 가정을 만족하지 않는다. 그래프를 읽는 규칙과 특정 CPT의 계산을 분리해야 한다.

Because A=B, C is constantly zero and independent of A despite the direct edge. This violates faithfulness, the additional assumption aligning graphical and distributional independences. Graphical rules and a particular CPT calculation answer different questions.

36. 확률0 문맥의 독립 검사Independence in zero-mass contexts

조건 변수 G는 확률1로0이다. G=1에서 A,B의 조건부표가 관측 비율로 정해지지 않는다. 유한 분포의 A⊥B|G 검사에서 G=1을 어떻게 다루는가?

G equals zero with probability one. The conditional A,B table at G=1 is not defined by observed ratios. How is this context handled when checking finite-law A⊥B|G?

풀이와 확인할 이유Solution and explanation

양의 질량 문맥G=0에서 곱 항등식을 검사하고 G=1은0문맥으로 따로 세어 건너뛴다. 미정의 조건부를 임의로 만든 뒤 그 표의 독립을 데이터가 입증했다고 말하지 않는다. 같은 결합분포를 표현하는0문맥 CPT의 선택과도 구별한다.

Check the factorization identity at positive-mass G=0 and separately count/skip zero-mass G=1. Do not invent its conditional table and claim data established independence there. A computational zero-context CPT completion is a separate convention.

37. 충돌 변수의 후손 조건Conditioning on a collider descendant

A→C←B,C→D의 그래프에서 A,B는 주변에서 d-separated인가? D를 조건으로 주면 어느 경로가 열리는가?

In graph A→C←B,C→D, are A and B marginally d-separated? Which path becomes active after conditioning on D?

풀이와 확인할 이유Solution and explanation

아무 조건이 없으면 A–C–B의 중간C가 충돌 변수라 막힌다. C의 후손D를 조건으로 주면 이 충돌 경로가 열릴 수 있어 d-separation 보장이 사라진다. 특정 CPT가 우연히 독립을 줄 가능성은 남으므로 그래프 연결과 수치 의존을 다시 구별한다.

Without conditioning, collider C blocks A–C–B. Conditioning on descendant D activates that collider path, removing the d-separation guarantee. Particular CPTs may still produce accidental independence, so connectivity remains distinct from numerical dependence.

38. 서로 겹치지 않는 질의 집합Disjoint independence-query sets

이 실습의 independence API는 left,right,given을 서로 겹치지 않게 요구한다. left=[A],given=[A]를 거절하는 것이 A⊥B|A라는 수학적 표현 자체가 무의미하다는 뜻인가?

The lab independence API requires disjoint left,right,given sets. Does rejecting left=[A],given=[A] mean the mathematical expression A⊥B|A is inherently meaningless?

풀이와 확인할 이유Solution and explanation

아니다. 이는 혼동 없는 그래프 질의를 위한 이 프로그램의 명시적 입력 범위다. 수학적으로는 조건에 이미 들어 있는 변수가 퇴화하여 자명한 조건부 독립을 줄 수 있다. 프로그램 계약의 제한을 확률 이론 전체의 금지 규칙으로 확대하지 않는다.

No. This is an explicit interface restriction for unambiguous graph queries. Mathematically a conditioned variable may be degenerate and yield a trivial conditional independence. An API contract is not a universal prohibition in probability theory.

39. 조건 조회와 조작Conditioning versus changing a mechanism

관측 그래프 A→B에서 P(B|A=a)를 계산했다. 이 숫자를 곧바로 A를 강제로a로 바꾼 정책의 효과라고 부르려면 무엇이 더 필요한가?

After querying P(B|A=a) in an observational graph A→B, what else is needed to interpret it as an effect of forcing A=a?

풀이와 확인할 이유Solution and explanation

화살표가 실제 인과 구조인지, 교란·선택·측정과 개입이 어떤 구조 방정식을 바꾸는지에 대한 실질 가정이 필요하다. 단순한 연쇄법칙 그래프는 인과성을 담지 않을 수 있다. 개입분포와 관측 조건부분포가 같아지는 식별 조건을 별도로 논증한다.

Substantive assumptions must justify causal structure, confounding/selection/measurement and which mechanism the intervention changes. A chain-rule graph need not be causal. Separately establish identification conditions equating an intervention distribution with the observational conditional.

40. 계산 방법을 바꿀 때의 불변량Invariants when changing the algorithm

고정 망·증거·질의에 enumeration과 두 가지 올바른 elimination 순서를 사용했다. 어떤 값은 같고 어떤 값은 달라도 되는가?

Use enumeration and two valid elimination orders for the same network, evidence and query. Which outputs must agree, and which may differ?

풀이와 확인할 이유Solution and explanation

정확한 증거 질량과 모든 질의 행의 비정규화 무게·사후확률은 같아야 한다. 중간 인수의 범위·최대 셀 수·연산 수·추적 순서는 달라도 된다. 서로 다른 수치가 나오면 먼저 변수·증거·구조가 같은지 확인하고, 같다면 계산 오류를 조사한다.

Exact evidence mass and every query-row unnormalized weight/posterior must agree. Intermediate scopes, maximum factor size, work counts and trace order may differ. If probabilities differ, first confirm identical structures and inputs; otherwise investigate a computational error.

41. 한 단계 상태 예측One-step state prediction

비·맑음 순서의 전이표가[(3/4,1/4),(1/4,3/4)]이고 초기 비 확률1/5이다. 관측 없이 한 번 전이한 비 확률은?

Rain,dry transitions are[(3/4,1/4),(1/4,3/4)] and initial rain probability is 1/5. Predict rain after one transition without observations.

풀이와 확인할 이유Solution and explanation

이전 비에서 오는 무게는3/20, 맑음에서 오는 무게는(4/5)(1/4)=1/5이다. 합7/20이다. 또는 q다음=1/4+q/2에1/5를 대입한다. 전이 행이 같게 유지되어도 상태 분포가 초기1/5에 머무르는 것은 아니다.

Incoming rain mass is 3/20 from rain and 1/5 from dry, totaling 7/20. Equivalently use q_next=1/4+q/2. Fixed transition rows do not keep the state distribution at its initial 1/5.

42. 시점0의 첫 관측The first observation at time zero

관측 전 비 확률1/5, 비 아래 우산 가능도3/4, 맑음 아래1/4이다. 첫 시점0에 우산을 보면 상태 분포는? 먼저 전이를 해야 하는가?

Before time-zero observation rain has probability 1/5 and umbrella likelihoods are 3/4 under rain and 1/4 under dry. Find the update. Must a transition precede it?

풀이와 확인할 이유Solution and explanation

비 무게3/20, 맑음 무게4/20이고 합7/20이다. 정규화하면(3/7,4/7)이다. 이 장은 초기분포가 첫 관측 직전이라고 명시하므로 추가 전이를 먼저 하지 않는다. 다른 관례를 쓰려면 초기분포의 시점을 함께 바꿔야 한다.

Weights 3/20 and 4/20 sum to 7/20, giving (3/7,4/7). Here the prior is explicitly just before observation zero, so no extra transition comes first. Another convention is possible if the prior’s timing changes consistently.

43. 필터링 다음 예측Prediction after filtering

첫 필터링이(3/7,4/7)이고 전이표는 앞의3/4·1/4이다. 다음 관측을 보기 전 비 비중을 구하라.

Filtering is(3/7,4/7) and the transition rows use 3/4,1/4 as above. Predict rain before the next observation.

풀이와 확인할 이유Solution and explanation

비에서 비로(3/7)(3/4)=9/28, 맑음에서 비로(4/7)(1/4)=4/28이므로13/28이다. 맑음은15/28이다. 이것은 새 관측을 아직 반영하지 않은 예측이며 직전 필터링3/7과 다를 수 있다.

Rain contributions 9/28 and 4/28 sum to 13/28; dry has 15/28. This prediction has not incorporated the next observation and need not equal the preceding filtered rain share 3/7.

44. 두 번째 관측과 전체 가능도Second update and full likelihood

다음 비 예측13/28, 맑음15/28에서 우산 없음 가능도는 각각1/4,3/4이다. 두 번째 필터링과 [우산,없음]의 전체 가능도를 구하라. 첫 우산 가능도는7/20이다.

Predicted rain,dry shares are 13/28,15/28; no-umbrella likelihoods are 1/4,3/4. Find second filtering and full likelihood, given first-umbrella likelihood 7/20.

풀이와 확인할 이유Solution and explanation

관측 무게는13/112와45/112, 합29/56이다. 필터링은(13/58,45/58)이다. 전체 관측 가능도는(7/20)(29/56)=29/160이다. 조건부 두 번째 가능도29/56를 전체 가능도라고 부르지 않는다.

Weights 13/112 and 45/112 sum to 29/56, yielding filtering (13/58,45/58). Full-sequence likelihood is(7/20)(29/56)=29/160. The second observation’s conditional likelihood 29/56 is not the full likelihood.

45. 첫 시점의 스무딩Smoothing the first time

첫 우산 뒤 비·맑음의 비정규화 무게는3/20,4/20이다. 다음 우산 없음 가능도가 첫 비 아래3/8, 첫 맑음 아래5/8이다. 전체 두 관측을 쓴 첫 상태 사후를 구하라.

First-observation unnormalized rain,dry weights are 3/20,4/20. The later no-umbrella likelihoods given first rain,dry are 3/8,5/8. Smooth the first state using both observations.

풀이와 확인할 이유Solution and explanation

곱하면9/160와20/160이다. 합29/160로 나누면(9/29,20/29)이다. 첫 필터링(3/7,4/7)은 뒤 정보를 쓰지 않았으므로 달라도 된다. 스무딩은 과거를 변경하는 연산이 아니라 더 많은 정보로 과거 상태를 다시 추론하는 연산이다.

Multiplication gives 9/160 and 20/160, normalizing to(9/29,20/29). Earlier filtering (3/7,4/7) used less evidence. Smoothing revises beliefs about the past; it does not change the past state.

46. 가장 무거운 전체 경로The heaviest complete path

[우산,없음]의 두 시점 HMM에서 비비·비맑음·맑음비·맑음맑음 경로 무게가 각각9,9,4,36을320으로 나눈 값이다. MAP 경로와 그 사후확률을 구하라.

For the two-observation HMM the rain-rain, rain-dry, dry-rain and dry-dry path masses are 9,9,4,36 divided by 320. Find the path MAP and its posterior probability.

풀이와 확인할 이유Solution and explanation

가장 큰36/320의 맑음→맑음이다. 전체 무게58/320로 나누면36/58=18/29이다. 나머지 경로를 더한 전체 가능도는29/160이다. 최대 경로의 결합 무게와 조건부 경로 비중은 서로 다른 숫자다.

Dry–dry maximizes joint mass 36/320. Dividing by total 58/320 gives posterior 18/29. The full likelihood is 29/160. A maximum path’s joint weight and its conditional posterior are different quantities.

47. 관측 누락의 무게1Likelihood one for a missing observation

초기(1/5,4/5), 앞 전이표에서 첫 관측이null이고 둘째가 우산 없음이다. 첫 필터링과 두 번째 필터링을 구하라.

Use prior(1/5,4/5) and the same transitions. Observation zero is null, observation one is no umbrella. Find both filtered distributions.

풀이와 확인할 이유Solution and explanation

null은 가능도1이라 첫 필터링은초기(1/5,4/5) 그대로다. 다음 예측은(7/20,13/20), 관측 무게는(7/80,39/80)이다. 합23/40으로 나누면(7/46,39/46)이다. 누락이라고 분포를균등하게 초기화하지 않는다.

Null has likelihood one, leaving first filtering at(1/5,4/5). Next prediction is(7/20,13/20); multiplying no-umbrella likelihoods gives(7/80,39/80). Normalize to(7/46,39/46). Missingness does not reset the prior to uniform.

48. 시간 길이0A zero-length sequence

유효한 초기·전이·관측표가 있지만 observations=[]이다. 가능도, MAP 경로, 동률 경로 수와 시간별 결과를 설명하라.

Valid initial, transition and emission tables are supplied, but observations=[]. Describe likelihood, MAP path, tie count and time-step results.

풀이와 확인할 이유Solution and explanation

빈 관측 사건의 가능도는1이다. 유일한 빈 잠재 경로[]의 결합·조건부 무게는1이고 동률 수는1이다. 시간별 prediction/filtering/smoothing 행은 없다. 특정 숨은 상태를 관측했다는 해석을 보태지 않는다.

The empty observation event has likelihood one. Its unique empty latent path[] has joint and conditional mass one and tie count one. There are no time-step prediction/filtering/smoothing rows. No particular hidden state has been observed.

49. 나중 불가능성과 앞의 정보Later impossibility and earlier information

초기 상태 a가 확률 1이고 전이는 상태 고정이다. a는 x만, b는 y만 방출한다. 관측 [x,y]에서 첫 필터링과 전체 스무딩·MAP은?

Initial state is certainly a and transitions preserve state. State a emits only x and b only y. For observations[x,y], what are first filtering, full smoothing and MAP?

풀이와 확인할 이유Solution and explanation

첫 x의 가능도 1이므로 첫 필터링은 a에 1이다. 다음 y는 가능도 0이라 전체 사건은 불가능하다. 전체 불가능 사건을 조건으로 한 모든 시점의 스무딩과 MAP 사후는 미정의다. 그러나 첫 관측만 조건으로 한 앞의 필터링은 유효하다.

The first x has likelihood one, so first filtering places mass one on a. The later y makes full likelihood zero. All smoothing and MAP posteriors conditional on that impossible full sequence are undefined, while filtering from the earlier valid prefix remains valid.

50. 전체 경로 동률Ties among complete paths

두 상태의 초기·전이·각 관측 가능도가 모두 1/2이고 관측 3개를 받았다. 가능한 경로 8개의 무게, 전체 가능도, MAP 동률 수와 대표를 구하라. 상태 선언 순서는 a,b이다.

Two states have uniform initial, transition and emission probabilities 1/2. For three observations find all eight path masses, likelihood, MAP tie count and representative under state order a,b.

풀이와 확인할 이유Solution and explanation

경로마다 초기 1개·전이 2개·방출 3개를 곱해 (1/2)^6=1/64이다. 합 8/64=1/8이고 모든 8경로가 동률이다. 사전식 대표 aaa를 보이되 그 조건부확률은 1/8이다. 대표 하나를 출력했다고 유일한 최적 경로라는 뜻은 아니다.

Each path multiplies one initial, two transition and three emission factors, giving 1/64. Their sum is 1/8 and all eight paths tie. Lexicographic representative aaa has conditional probability 1/8. Displaying one representative does not establish a unique maximizer.

51. 주변 최빈값을 이어 붙이면Concatenating marginal modes

초기 a,b는 각 1/2, 전이는 a→b,b→a가 확률 1이고 관측 2개는 모두 null이다. 각 시점의 최빈 상태 집합과 전체 가능 경로를 구하라. 각 시점에서 a를 선택해 aa를 만들어도 되는가?

Initial a,b each have mass 1/2; transitions deterministically alternate and two observations are null. Find marginal-mode sets and possible complete paths. Can independently choosing a at each time give a MAP path aa?

풀이와 확인할 이유Solution and explanation

각 시점 주변은 둘 다 1/2이라 최빈 집합은 {a,b}이다. 전체 양의 경로는 ab와 ba 각 1/2뿐이다. aa는 전이확률 0이라 불가능하다. 주변 모드 집합과 일관된 전체 MAP 경로는 별개의 최적화 질문이다.

Each time has marginal-mode set {a,b}, but the only positive complete paths are ab and ba with mass 1/2 each. Path aa is impossible. Marginal modes and a coherent joint MAP path answer different optimization questions.

52. Viterbi의 최대와 forward의 합Viterbi max versus forward sum

어떤 현재 상태로 오는 두 이전 경로 무게가 1/10과 2/10이고 공통 새 방출 가능도 1/2이다. 합 추론과 최대 경로 재귀는 어떤 값을 넘기는가?

Two incoming previous-path weights for a current state are 1/10 and 2/10, with common new emission likelihood 1/2. Compare sum inference and a maximum-path recurrence.

풀이와 확인할 이유Solution and explanation

forward의 그 상태 질량은 (1/10+2/10)(1/2)=3/20이다. 최대 경로는 max(1/10,2/10)(1/2)=1/10이다. 합은 모든 경로의 확률을 모으고 최대는 가장 무거운 한 경로를 보존한다. 두 연산을 바꾸어 쓰면 가능도와 MAP을 혼동한다.

Forward mass is(1/10+2/10)(1/2)=3/20. The maximum-path recurrence retains max(1/10,2/10)(1/2)=1/10. Summation aggregates all paths; maximization preserves a best path. Interchanging them confuses likelihood with MAP.

53. 순서가 바뀐 상태 이름Reordering state names

MAP 경로가 동률인 문제에서 상태 선언 순서를 a,b에서 b,a로 바꾸고 초기·전이·방출표도 같은 상태 이름에 맞춰 재배열했다. 최대 무게·동률 수·대표 경로는?

Reorder states a,b to b,a in a tied MAP problem, consistently reordering all probability tables by labels. What happens to maximum weight, tie count and representative?

풀이와 확인할 이유Solution and explanation

동일한 이름의 모형을 재표현했으므로 최대 무게와 동률 수는 같다. 사전식 대표는 선언 순서에 따라 달라질 수 있다. 표를 같은 라벨에 맞춰 바꾸지 않으면 다른 모형이 되므로 단순 이름 재배열의 불변성 주장을 할 수 없다.

Consistent relabel ordering preserves the represented law, maximum mass and tie count. A lexicographic representative may change with declaration order. Failing to reorder tables consistently would instead change the model.

54. 시간 동질성과 불변분포Time homogeneity and stationarity

q다음=1/4+q/2이고 q0=1/5이다. q1,q2와 고정점을 구하라. 전이표가 매일 같다는 이유로 상태 분포가 불변인가?

For q_next=1/4+q/2 and q0=1/5 find q1,q2 and the fixed point. Does a constant transition table imply constant state marginals?

풀이와 확인할 이유Solution and explanation

q1=7/20,q2=17/40이다. 고정점 q=1/4+q/2는 1/2이다. 초기 1/5는 고정점이 아니므로 분포가 변한다. 시간 동질 전이와 불변 초기분포에서의 정상성은 다르다.

q1=7/20 and q2=17/40; the fixed point is 1/2. Initial 1/5 is not invariant, so marginals change. Time-homogeneous transitions differ from starting in a stationary distribution.

55. 실제 국가의 조건부1A finite country conditional equal to one

선택 16국에서 (high,80이상)=8,(high,80미만)=1,(low,80미만)=7이다. P(high),P(high|80이상),P(80이상|high)을 구하라.

Retained-country counts are 8 high/atLeast80,1 high/below80 and 7 low/below80. Find P(high),P(high|atLeast80),P(atLeast80|high).

풀이와 확인할 이유Solution and explanation

동일 국가 무게 실험에서 9/16,8/8=1,8/9이다. 1은 이 16국 표의 조건부 비중이며 모든 나라나 미래 개인의 수명 보장을 뜻하지 않는다. GDP 경계도 이 장의 선택이고 같은 연도 지표의 연관은 인과효과가 아니다.

Under equal retained-country weights the answers are 9/16,1 and 8/9. Conditional one describes this finite table, not a guarantee for all countries or future individuals. Thresholds are chosen, and same-year association is not a causal effect.

56. 실제 픽셀 조건의 분모The actual pixel-evidence denominator

제공 시험 1,797행 중 p18,p45가 모두 ink인 행 757개, 그중 라벨 0이 149개이다. 라벨 0·두 ink의 결합 비중과 라벨 0의 조건부 비중을 구하라.

Among 1,797 provided-test rows,757 have both selected pixels ink and 149 of those have label zero. Find the joint and conditional label-zero probabilities.

풀이와 확인할 이유Solution and explanation

결합은 149/1797,두 ink 조건부는 149/757이다. 원 라벨과 픽셀을 함께 읽어 만든 유한 경험표다. 같은 표에 대한 계산이 새 필기숫자의 분류 정확도이거나 작성자 개인 식별 확률인 것은 아니다.

The joint is 149/1797 and the conditional is 149/757. These are exact finite empirical-table quantities from supplied labels and pixels, neither new-handwriting classification accuracy nor a writer-identification probability.

57. 제공 시험 표를 다시 평가 자료로Reusing the provided test table

원래 제공 시험 파일의 라벨을 모두 사용해 P(Digit),P(pixel|Digit)를 만든 뒤 같은 행에서 성능을 계산했다. 파일명이 test이므로 손대지 않은 최종 평가라고 보고해도 되는가?

Use every provided-test label to construct class and pixel conditionals, then score the same rows. Does the original test filename make this an untouched final evaluation?

풀이와 확인할 이유Solution and explanation

아니다. 현재 분석에서 라벨을 모형 작성에 사용했으므로 새로 남겨 둔 평가 자료가 아니다. 원래 제공 분할 이름은 출처 정보로 보존하되 이번 사용 역할을 명시한다. 이 장에서는 유한 표의 재표현·추론을 다루며 외부 일반화 성능을 추정했다고 보고하지 않는다.

No. Those labels were used to construct this analysis’s model. Preserve the provider split name as provenance but state its actual role here. The chapter studies finite-table representation and inference, not external predictive performance.

58. 고객 표와 naïve 근사A customer table and its naïve approximation

3,150행 중 Churn1은 495,그중 민원1은 200·상태2는 370이다. Churn0은 2655,그중 민원1은 41·상태2는 412이다. 민원과 상태가 Churn 아래 독립이라고 가정한 뒤 민원1·상태2에서 이탈 사후를 구하고 실제 표 141/158과 비교하라.

Of 3,150 rows,495 are churn 1 with 200 complaint 1 and 370 status 2;2,655 are churn 0 with 41 complaint 1 and 412 status 2. Assume conditional independence given churn. Find churn posterior for complaint 1/status 2 and compare the actual joint-table 141/158.

풀이와 확인할 이유Solution and explanation

이탈 무게는 (495/3150)(200/495)(370/495)=296/6237이다. 비이탈 무게는 (2655/3150)(41/2655)(412/2655)=8446/4181625이다. 정규화한 비중은 1091500/1137953이다. 이는 141/158과 다르다. 차이는 같은 주변 조건표에 추가한 독립 근사에서 생기며 정확 추론 알고리즘 오류가 아니다.

Churn weight is(495/3150)(200/495)(370/495)=296/6237; no-churn weight is(2655/3150)(41/2655)(412/2655)=8446/4181625. Normalize to 1091500/1137953, differing from 141/158. The discrepancy comes from the added independence approximation, not an error in exact inference.

59. 원 자료의 행 순서Original row order

고객 원행 1 다음 2,숫자 시험 원행 1 다음 2의 범주를 세어 전이표를 만들었다. 이를 고객 또는 필기 작성자의 실제 시간 HMM으로 해석하려면 무엇을 더 확인해야 하는가?

Build transitions from adjacent customer rows or adjacent digit-test rows. What must be established before interpreting them as an actual temporal HMM?

풀이와 확인할 이유Solution and explanation

같은 단위의 반복 측정인지,실제 시각·관측 간격과 행 정렬 규칙이 무엇인지 확인해야 한다. 원위치는 재현 키일 뿐 시간 증거가 아니다. 숨은 상태·전이·방출 가정과 자료 수집 과정도 추가로 정당화한다. 순서가 있다는 이유만으로 이 조건들이 성립하지 않는다.

Verify repeated observations of the same unit, timestamps, intervals and ordering rules. Source position is a reproducibility key, not temporal evidence. Hidden states, transition/emission assumptions and collection processes also need justification. A row order alone supplies none of these.

60. 확률망 결과를 보고하기Report a probability-network analysis

실제 세 자료 중 하나를 골라 원자료→선택 범주→포화/근사 망→증거→사후까지 짧은 재현 보고서를 설계하라. 반드시 남길 항목과 주장하지 말아야 할 범위를 설명하라.

Design a reproducible report tracing one actual dataset through selected categories, saturated/approximate network, evidence and posterior. State required records and limits.

풀이와 확인할 이유Solution and explanation

원파일 지문·원행·단위·보관 시점과 선택 경계를 기록한다. 균등 추출 단위,실제 도수,분모,0문맥 규약,망 구조·CPT·질의·증거를 보존한다. 포화와 근사의 차이와 두 정확 알고리즘의 일치를 대조한다. 상태·관측·개입·미래 평가를 분리하고 추가 설계 없이 인과성·새 표본 성능·행 순서의 시간 의미를 주장하지 않는다.

Record original-file hashes, positions, units, retention date and chosen thresholds. Preserve the drawing unit, counts/denominators, zero-context convention, graph/CPTs, query and evidence. Compare saturated/approximate results and agreement of exact algorithms. Distinguish states, observations, interventions and future evaluation; causal effects, new-sample performance and temporal row meaning require further design.

자료와 출처Data and sources

실습에 추가한 실제 입력과 출처Additional observed lab inputs and provenance

실제 자료 사례Actual-data cases · 원자료·단위·결측·변환·출처Inputs, units, missingness, transformations and sources

자료별 확보일·원행 식별·단위·이용 조건은 출처 기록을 확인하세요. 학습 사본은 제공처의 현재 최신 자료와 다를 수 있습니다.Consult each source record for retrieval dates, row identifiers, units and terms. Teaching copies can differ from current provider releases.

자료사전·출처·이용 조건Data dictionary, sources and terms