ML-05 · MACHINE LEARNING

로지스틱 회귀·우도·확률 보정Logistic regression, likelihood and calibration

확률·우도·유한 최적해·보정·행동을 실제 자료로 연결한다Connect probabilities, likelihood, finite optima, calibration and actions using actual records

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

학부Undergraduate

1. 예·아니오 앞에 확률이 필요한 이유1. Why probabilities come before yes/no actions

내일 비가 올까요? 예보가 60%라고 했는데 실제로 비가 안 왔다고 해서 예보가 반드시 틀린 것은 아닙니다. 같은 조건에서 60%라고 말한 날이 충분히 많다면 그중 어느 정도에 비가 왔는지 살펴야 합니다. 한 번의 0 또는 1 결과와 그 결과에 부여한 확률은 서로 다른 양입니다.

설명용 열 사람 중 여섯 명이 서비스를 갱신했다고 합시다. 모두에게 갱신 확률 3/5를 주는 기준 규칙과 무조건 갱신한다고 말하는 행동 규칙을 구별합니다. 전자는 위험의 정도를 남기고, 후자는 정한 문턱을 적용해 정보를 하나의 결정으로 압축합니다. 이 열 사람은 원자료가 아닌 계산 예시입니다.

이 장은 먼저 확률·오즈·로짓의 언어를 익히고, 관측 결과에 높은 확률을 주는 우도로 모형을 적합합니다. 이어 유한 최적계수가 없는 경우, 확률 보정, 비용에 따른 행동을 구분합니다. 마지막에는 실제 국가·임금·고객 자료에서 같은 절차를 반복하되 개인과 국가, 관측과 개입을 혼동하지 않습니다.

Will it rain tomorrow? A forecast of 60% is not necessarily wrong when rain does not occur. Across many sufficiently comparable days assigned 60%, we can examine the fraction that actually receive rain. One realized 0/1 outcome and a probability assigned to it are different quantities.

Suppose six of ten illustrative customers renew. Giving every customer renewal probability 3/5 is a baseline probability rule; always announcing renewal is an action rule. The first retains uncertainty; the second compresses it through a threshold. These ten customers are a calculation example, not original records.

We develop probability, odds and logits; fit a model by likelihood; then separate nonexistence of finite coefficients, probability calibration and cost-based actions. Actual country, wage and customer archives repeat the workflow while keeping individuals distinct from countries and observations distinct from interventions.

학부Undergraduate

2. 무엇을 1이라고 부를지 먼저 정한다2. Define what counts as one before fitting

Y=1은 관심 사건이 일어났다는 표시입니다. 이탈 자료에서는 1이 이탈, 임금 사례에서는 1976년 원 임금이 500센트/시간 이상이라는 뜻입니다. 서로 다른 결과를 같은 1로 쓴다고 같은 사건이 되지 않습니다. 기록 시점·측정 단위·누락 부호를 함께 적어야 합니다.

입력 X는 예측에 사용하는 정보이고 Y는 나중에 확인할 정답입니다. 학교를 12년 넘게 다녔는지를 X로 쓰는 것과 그 사실을 개입으로 바꾸는 것은 다릅니다. 고객의 12개월 말 이탈을 예측하면서 12개월 뒤에만 생기는 정보를 X에 섞으면 실제 이용 시점의 예측이 아닙니다.

각 행에는 원행 주소·역할·X·Y·가중치를 남깁니다. Y 미관측은 Y=0이 아니며 가중치 0인 행도 자료에 있었던 사실은 보존합니다. 계산의 분모는 양의 가중치와 필요한 입력·결과가 모두 있는 행의 가중치 합입니다. 분모가 0이면 평균 손실은 미정의입니다.

W=∑i∈Awi,A={i:wi>0, Xi,Yi observed}W=\sum_{i\in\mathcal A}w_i,\qquad \mathcal A=\{i:w_i>0,\ X_i,Y_i\text{ observed}\}

Y=1 marks the event of interest. In churn it means departure; in the wage case it means original nominal 1976 pay of at least 500 cents/hour. Sharing the symbol 1 does not make these the same event. Record measurement time, units and missing markers.

X is information used for prediction; Y is the answer eventually observed. Using schooling above 12 years as X is distinct from intervening on schooling. Predicting month 12 churn using information created only afterward would not reproduce the intended information-time prediction.

Retain source address, role, X, Y and weight for every row. Missing Y is not Y=0, and a zero-weight row still belongs to the archive. A score denominator sums positive weights over rows with the required input and outcome. Zero available weight makes a normalized score undefined.

W=∑i∈Awi,A={i:wi>0, Xi,Yi observed}W=\sum_{i\in\mathcal A}w_i,\qquad \mathcal A=\{i:w_i>0,\ X_i,Y_i\text{ observed}\}
학부Undergraduate

3. 확률을 오즈로 바꾼다3. Convert probability into odds

확률 1/4는 비슷한 네 경우 중 사건이 한 번 일어나는 비율을 뜻합니다. 오즈는 일어날 경우와 안 일어날 경우를 비교한 1:3, 즉 1/3입니다. 사건이 1/2이면 오즈는 1, 확률 3/4이면 오즈는 3입니다. 확률은 전체를 분모로, 오즈는 비사건을 분모로 삼습니다.

오즈 o를 다시 확률로 바꾸려면 사건 몫 o와 비사건 몫 1을 합친 o+1로 나눕니다. o=2라면 확률은 2/3입니다. 따라서 오즈가 1에서 2로 두 배가 되어도 확률은 1/2에서 2/3으로 바뀌며 두 배가 아닙니다.

확률 0은 오즈 0, 확률 1은 유한한 오즈가 없습니다. 로지스틱의 유한 계수는 확률을 0과 1 사이에 엄격히 두므로 이 경계에 도달하지 않습니다. 반면 자료의 단순 성공 비율은 0 또는 1일 수 있습니다. 이 차이가 뒤에서 MLE 존재 문제를 만듭니다.

o=p1−p,p=o1+oo=\frac p{1-p},\qquad p=\frac o{1+o}

Probability 1/4 means one event per four comparable cases. Odds compare events with nonevents:1:3, or 1/3. Probability 1/2 has odds 1; probability 3/4 has odds 3. Probability uses all cases in its denominator; odds use nonevents.

To recover probability from odds o, divide the event share o by total share o+1. Odds 2 give probability 2/3. Doubling odds from 1 to 2 changes probability from 1/2 to 2/3, not by a factor of two.

Probability 0 gives odds 0; probability 1 has no finite odds. Finite logistic coefficients keep probabilities strictly between 0 and 1. Empirical success fractions can nevertheless equal either boundary. That difference will create the finite-MLE existence problem.

o=p1−p,p=o1+oo=\frac p{1-p},\qquad p=\frac o{1+o}
학부Undergraduate

4. 로그 오즈를 직선으로 표현한다4. Model log odds with a linear predictor

양의 오즈에 자연로그를 적용한 값이 로짓입니다. 오즈 1의 로그는 0, 1보다 큰 오즈의 로그는 양수, 작은 오즈의 로그는 음수입니다. 양수만 가능한 오즈를 실수 전체에서 움직이는 값으로 바꾸므로 선형식 η=a+bX와 연결하기 좋습니다.

log[p/(1−p)]=η에서 양변에 지수함수를 적용하면 오즈는 exp(η)입니다. 앞 절의 역변환을 쓰면 p=exp(η)/(1+exp(η))=1/(1+exp(−η))가 됩니다. 이 역연결 함수를 시그모이드라고 부릅니다. 로짓과 시그모이드는 같은 방향의 변환이 아니라 서로의 역함수입니다.

η=0일 때 p=1/2입니다. η=ln3이면 p=3/4이며 η=−ln3이면 p=1/4입니다. 자료의 계수를 분수로 정확히 적을 수 없더라도 ln3처럼 정확한 수학 표현은 가능합니다. 로그의 소수 근삿값을 정확한 분수 계수라고 표시하지 않습니다.

η=log⁡p1−p=a+bX,σ(η)=11+e−η\eta=\log\frac p{1-p}=a+bX,\qquad \sigma(\eta)=\frac1{1+e^{-\eta}}

The logit is the natural logarithm of positive odds. Odds 1 have logit 0; larger odds give positive logits and smaller odds negative logits. This real-valued scale connects naturally to a linear predictor η=a+bX.

Exponentiating log[p/(1−p)]=η gives odds exp(η). The inverse-odds formula yields p=exp(η)/(1+exp(η))=1/(1+exp(−η)). This inverse link is the sigmoid. Logit and sigmoid are inverse transformations, not two names for the same direction.

At η=0, p=1/2. At η=ln 3, p=3/4; at η=−ln 3, p=1/4. A coefficient may have an exact expression such as ln 3 without being rational. A decimal approximation to a logarithm must not be labeled an exact rational coefficient.

η=log⁡p1−p=a+bX,σ(η)=11+e−η\eta=\log\frac p{1-p}=a+bX,\qquad \sigma(\eta)=\frac1{1+e^{-\eta}}
학부Undergraduate

5. 같은 계수라도 확률 변화는 다르다5. The same slope gives different probability changes

시그모이드의 가운데는 가파르고 양 끝은 완만합니다. 로짓을 같은 크기만큼 늘려도 이미 99%인 확률은 위로 갈 공간이 작습니다. p의 η에 대한 미분은 p(1−p)이고, 이 값은 p=1/2에서 1/4로 가장 큽니다. 대수식은 p(1−p)=1/4−(p−1/2)²로 확인할 수 있습니다.

연속 입력 X에 대한 작은 변화의 확률 기울기는 bp(1−p)입니다. b=2라면 p=1/2에서 기울기는 1/2, p=1/10에서는 9/50입니다. 이는 아주 작은 변화에 대한 국소 근사이지 X를 한 단위 바꿀 때 반드시 그만큼 확률이 변한다는 식이 아닙니다.

X가 0/1이면 실제 차이는 σ(a+b)−σ(a)를 직접 계산합니다. a=0,b=ln3이면 p₀=1/2,p₁=3/4로 차이는 1/4입니다. b 자체 ln3을 확률 차이라고 읽거나 미분식을 0→1의 정확 차이로 대신하지 않습니다.

∂p∂X=bp(1−p),Δ0→1p=σ(a+b)−σ(a)\frac{\partial p}{\partial X}=bp(1-p),\qquad \Delta_{0\to1}p=\sigma(a+b)-\sigma(a)

The sigmoid is steepest near its center and flatter near its ends. Equal logit increases have less room to raise an already 99% probability. Its derivative is p(1−p), maximized at p=1/2 with value 1/4. The identity p(1−p)=1/4−(p−1/2)² proves the bound.

For a continuous X, the local probability slope is bp(1−p). With b=2, it equals 1/2 at p=1/2 and 9/50 at p=1/10. This is a local approximation for small changes, not necessarily the exact probability change from a full-unit increase.

For binary X, calculate σ(a+b)−σ(a) directly. With a=0, b=ln 3, probabilities are 1/2 and 3/4, a difference of 1/4. Neither b itself nor a derivative evaluated at one point replaces this exact 0-to 1 contrast.

∂p∂X=bp(1−p),Δ0→1p=σ(a+b)−σ(a)\frac{\partial p}{\partial X}=bp(1-p),\qquad \Delta_{0\to1}p=\sigma(a+b)-\sigma(a)
학부Undergraduate

6. 기울기는 오즈비의 로그다6. The slope is a log odds ratio

이진 X에서 두 집단의 오즈를 o₀,o₁이라고 합시다. 로지스틱 식은 log o₀=a, log o₁=a+b이므로 b=log(o₁/o₀)입니다. 따라서 exp(b)는 두 집단 오즈의 비율입니다. 다른 입력이 있는 일반 모형에서는 그 입력을 고정한 조건부 오즈비입니다.

p₀=1/4,p₁=1/2이면 오즈는 1/3과 1이며 오즈비는 3입니다. 확률비는 2, 확률 차이는 1/4로 서로 다릅니다. 표에 모두 비슷한 비율처럼 보이더라도 어떤 분모를 쓰는지에 따라 해석이 달라집니다.

조건부 오즈비와 입력을 평균낸 한계 오즈비도 일반적으로 같지 않습니다. 혼란변수가 전혀 없다는 인과 가정만으로 오즈비의 비선형 평균 문제가 없어지지 않습니다. 이 장의 두 집단 계수는 선택한 입력·표본·단위 가중치의 기술적 조건부 연관입니다.

eb=p1/(1−p1)p0/(1−p0)e^b=\frac{p_1/(1-p_1)}{p_0/(1-p_0)}

For binary X, write group odds o₀ and o₁. Logistic equations log o₀=a and log o₁=a+b imply b=log(o₁/o₀). Thus exp(b) is an odds ratio. With more inputs, it is a conditional odds ratio holding those inputs fixed.

If p₀=1/4 and p₁=1/2, odds are 1/3 and 1, so the odds ratio is 3. The probability ratio is 2 and the probability difference 1/4. These quantities answer different denominator-based questions.

A conditional odds ratio generally differs from an odds ratio after averaging over inputs. A causal no-confounding assumption alone does not remove this nonlinear averaging issue. Our two-group coefficient describes association in the selected input frame and unit-weight archive.

eb=p1/(1−p1)p0/(1−p0)e^b=\frac{p_1/(1-p_1)}{p_0/(1-p_0)}
학부Undergraduate

7. 확률에서 행동으로 가는 문턱7. A threshold converts probability into action

실제 결과가 0인데 1이라고 행동하면 오탐 비용 cFP, 결과가 1인데 0이라고 하면 미탐 비용 cFN을 낸다고 가정합니다. 맞힌 행동의 비용은 0입니다. 확률 p가 주어졌을 때 행동 1의 기대비용은 cFP(1−p), 행동 0의 기대비용은 cFN p입니다.

행동 1을 고를 조건은 cFP(1−p)≤cFN p입니다. 비용 합이 양수라면 p≥cFP/(cFP+cFN)입니다. 오탐 1, 미탐 4라면 문턱은 1/5입니다. 1/2는 두 비용이 같을 때의 특별한 문턱입니다. 같은 비용이면 이 장은 동률에서 행동 1을 택한다고 선언합니다.

두 비용이 모두 0이면 모든 행동이 비용상 동률이므로 0/0 문턱을 계산하지 않습니다. 고객 유지 제안의 성공·이익처럼 행동이 결과 자체를 바꾸는 경우 이 단순 오분류 비용 모형은 충분하지 않습니다. 예측확률과 실제 의사결정의 인과·자원 제약을 따로 모델링해야 합니다.

a∗(p)=1ifp≥cFPcFP+cFN,cFP+cFN>0a^*(p)=1\quad\text{if}\quad p\ge\frac{c_{FP}}{c_{FP}+c_{FN}},\quad c_{FP}+c_{FN}>0

Assume a false-positive action costs cFP, a false-negative costs cFN, and correct actions cost zero. At event probability p, action 1 has expected cost cFP(1−p), whereas action 0 costs cFN p.

Choose action 1 when cFP(1−p)≤cFN p. If total cost is positive, the threshold is cFP/(cFP+cFN). FP 1/FN 4 gives 1/5; one-half is the equal-cost special case. This chapter explicitly selects action 1 at a cost tie.

If both costs vanish, every action ties; do not compute a 0/0 threshold. When an action changes the outcome itself, such as a retention offer, this misclassification-cost model is insufficient. Causal response and resource constraints require another decision model.

a∗(p)=1ifp≥cFPcFP+cFN,cFP+cFN>0a^*(p)=1\quad\text{if}\quad p\ge\frac{c_{FP}}{c_{FP}+c_{FN}},\quad c_{FP}+c_{FN}>0
학부Undergraduate

9. 우도: 정답에 얼마나 높은 확률을 주었나9. Likelihood: how much probability did the observed answers receive?

관측한 Y가 1이면 그 행의 사건 확률 p를, Y가 0이면 비사건 확률 1−p를 꺼냅니다. 이 값들을 곱한 것이 조건부 독립 Bernoulli 작업모형의 우도입니다. 정답 두 개가 (0,1)이고 예측이 (1/4,3/4)이면 우도는 (3/4)(3/4)=9/16입니다.

우도를 볼 때 관측한 X,Y는 고정하고 계수를 바꿉니다. “자료가 주어졌을 때 계수의 확률”이 아닙니다. 연속 계수의 사후분포를 말하려면 사전분포와 Bayes 규칙을 추가해야 합니다. 같은 관측 자료에서 후보가 관측 결과에 준 확률을 비교하는 함수라는 뜻입니다.

같은 고객이 여러 행에 반복되거나 공통 충격이 있으면 조건부 독립이 깨질 수 있습니다. 곱을 계산할 수 있다는 사실이 독립을 증명하지 않습니다. 정수 빈도 가중치는 같은 관측의 반복 횟수로 해석할 수 있고, 비정수 가중치는 별도로 선언한 가중 로그 목적함수 또는 거듭제곱 작업우도입니다.

L(θ)=∏i∈Api(θ)wiYi[1−pi(θ)]wi(1−Yi)L(\theta)=\prod_{i\in\mathcal A}p_i(\theta)^{w_iY_i}[1-p_i(\theta)]^{w_i(1-Y_i)}

For an observed Y=1, take p; for Y=0, take 1−p. Multiplying these event probabilities gives the conditional-independent Bernoulli working likelihood. Outcomes(0,1) with forecasts(1/4,3/4) yield(3/4)(3/4)=9/16.

When examining likelihood, hold observed X, Y fixed and vary coefficients. Likelihood is not a probability distribution of coefficients given data. A posterior requires a prior and Bayes’ rule. Here it compares the probability different candidate models assign to the same observed answers.

Repeated customer records or common shocks can violate conditional independence. Computing a product does not prove independence. Integer frequency weights can count repeated observations; noninteger weights instead define an explicitly weighted log objective or power working likelihood.

L(θ)=∏i∈Api(θ)wiYi[1−pi(θ)]wi(1−Yi)L(\theta)=\prod_{i\in\mathcal A}p_i(\theta)^{w_iY_i}[1-p_i(\theta)]^{w_i(1-Y_i)}
학부Undergraduate

10. 곱을 로그 합으로 바꾸어 비교한다10. Replace products with log sums

여러 확률을 곱하면 수가 빠르게 작아집니다. 로그는 곱을 합으로 바꾸고 순서를 보존합니다. 우도가 가장 큰 계수를 찾는 일은 로그우도가 가장 큰 계수를 찾는 일과 같습니다. 부호를 바꾼 음의 로그우도를 최소화하면 최적화 문제의 방향만 바뀝니다.

평균 로그손실은 음의 로그우도를 가용 가중치 W로 나눈 값입니다. 앞 예시에서는 −log(3/4)≈0.287682입니다. 예측 확률 (1/2,1/2)의 손실 log2≈0.693147보다 작습니다. 두 예측이 모두 맞았다는 사실 외에 어느 정도 자신 있게 맞혔는지도 평가합니다.

확률 0을 준 사건이 실제로 일어났고 가중치가 양수이면 손실은 양의 무한대입니다. 가중치 0인 행의 불가능 사건은 목적함수에 넣지 않습니다. 모든 결과가 미관측이면 곱의 빈값 1과 로그합 0은 정할 수 있어도 평균 손실은 분모가 없어 미정의입니다. 아래 실습에서 세 경우를 따로 확인하세요.

ℓ(θ)=∑iwi[Yilog⁡pi+(1−Yi)log⁡(1−pi)],L‾=−ℓ/W\ell(\theta)=\sum_iw_i[Y_i\log p_i+(1-Y_i)\log(1-p_i)],\qquad \overline{\mathcal L}=-\ell/W

Products of many probabilities quickly become tiny. Logarithms turn products into sums while preserving order. Maximizing likelihood therefore maximizes log likelihood; negating it creates a minimization problem.

Mean log loss divides negative log likelihood by available weight W. The preceding example gives−log(3/4)≈0.287682, below log 2≈0.693147 for forecasts(1/2,1/2). It rewards the degree of appropriate confidence as well as the resulting classifications.

An event assigned probability zero gives positive-infinite loss when its observed row has positive weight. An impossible event on a zero-weight row does not enter the objective. With no observed outcomes, the empty product 1 and log sum 0 do not make normalized mean loss defined. Explore these cases separately below.

ℓ(θ)=∑iwi[Yilog⁡pi+(1−Yi)log⁡(1−pi)],L‾=−ℓ/W\ell(\theta)=\sum_iw_i[Y_i\log p_i+(1-Y_i)\log(1-p_i)],\qquad \overline{\mathcal L}=-\ell/W
학부Undergraduate

11. 한 집단의 성공 비율을 직접 유도한다11. Derive a one-group success probability

한 집단에서 성공의 가중합 S, 실패의 가중합 F, 전체 W=S+F가 있다고 합시다. 상수 확률 p의 로그우도는 S logp+F log(1−p)입니다. S,F가 둘 다 양수이면 미분은 S/p−F/(1−p)이고, 0으로 놓아 p=S/W를 얻습니다.

두 번째 미분 −S/p²−F/(1−p)²는 음수이므로 내부의 이 값이 유일한 최대입니다. 성공 3, 실패 1이면 p=3/4, 로짓은 ln3입니다. 표본의 성공 비율과 주어진 작업모형의 MLE가 여기서 일치하는 이유를 식으로 확인했습니다.

S=0,F>0이면 우도는 p를 0 쪽으로 줄일수록 커집니다. 닫힌 확률 공간에서는 p=0이 최대이지만 유한 로짓 공간에서는 그 값에 도달하지 못합니다. S=F=0이면 로그우도는 모든 p에서 같아 확률을 식별하지 못합니다. 관측 결과가 0인 집단과 관측 자체가 없는 집단을 구별합니다.

p^=SS+F (S,F>0),ℓ′′(p)=−Sp2−F(1−p)2<0\widehat p=\frac S{S+F}\ (S,F>0),\qquad \ell^{\prime\prime}(p)=-\frac S{p^2}-\frac F{(1-p)^2}<0

For one group, let S and F be weighted success and failure counts and W=S+F. A constant probability has log likelihood S logp+F log(1−p). If both counts are positive, the derivative S/p−F/(1−p)=0 gives p=S/W.

The second derivative−S/p²−F/(1−p)² is negative, so the interior maximizer is unique. Three successes and one failure give probability 3/4 and logit ln 3. This derives why the empirical fraction equals the MLE in this working model.

If S=0< F, likelihood increases as p approaches zero. Zero maximizes over the closed probability space but is unattainable at finite logit. If S=F=0, all probabilities have the same likelihood and remain unidentified. An observed zero-event group differs from an unobserved group.

p^=SS+F (S,F>0),ℓ′′(p)=−Sp2−F(1−p)2<0\widehat p=\frac S{S+F}\ (S,F>0),\qquad \ell^{\prime\prime}(p)=-\frac S{p^2}-\frac F{(1-p)^2}<0
학부Undergraduate

12. 두 집단 로지스틱을 손으로 적합한다12. Fit a two-group logistic model by hand

이진 입력 X∈{0,1}에서 p₀=σ(a),p₁=σ(a+b)입니다. 두 로짓 a와 a+b는 별도로 움직일 수 있으므로 두 집단의 Bernoulli 우도를 각각 최대화하면 됩니다. 이를 이진 입력에 대한 포화 모형이라고 부릅니다. 관측 행마다 별도 확률을 붙이는 포화 모형과는 다릅니다.

설명용 x=0 집단은 성공 1/가용 4, x=1 집단은 성공 3/가용 4라고 합시다. p₀=1/4,p₁=3/4이고 a=−ln3,b=ln9입니다. x=1로 바뀌면 확률 차이는 1/2, 오즈비는 9입니다. 각 계산의 분모와 척도를 함께 읽으세요.

이 장의 정확 실습은 이 두 집단 모형을 풉니다. 일반적인 연속 입력이나 여러 설명변수의 로지스틱 우도는 이런 두 개의 표본 비율만으로 풀리지 않습니다. 다음 절의 점수·Hessian으로 일반 원리를 배우되, 작은 정확 실습을 범용 수치 최적화기로 소개하지 않습니다.

a^=log⁡S0F0,b^=log⁡S1/F1S0/F0(Sg,Fg>0)\widehat a=\log\frac{S_0}{F_0},\qquad\widehat b=\log\frac{S_1/F_1}{S_0/F_0}\quad(S_g,F_g>0)

For binary X, p₀=σ(a) and p₁=σ(a+b). Because a and a+b can vary independently, maximize each group’s Bernoulli likelihood. This is saturated with respect to the binary input, not one probability per individual observation.

Suppose group 0 has one success among four and group 1 three among four. Then p₀=1/4, p₁=3/4, a=−ln 3 and b=ln 9. The probability difference is 1/2, whereas the odds ratio is 9. Keep their scales and denominators distinct.

Our exact fitting lab solves this two-group model. Logistic regression with continuous or several inputs does not generally reduce to two success fractions. The following score/Hessian discussion develops the general principle without presenting this small exact lab as a general numerical optimizer.

a^=log⁡S0F0,b^=log⁡S1/F1S0/F0(Sg,Fg>0)\widehat a=\log\frac{S_0}{F_0},\qquad\widehat b=\log\frac{S_1/F_1}{S_0/F_0}\quad(S_g,F_g>0)
학부Undergraduate

13. 관측하지 않은 집단의 전체 계수 가족13. The full coefficient family with an unseen input level

x=0만 관측했고 성공·실패가 각각 2라고 합시다. p₀=1/2이므로 a=0이지만 b에 관한 정보는 없습니다. 모든 (a,b)=(0,t), t∈R가 같은 최대 우도를 만듭니다. x=1의 확률은 σ(t)로 0과 1 사이 어느 값이든 가능합니다.

x=1만 관측해서 성공 3, 실패 1이면 a+b=ln3만 식별됩니다. 전체 가족은 (a,b)=(ln3−t,t)입니다. 표준적인 소프트웨어가 b=0 같은 대표값을 고를 수 있지만, 그 선택이 관측하지 않은 x=0의 확률을 식별한 것은 아닙니다.

두 집단 모두 가용 관측이 없으면 모든 유한 계수가 최대입니다. 어떤 관측 집단이 순수 성공·실패라면 그 집단 때문에 유한 MLE는 존재하지 않습니다. 없는 집단의 미식별과 있는 집단의 경계 상한 문제를 서로 대체해서 설명하지 않습니다.

Xi=1 ∀i:(a,b)=(log⁡(S/F)−t,t),t∈RX_i=1\ \forall i:\quad (a,b)=(\log(S/F)-t,t),\quad t\in\mathbb R

If only x=0 is observed with two successes and two failures, p₀=1/2 fixes a=0 but gives no information about b. Every vector(0, t), t real, maximizes likelihood. At unseen x=1,σ(t) can take any value strictly between zero and one.

If only x=1 is observed with three successes and one failure, only a+b=ln 3 is identified. The full family is(ln 3−t, t). Software may select b=0, but that representative does not identify the unobserved x=0 probability.

If neither group has available observations, every finite coefficient vector maximizes likelihood. If any observed group contains only one outcome, no finite MLE exists. Missing-level nonidentification and an observed group’s boundary supremum are different issues.

Xi=1 ∀i:(a,b)=(log⁡(S/F)−t,t),t∈RX_i=1\ \forall i:\quad (a,b)=(\log(S/F)-t,t),\quad t\in\mathbb R
학부 심화 · 선택Advanced undergraduate · optional

14. 일반 로지스틱의 점수와 곡률14. Score and curvature in general logistic regression

절편을 포함한 입력 벡터를 zᵢ=(1,Xᵢ₁,…,Xᵢk), 계수를 θ라고 씁니다. ηᵢ=zᵢᵀθ,pᵢ=σ(ηᵢ)입니다. 로그우도의 미분인 점수는 Σwᵢzᵢ(Yᵢ−pᵢ)입니다. 예측한 성공량이 실제 성공량보다 적으면 해당 입력 방향으로 계수를 밀어 올리는 구조입니다.

음의 로그우도의 Hessian은 Σwᵢpᵢ(1−pᵢ)zᵢzᵢᵀ입니다. 어느 벡터 v에 곱해도 이차형식은 Σwᵢpᵢ(1−pᵢ)(zᵢᵀv)²≥0이므로 목적함수는 볼록합니다. 유한 계수에서 양의 가용 가중치와 설계의 전체 열순위가 있으면 이 값은 비영 v에서 양수입니다.

엄격한 볼록성은 유한 최소점이 있다면 유일함을 뜻합니다. 최소점이 존재한다는 결론까지 주지는 않습니다. 완전 분리에서 곡선은 계속 낮아지면서 유한 최저점이 없을 수 있습니다. 반대로 중복 열이 있으면 서로 다른 계수가 같은 η를 만들어 평평한 방향이 생깁니다.

∇(−ℓ)=∑iwizi(pi−Yi),H=∑iwipi(1−pi)zizi⊤\nabla(-\ell)=\sum_iw_iz_i(p_i-Y_i),\qquad H=\sum_iw_ip_i(1-p_i)z_iz_i^\top

Write the intercept-augmented vector zᵢ=(1, Xᵢ₁,…, Xᵢk), coefficients θ,ηᵢ=zᵢᵀθ and pᵢ=σ(ηᵢ). The log-likelihood score is Σwᵢzᵢ(Yᵢ−pᵢ). Underpredicted successes push coefficients along the corresponding input direction.

The negative-log-likelihood Hessian is Σwᵢpᵢ(1−pᵢ)zᵢzᵢᵀ. Its quadratic form is Σwᵢpᵢ(1−pᵢ)(zᵢᵀv)²≥0, proving convexity. With finite coefficients, positive available weights and full column rank, it is positive for every nonzero v.

Strict convexity implies uniqueness if a finite minimizer exists; it does not establish existence. Under complete separation, the objective keeps declining without reaching a finite minimum. Duplicate columns instead create flat coefficient directions that leave every η unchanged.

∇(−ℓ)=∑iwizi(pi−Yi),H=∑iwipi(1−pi)zizi⊤\nabla(-\ell)=\sum_iw_iz_i(p_i-Y_i),\qquad H=\sum_iw_ip_i(1-p_i)z_iz_i^\top
학부 심화 · 선택Advanced undergraduate · optional

15. Newton 한 걸음과 IRLS의 의미15. A Newton step and the meaning of IRLS

최적화는 현재 지점에서 기울기와 곡률로 곡선을 근사해 다음 지점을 고르는 과정입니다. 상수 확률의 네 행 중 성공이 3일 때 θ=0에서 p=1/2입니다. 합 음의 로그우도 기울기는 4×1/2−3=−1, Hessian은 4×1/4=1입니다. Newton 다음 θ는 0−(−1)/1=1입니다.

새 확률 σ(1)≈0.731059는 시작 1/2보다 MLE 3/4에 가까워졌지만 정확한 최적값은 아닙니다. 반복을 멈춘 기준·점수 잔차·손실 변화를 확인해야 합니다. 계산에서는 H의 역행렬을 직접 만드는 대신 선형 시스템 HΔ=−gradient를 풉니다.

일반 로지스틱에서는 현재 확률에 따른 가중치 wᵢpᵢ(1−pᵢ)와 작업 결과 ηᵢ+(Yᵢ−pᵢ)/[pᵢ(1−pᵢ)]를 만든 가중 최소제곱과 연결됩니다. 이것이 IRLS입니다. 작은 곡률·분리·순위 결손 때 무작정 같은 식을 반복하지 않으며 선형대수·감쇠·존재 진단이 필요합니다.

H(θ)Δ=−∇(−ℓ)(θ),θnew=θ+ΔH(\theta)\Delta=-\nabla(-\ell)(\theta),\qquad\theta_{new}=\theta+\Delta

Newton optimization uses local slope and curvature. With three successes in four intercept-only rows,θ=0 gives p=1/2. The summed negative-log-likelihood gradient is 4×1/2−3=−1 and Hessian 4×1/4=1. The next θ is 0−(−1)/1=1.

The new probability σ(1)≈0.731059 is closer to the MLE 3/4 but is not the exact optimum. Inspect stopping criteria, score residuals and loss changes. Numerically solve HΔ=−gradient rather than explicitly forming H’s inverse.

In general logistic regression, Newton connects to weighted least squares using weights wᵢpᵢ(1−pᵢ) and working responses ηᵢ+(Yᵢ−pᵢ)/[pᵢ(1−pᵢ)]. This is IRLS. Small curvature, separation and deficient rank require linear-algebra safeguards, damping and existence diagnostics rather than blind repetition.

H(θ)Δ=−∇(−ℓ)(θ),θnew=θ+ΔH(\theta)\Delta=-\nabla(-\ell)(\theta),\qquad\theta_{new}=\theta+\Delta
학부Undergraduate

16. 반횟수 보정은 MLE도 Ridge도 아니다16. Half-count smoothing is neither MLE nor ridge

성공 0, 실패 4인 집단의 MLE 경계 확률은 0입니다. 독립 집단별 Beta(1/2,1/2) 사전을 명시한 Binomial 작업모형에서는 사후분포가 Beta(1/2,9/2), 사후평균은 (0+1/2)/(4+1)=1/10입니다. 관측에 없는 성공을 실제 발생한 것처럼 원자료에 추가한 것은 아닙니다.

일반적인 사전 성공·실패 모수 a₀,b₀>0에서는 사후평균이 (S+a₀)/(W+a₀+b₀)입니다. 사후 최빈값 MAP와도 다릅니다. 두 사후 모수가 1보다 클 때의 내부 MAP 식은 (S+a₀−1)/(W+a₀+b₀−2)이며, 그렇지 않으면 경계 거동을 따로 봐야 합니다.

Ridge는 계수에 이차 벌점을 더한 다른 목적함수입니다. 확률에 독립 Beta 사전을 두는 일과 계수에 Gaussian 사전을 두는 일도 다릅니다. 비정수 가중치의 반횟수 계산은 일반화한 거듭제곱 작업우도로 표시합니다. 아래에서 원 MLE의 존재 상태와 명시한 평활 확률을 나란히 비교하세요.

E[p∣Y]=S+a0W+a0+b0,a0,b0>0\mathbb E[p\mid Y]=\frac{S+a_0}{W+a_0+b_0},\qquad a_0,b_0>0

For zero successes and four failures, the closed-space MLE probability is zero. An explicitly independent-group Beta(1/2,1/2) prior with the working Binomial likelihood gives posterior Beta(1/2,9/2) and posterior mean(0+1/2)/(4+1)=1/10. It does not add an actually observed success to the raw archive.

With prior shapes a₀, b₀>0, the posterior mean is(S+a₀)/(W+a₀+b₀). It also differs from MAP. Only when both posterior shapes exceed 1 is the interior MAP(S+a₀−1)/(W+a₀+b₀−2); otherwise boundary behavior needs separate treatment.

Ridge adds a quadratic coefficient penalty, a different objective. Independent Beta priors on probabilities differ from Gaussian priors on coefficients. Fractional-weight smoothing is labeled a generalized power-likelihood posterior. Compare the raw MLE’s existence status with the explicitly smoothed probabilities below.

E[p∣Y]=S+a0W+a0+b0,a0,b0>0\mathbb E[p\mid Y]=\frac{S+a_0}{W+a_0+b_0},\qquad a_0,b_0>0
학부Undergraduate

17. 완전히 나뉜 자료의 끝없는 우도 증가17. Complete separation lets likelihood improve indefinitely

설명용 두 행이 (X,Y)=(−1,0),(1,1)이라고 합시다. a=0,b>0이면 두 결과의 방향을 모두 맞힙니다. b=1보다 b=2가 두 관측 결과에 더 높은 확률을 줍니다. b를 계속 키우면 각각 비사건과 사건 확률이 1에 가까워지지만 어떤 유한 b에서도 정확히 1은 아닙니다.

부호를 sᵢ=2Yᵢ−1로 쓰면 모든 sᵢzᵢᵀd>0인 방향 d가 완전 분리 방향입니다. 그 방향을 따라 계수를 키우면 모든 행의 로그손실이 감소합니다. 따라서 유한 MLE는 없습니다. 큰 추정치나 큰 표준오차는 단순히 더 많은 반복이 필요한 신호일 수도 있다는 식으로 넘기면 안 됩니다.

실제 국가 사례의 두 집단이 이 경우에 해당합니다. 훈련 정확도 100%는 작업 우도의 유한 최적점 존재도, 새 국가의 확률 정확성도 보장하지 않습니다. 먼저 사건 정의·자료 가용성·설계순위·분리 기하를 살펴야 합니다.

∃d:sizi⊤d>0 ∀i∈A⟹no finite MLE\exists d:\quad s_iz_i^\top d>0\ \forall i\in\mathcal A\quad\Longrightarrow\quad\text{no finite MLE}

Take illustrative rows(X, Y)=(−1,0),(1,1). With a=0, b>0, the predicted directions are correct. Increasing b from 1 to 2 gives each observed outcome more probability. As b grows, both correct-event probabilities approach 1 but never equal it at a finite coefficient.

Writing sᵢ=2 Yᵢ−1, a direction d with every sᵢzᵢᵀd>0 completely separates the observations. Moving farther along it lowers every row’s log loss, so no finite MLE exists. Large coefficients or standard errors require an existence diagnosis, not merely more iterations.

The actual country training example has this structure. Perfect training accuracy guarantees neither a finite working-likelihood optimum nor accurate probabilities for another country. Inspect target definitions, availability, rank and separation geometry first.

∃d:sizi⊤d>0 ∀i∈A⟹no finite MLE\exists d:\quad s_iz_i^\top d>0\ \forall i\in\mathcal A\quad\Longrightarrow\quad\text{no finite MLE}
학부Undergraduate

18. 일부 행이 경계에 남아도 MLE가 없을 수 있다18. Boundary rows can still prevent a finite MLE

네 행 (X,Y)=(−1,0),(0,0),(0,1),(1,1)을 보세요. X=0에서 서로 다른 정답이 있으므로 모든 행을 엄격하게 분리할 수는 없습니다. 그렇다고 유한 MLE가 생기는 것은 아닙니다. a=0,b를 키우면 양 끝 두 행은 계속 좋아지고 가운데 두 행은 p=1/2로 그대로입니다.

모든 sᵢzᵢᵀd≥0이고 적어도 하나에서 엄격한 양수인 방향이 있으면 일부 우도는 좋아지고 나머지는 나빠지지 않습니다. 완전 분리는 안 되지만 이런 방향이 있는 경우를 준완전 분리라고 부릅니다. 위 예시 d=(0,1)의 부호 점수는 (1,0,0,1)입니다.

“같은 X에 서로 다른 Y가 있으니 분리 문제는 없다”는 주장은 틀립니다. 그 행들은 일부 방향을 막을 뿐 나머지 행의 개선 방향이 남을 수 있습니다. 실습은 최솟값 마진과 모든 비음수 점수의 합 개선을 각각 계산해 두 경우를 구별합니다.

sizi⊤d≥0 ∀i,∑isizi⊤d>0s_iz_i^\top d\ge0\ \forall i,\qquad\sum_i s_iz_i^\top d>0

Consider(X, Y)=(−1,0),(0,0),(0,1),(1,1). Contradictory answers at X=0 prevent strict separation of all rows. They do not ensure a finite MLE. With a=0, increasing b improves both extreme rows while the middle pair stays at p=1/2.

If every signed score sᵢzᵢᵀd≥0 and at least one is positive, some likelihood contributions improve and none deteriorate. When complete separation is impossible but such a direction exists, the data are quasi-completely separated. Direction d=(0,1) gives scores(1,0,0,1).

Contradictory labels at identical X therefore do not eliminate every separation problem. Those rows block some directions but may leave another improving direction. The lab computes strict minimum margin separately from total nonnegative signed-score improvement.

sizi⊤d≥0 ∀i,∑isizi⊤d>0s_iz_i^\top d\ge0\ \forall i,\qquad\sum_i s_iz_i^\top d>0
학부Undergraduate

19. 평평한 방향과 개선 방향은 다르다19. Flat directions differ from improving directions

모든 X=0이고 Y가 0과 1 한 개씩이라고 합시다. 목적함수는 a만 보고 b는 보지 않습니다. a=0,b는 아무 실수인 전체 가족이 유한 최대를 이룹니다. b 방향으로 아무리 움직여도 두 예측이 바뀌지 않는 것이지 우도를 계속 높이는 것은 아닙니다.

행렬 Z의 영공간은 Zd=0을 만족하는 d의 집합입니다. 이 방향은 모든 부호 점수도 0입니다. 준분리는 적어도 하나의 엄격한 개선을 요구하므로 영공간 벡터를 준분리의 증거로 세면 안 됩니다. 순위 결손과 MLE 비존재를 구분하는 핵심입니다.

비음수 부호 점수를 만드는 모든 방향이 영공간에만 있다면 여기서는 겹침이라고 부릅니다. 양의 유한 가중치의 유한 표본 로지스틱 문제에서 유한 적합 로짓은 존재하고 유일합니다. 계수의 유일성은 추가로 설계 전체 열순위를 요구합니다. 영공간이 있으면 최적계수에 그 전체 공간을 더할 수 있습니다.

ker⁡Z={d:Zd=0},argmax⁡ℓ=θ∗+ker⁡Z under overlap\ker Z=\{d:Zd=0\},\qquad\operatorname{argmax}\ell=\theta^*+\ker Z\ \text{under overlap}

If every X=0 and outcomes are one zero and one one, the objective sees a but not b. The entire finite family a=0, b arbitrary maximizes likelihood. Moving in the b direction changes neither prediction; it does not improve the objective indefinitely.

The nullspace of design Z consists of directions d satisfying Zd=0. Their signed scores all vanish. Quasi separation requires at least one strict improvement, so a nullspace vector is not a separation witness. Rank deficiency and nonexistence are distinct.

Call the data overlapping when every direction with nonnegative signed scores lies in the design nullspace. For the finite positive-weight logistic problem, this gives a unique finite fitted-logit vector. Unique coefficients additionally require full column rank; otherwise add the entire design nullspace to an optimum.

ker⁡Z={d:Zd=0},argmax⁡ℓ=θ∗+ker⁡Z under overlap\ker Z=\{d:Zd=0\},\qquad\operatorname{argmax}\ell=\theta^*+\ker Z\ \text{under overlap}
학부 심화 · 선택Advanced undergraduate · optional

20. 분리를 유한한 선형계획으로 확인한다20. Diagnose separation with finite linear programs

방향 d가 분리를 만들면 양의 배수도 같은 방향을 만듭니다. 크기가 무한히 커지는 중복을 막으려고 각 계수를 −1과 1 사이에 정규화합니다. 이 상자는 실제 계수에 대한 사전 지식이나 Ridge 벌점이 아니라 방향을 찾아보기 위한 계산 규칙입니다.

첫 문제는 모든 부호 점수가 γ 이상이 되게 하면서 γ를 최대화합니다. 최적 γ>0이면 완전 분리입니다. 둘째 문제는 모든 부호 점수를 0 이상으로 두고 그 합을 최대화합니다. 첫 γ가 0이고 둘째 최댓값이 양수면 준분리입니다. 두 값이 0이면 개선 방향이 없습니다.

어떤 양의 가중치를 곱해도 각 행이 좋아지는 방향의 존재는 바뀌지 않습니다. 단, 가중치가 정확 0이 되면 그 행은 목적함수에서 빠져 기하가 달라질 수 있습니다. 실습은 하나 또는 두 입력과 절편, 양의 가용 관측 최대 12행의 모든 최적 꼭짓점을 보존합니다. 표시된 대표 방향은 그중 사전에 정한 사전식 첫 값입니다.

max⁡∥d∥∞≤1,γγ s.t. sizi⊤d≥γ;max⁡∥d∥∞≤1∑isizi⊤d s.t. sizi⊤d≥0\max_{\|d\|_\infty\le1,\gamma}\gamma\ \text{s.t. }s_iz_i^\top d\ge\gamma;\qquad\max_{\|d\|_\infty\le1}\sum_i s_iz_i^\top d\ \text{s.t. }s_iz_i^\top d\ge0

If d separates, any positive multiple does too. Normalize each coefficient into[−1,1] to remove redundant scale. This box is a computational direction normalization, not prior knowledge or a ridge penalty on fitted coefficients.

The first program maximizes γ subject to every signed score being at least γ. A positive optimum means complete separation. The second maximizes the sum of signed scores while requiring each to be nonnegative. Zero strict margin with positive summed improvement means quasi separation; two zero optima mean no improving direction.

Positive row weights do not change whether each likelihood contribution can improve. Making a weight exactly zero can change geometry by removing that row. Our lab supports one/two inputs plus intercept and at most 12 positive complete rows; it retains all optimal vertices and selects the lexicographically first witness only for display.

max⁡∥d∥∞≤1,γγ s.t. sizi⊤d≥γ;max⁡∥d∥∞≤1∑isizi⊤d s.t. sizi⊤d≥0\max_{\|d\|_\infty\le1,\gamma}\gamma\ \text{s.t. }s_iz_i^\top d\ge\gamma;\qquad\max_{\|d\|_\infty\le1}\sum_i s_iz_i^\top d\ \text{s.t. }s_iz_i^\top d\ge0
대학원 연결Graduate bridge

21. 대학원 연결: 겹침이 유한 최대를 주는 이유21. Graduate bridge: why overlap gives a finite optimum

계수 중 영공간 성분은 적합 로짓을 바꾸지 않으므로 설계 행공간에서만 생각합니다. 여기서 길이가 무한히 커지면서 손실은 일정 수준 이하에 머무르는 계수열이 있다고 가정해 봅시다. 각 벡터를 길이로 나누면 단위구면의 부분열이 어떤 비영 방향 d로 수렴합니다.

어떤 관측의 부호 점수가 sᵢzᵢᵀd<0이면 원 계수열에서 그 행의 정답 로짓이 음의 무한대로 가고 로그손실은 양의 무한대로 갑니다. 양의 행 가중치가 있으므로 전체 손실이 유계라는 가정과 모순입니다. 따라서 모든 부호 점수는 비음수여야 합니다.

d는 행공간의 비영 벡터이므로 Zd가 모두 0일 수 없습니다. 적어도 한 점수는 양수여서 개선 분리 방향이 생기고 겹침과 모순입니다. 따라서 행공간의 손실 수준집합은 유계이고 닫혀 있어 최소점이 존재합니다. 유한점에서의 엄격 곡률은 유일한 적합 로짓을 줍니다. 이는 유한 표본의 존재 증명이지 추정치의 대수의 법칙이나 인과 타당성 증명이 아닙니다.

−ℓ(θ)=∑iwilog⁡(1+e−sizi⊤θ),wi>0-\ell(\theta)=\sum_iw_i\log(1+e^{-s_iz_i^\top\theta}),\qquad w_i>0

Ignore coefficient components in the design nullspace because they leave logits unchanged. Suppose a sequence in the design row space has diverging norm but bounded loss. Normalizing its coefficients gives a subsequence converging on the unit sphere to a nonzero direction d.

If any signed score sᵢzᵢᵀd were negative, the corresponding correctly signed logit would tend to negative infinity and its log loss to positive infinity. A fixed positive row weight contradicts bounded total loss. Every signed score must therefore be nonnegative.

A nonzero row-space direction cannot satisfy Zd=0. At least one score is positive, contradicting overlap. Thus row-space loss sublevel sets are bounded and closed, so a minimizer exists; strict curvature gives unique fitted logits. This finite-sample existence proof does not establish a law of large numbers or causal validity.

−ℓ(θ)=∑iwilog⁡(1+e−sizi⊤θ),wi>0-\ell(\theta)=\sum_iw_i\log(1+e^{-s_iz_i^\top\theta}),\qquad w_i>0
학부 심화 · 선택Advanced undergraduate · optional

22. 벌점은 무엇을 바꾸어 해결하는가22. What changes when a penalty resolves the problem?

음의 로그우도에 λ||θ||²/2를 더하고 모든 계수에 λ>0 벌점을 주면 계수 길이가 커질수록 목적함수도 무한히 커집니다. 연속성과 이 강제성으로 최소점이 존재하고, 이차 벌점의 엄격 볼록성으로 유일합니다. 이것은 원래 우도와 다른 문제의 최적해입니다.

절편에는 벌점을 주지 않는 관행을 쓰면 같은 존재 결론을 그대로 적용할 수 없습니다. 모든 Y가 1일 때 기울기를 0으로 두고 절편만 계속 키우면 자료 손실은 감소하고 기울기 벌점은 0인 채입니다. 유한 절편의 최소점은 없습니다.

모든 계수 벌점·기울기만 벌점·집단 확률 Beta 사전·Firth 보정은 서로 다른 규칙입니다. 실제 분석에서는 목적함수, 절편 처리, λ의 정규화, 반복 종료 조건을 기록해야 합니다. 이번 정확 두 집단 실습의 Beta 사후평균을 범용 벌점 로지스틱 결과로 소개하지 않습니다.

J(θ)=−ℓ(θ)+λ2∥θ∥2,λ>0J(\theta)=-\ell(\theta)+\frac\lambda2\|\theta\|^2,\qquad\lambda>0

Adding λ||θ||²/2 with λ>0 on every coefficient makes the objective diverge as coefficient norm grows. Continuity and coercivity give existence; the strictly convex quadratic gives uniqueness. This optimizes a different objective from the original likelihood.

The same conclusion does not automatically apply when the intercept is unpenalized. If all Y=1, set slopes to zero and increase only the intercept. Data loss decreases while the slope penalty remains zero; no finite intercept minimizes the objective.

All-coefficient penalties, slope-only penalties, independent probability Beta priors and Firth correction are different procedures. Record objective normalization, intercept treatment,λ and stopping criteria. Our exact two-group Beta posterior mean is not a general penalized-logistic solver output.

J(θ)=−ℓ(θ)+λ2∥θ∥2,λ>0J(\theta)=-\ell(\theta)+\frac\lambda2\|\theta\|^2,\qquad\lambda>0
대학원 연결Graduate bridge

23. 계수를 구하는 일과 추론하는 일23. Fitting coefficients is distinct from inference

유한 MLE와 정확 최적화를 얻어도 표준오차가 저절로 정당화되지는 않습니다. 고전적인 고정 차원 MLE 정리는 독립 관측 또는 적절한 의존 조건, 올바른 조건부 평균·분포, 식별, 비특이 정보행렬, 모멘트와 국소 규칙성을 둡니다. 여기서 말한 정확 분리 진단은 그 조건 중 일부 자료 기하만 다룹니다.

작업 확률 모형이 틀려도 가중 로그손실을 최소화하는 예측 계수를 정의할 수는 있습니다. 그러나 모형이 맞는 Fisher 역행렬 표준오차와 모형 오지정의 sandwich 분산은 다르고, 군집 의존이 있으면 의존 단위까지 반영해야 합니다. 소표본의 순수 집단에서는 정규 근사를 숫자로 출력하는 일 자체가 부적절할 수 있습니다.

입력 수가 표본과 함께 늘어나는 고차원에서는 고정 차원 정리를 그대로 사용하지 않습니다. 이 장은 우도·존재·확률 평가의 연결을 다루며 이 보관 자료에 일반적인 유의확률이나 정책 효과 신뢰구간을 붙이지 않습니다. 계량경제학의 이산 선택·강건 추론, 뒤 ML 일반화 장으로 연결해서 읽으세요.

A finite MLE and exact optimization do not automatically justify standard errors. Classical fixed-dimension theory requires suitable independence/dependence, correct conditional modeling, identification, nonsingular information, moments and local regularity. Our separation test checks a finite-data geometry issue, not all those assumptions.

Even a misspecified working probability family can define a log-loss-minimizing predictor. Model-based inverse-Fisher and misspecification-robust sandwich variances differ; cluster dependence needs its own dependence unit. Normal approximations can be inappropriate for tiny or pure groups.

When feature dimension grows with sample size, fixed-dimension results need not transfer. This chapter connects likelihood, existence and probability evaluation without attaching generic p-values or policy-effect confidence intervals to the archives. Continue with discrete-choice inference and later generalization chapters.

학부Undergraduate

24. 분리 실습: 반례를 바꾸어 확인한다24. Separation lab: vary a counterexample

실습의 완전 분리·준분리·겹침 예시를 차례로 선택하세요. 먼저 그래프만 보고 왜 그런지 예상한 뒤 부호 점수와 두 선형계획 최적값을 확인합니다. 준분리에서는 최솟값 마진이 0이어도 일부 점수가 양수입니다. 중복 입력의 영공간 방향은 모든 점수가 0입니다.

한 행의 가중치를 양수 1에서 아주 작은 양수로 바꾸어 보세요. 유한표본의 분리 존재는 변하지 않습니다. 정확히 0으로 바꾸면 행이 빠져 결과가 바뀔 수 있습니다. 화면에서 반올림된 가중치 0과 실제 0을 구별해야 하는 이유입니다.

대표 방향 하나만 외우지 말고 펼치기에서 전체 최적 꼭짓점과 설계 영공간을 보세요. 모든 최적 꼭짓점의 볼록결합도 같은 정규화 문제의 최적해입니다. 이 작은 자료의 정확 계산을 수천 개 설명변수에 대한 계산 복잡도나 일반 최적화 성능 주장으로 확대하지 않습니다.

Select complete, quasi and overlap examples. Predict the result from the plot before examining signed scores and the two program optima. Under quasi separation, the minimum margin is zero even though some scores improve; design-null directions instead give every score zero.

Change a positive row weight from 1 to a very small positive number. Separation existence stays unchanged. Setting it exactly zero can change the result by removing a row. A displayed rounded zero must remain distinct from a mathematical zero.

Expand all optimal vertices and the design nullspace rather than memorizing one witness. Every convex combination of optimal vertices remains optimal for the normalized problem. Exact calculation on this small design makes no claim about optimization complexity with thousands of features.

학부Undergraduate

25. 순서를 잘 맞추는 것과 확률을 잘 맞추는 것25. Ranking well differs from predicting probabilities well

위험이 큰 고객을 작은 고객보다 앞에 놓는 일은 순위 문제입니다. 80%라고 예측한 집단에서 실제 사건 비율이 80%에 가까운지는 확률 보정 문제입니다. 두 예측이 (0.2,0.8)과 (0.4,0.6)이면 두 사람의 순위는 같아도 각 확률은 다릅니다.

모집단 보정은 E[Y|P]=P라는 조건부 평균 관계입니다. P는 이미 정한 예측 규칙의 점수 확률입니다. 유한 보정 표본에서는 같은 P별 관측 성공 비율을 계산할 수 있지만, 작은 표본의 일치나 불일치만으로 모집단 등식을 확정하지 않습니다.

엄격히 증가하는 점수 변환은 순서를 보존하므로 순위만 보는 평가는 그대로일 수 있습니다. PAVA처럼 감소하지 않는 변환은 서로 다른 점수를 같은 값으로 합쳐 동률을 만들 수 있습니다. 보정 전후 AUC·정확도·로그손실·Brier를 모두 같은 성능 지표처럼 취급하지 않습니다.

population calibration:E[Y∣P]=P\text{population calibration:}\qquad\mathbb E[Y\mid P]=P

Putting higher-risk customers before lower-risk ones is ranking. Whether events occur about 80% of the time among predictions of 80% is calibration. Forecasts(0.2,0.8) and(0.4,0.6) rank two people identically but assign different probabilities.

Population calibration means E[Y|P]=P for the fixed predictor’s probability P. In a finite calibration sample, we can calculate empirical success frequencies at identical P. Small-sample agreement or disagreement does not by itself establish the population equation.

A strictly increasing transformation preserves ordering and rank-only measures. A merely nondecreasing map such as PAVA can merge distinct scores into ties. AUC, accuracy, log loss and Brier therefore evaluate different properties before and after calibration.

population calibration:E[Y∣P]=P\text{population calibration:}\qquad\mathbb E[Y\mid P]=P
학부Undergraduate

26. Brier 점수의 확률 의미를 증명한다26. Prove what the Brier score rewards

Brier 손실은 (p−Y)²입니다. Y가 0/1이면 0에서 1 사이이고 작을수록 좋습니다. 실제 조건부 사건확률이 q일 때 기대손실은 q(p−1)²+(1−q)p²입니다. 전개해 p²−2pq+q=(p−q)²+q(1−q)를 얻습니다.

두 번째 항은 같은 q에서 예측자가 바꿀 수 없는 사건 불확실성입니다. 첫 항은 p가 q에서 떨어진 거리의 제곱이므로 유일한 최저점은 p=q입니다. 이런 의미에서 Brier는 올바른 확률을 정직하게 보고하도록 하는 엄격 적절 점수입니다. 관측 한 번의 제곱오차가 참 q 자체는 아닙니다.

q=1/4인 설명용 집단에서 p=1/4의 기대손실은 3/16입니다. p=1/2라면 1/4로 늘어 차이는 1/16=(1/2−1/4)²입니다. 실제 표본의 Brier는 이 기대량의 자료 요약이며 모집단·선택·의존 가정을 빼고 오차 없는 성능으로 읽지 않습니다.

E[(p−Y)2∣X]=(p−q)2+q(1−q),q=Pr⁡(Y=1∣X)\mathbb E[(p-Y)^2\mid X]=(p-q)^2+q(1-q),\qquad q=\Pr(Y=1\mid X)

Brier loss is(p−Y)². For binary Y, it lies between zero and one. At a true conditional event probability q, expected loss is q(p−1)²+(1−q)p². Expanding gives(p−q)²+q(1−q).

The second term is event uncertainty that the forecaster cannot change at fixed q. The first is uniquely minimized at p=q. Thus Brier is strictly proper: truthful probability reporting minimizes expected loss. One realized squared error does not reveal q.

In an illustrative q=1/4 group, p=1/4 has expected loss 3/16; forecasting 1/2 gives 1/4. The increase 1/16 equals(1/2−1/4)². An archive’s empirical Brier summarizes data rather than giving population performance without sampling, selection and dependence assumptions.

E[(p−Y)2∣X]=(p−q)2+q(1−q),q=Pr⁡(Y=1∣X)\mathbb E[(p-Y)^2\mid X]=(p-q)^2+q(1-q),\qquad q=\Pr(Y=1\mid X)
학부Undergraduate

27. 같은 점수별 신뢰도·분해능·불확실성27. Reliability, resolution and uncertainty at identical scores

같은 예측 확률 pⱼ를 받은 관측을 한 집단으로 모읍니다. 그 가중합은 Wⱼ, 성공 비율은 qⱼ, 전체 성공 비율은 q̄입니다. 신뢰도 REL은 pⱼ와 qⱼ의 제곱 차이를 집단 가중 평균한 값입니다. 여기서는 작을수록 경험적 보정이 좋습니다.

분해능 RES는 qⱼ가 전체 q̄에서 얼마나 떨어지는지의 가중 제곱 평균입니다. 불확실성 UNC는 q̄(1−q̄)입니다. 같은 확률 점수별로 정확히 묶으면 Brier=REL−RES+UNC가 성립합니다. 집단 안에서는 p가 상수여서 교차항이 사라지는 것이 증명의 핵심입니다.

설명용 두 행의 p=(1/4,3/4),Y=(0,1),가중치 1이면 REL=1/16,RES=1/4,UNC=1/4이므로 Brier=1/16입니다. 숫자 REL이 작은 것만으로 좋은 예측을 모두 설명할 수는 없습니다. 모두에게 전체 비율을 주면 보정이 잘 되어도 집단을 구분하는 분해능이 없을 수 있습니다.

REL=∑jWjW(pj−qj)2,RES=∑jWjW(qj−qˉ)2,BS=REL−RES+qˉ(1−qˉ)\mathrm{REL}=\sum_j\frac{W_j}{W}(p_j-q_j)^2,\quad\mathrm{RES}=\sum_j\frac{W_j}{W}(q_j-\bar q)^2,\quad\mathrm{BS}=\mathrm{REL}-\mathrm{RES}+\bar q(1-\bar q)

Group observations assigned an identical forecast pⱼ. Let group weight be Wⱼ, event frequency qⱼ and overall event frequency q̄. Reliability REL is the weighted mean squared gap between pⱼ and qⱼ; smaller means better empirical calibration here.

Resolution RES is the weighted squared gap between qⱼ and q̄; uncertainty UNC is q̄(1−q̄). With exact identical-score groups, Brier=REL−RES+UNC. Constancy of p within each group removes the cross term in the derivation.

For two unit-weight rows, p=(1/4,3/4), Y=(0,1), REL=1/16, RES=1/4 and UNC=1/4, giving Brier 1/16. Reliability alone does not describe predictive quality. A constant overall-rate forecast can be calibrated while having no resolution across groups.

REL=∑jWjW(pj−qj)2,RES=∑jWjW(qj−qˉ)2,BS=REL−RES+qˉ(1−qˉ)\mathrm{REL}=\sum_j\frac{W_j}{W}(p_j-q_j)^2,\quad\mathrm{RES}=\sum_j\frac{W_j}{W}(q_j-\bar q)^2,\quad\mathrm{BS}=\mathrm{REL}-\mathrm{RES}+\bar q(1-\bar q)
학부 심화 · 선택Advanced undergraduate · optional

28. 넓은 구간으로 묶으면 같은 등식이 아닐 수 있다28. Broad bins need an additional correction

확률이 모두 다르면 그림을 읽기 쉽게 0–0.2,0.2–0.4 같은 구간으로 묶기도 합니다. 그러나 구간 안에서 예측 p가 달라집니다. 각 구간의 평균 예측으로 모든 p를 바꾼 Brier와 원래 Brier는 같은 점수가 아닙니다. 보기 좋은 그림을 만들었다고 원래 점수의 분해 항등식이 자동으로 보존되지 않습니다.

설명용 p=(1/5,4/5),Y=(0,1)을 한 구간에 넣으면 평균 p=평균 Y=1/2입니다. 구간 REL=0,RES=0,UNC=1/4이지만 실제 Brier는 1/25입니다. 구간 내 확률 분산 9/100과 확률·결과 공분산 3/20이 추가되어 1/4+9/100−2×3/20=1/25가 됩니다.

그림의 구간 수·경계·분모와 실제 평가 점수를 따로 기록하세요. 빈 구간의 관측 비율을 0으로 채우지 않습니다. 이 장의 정확 분해는 원래 같은 확률끼리 묶고, 넓은 구간 그림은 읽기 위한 별도 요약으로 취급합니다.

BS=RELbin−RESbin+UNC+∑bWbW{Var⁡b(P)−2Cov⁡b(P,Y)}\mathrm{BS}=\mathrm{REL}_{bin}-\mathrm{RES}_{bin}+\mathrm{UNC}+\sum_b\frac{W_b}{W}\{\operatorname{Var}_b(P)-2\operatorname{Cov}_b(P,Y)\}

When scores differ, plots often use broad intervals such as 0–0.2 and 0.2–0.4. Forecast p then varies within a bin. Replacing every p by its bin mean changes Brier; an attractive binned diagram does not automatically preserve the original decomposition.

Put p=(1/5,4/5), Y=(0,1) into one bin. Both means are 1/2, so binned REL=0, RES=0 and UNC=1/4, yet original Brier is 1/25. Add within-bin forecast variance 9/100 and subtract twice covariance 3/20:1/4+9/100−2×3/20=1/25.

Record bin counts, boundaries and denominators separately from the actual score. An empty bin’s event frequency is undefined, not zero. Our exact decomposition groups identical original probabilities; broader bins are a separate display summary.

BS=RELbin−RESbin+UNC+∑bWbW{Var⁡b(P)−2Cov⁡b(P,Y)}\mathrm{BS}=\mathrm{REL}_{bin}-\mathrm{RES}_{bin}+\mathrm{UNC}+\sum_b\frac{W_b}{W}\{\operatorname{Var}_b(P)-2\operatorname{Cov}_b(P,Y)\}
학부Undergraduate

29. PAVA: 순서를 위반한 이웃을 합친다29. PAVA: pool adjacent violations

원 점수의 순서를 믿고 보정 확률도 감소하지 않게 만들고 싶다고 합시다. 같은 점수끼리 먼저 묶어 각 관측 비율을 구합니다. 점수가 1/5,1/2,4/5인 세 집단의 관측 비율이 1,0,1이고 가중치가 모두 1이면 첫 두 비율이 순서를 위반합니다.

첫 두 집단을 합쳐 성공 1/가중치 2인 1/2로 바꾸면 결과는 (1/2,1/2,1)입니다. 합친 블록 앞에도 위반이 생기면 다시 합칩니다. 이를 인접 위반 통합 알고리즘 PAVA라고 합니다. 블록은 내부의 성공 가중합을 내부 가중합으로 나눈 하나의 확률을 받습니다.

집단 크기가 다르면 비율의 단순 평균을 쓰지 않습니다. 첫 집단 가중치 3,성공 비율 1, 둘째 가중치 1,비율 0을 합치면 (3+0)/(3+1)=3/4입니다. 같은 점수의 서로 다른 정답을 먼저 모아 같은 예측값을 주고 원행 주소도 보존해야 합니다.

q^B=∑j∈BSj∑j∈BWj,q^1≤⋯≤q^J\widehat q_B=\frac{\sum_{j\in B}S_j}{\sum_{j\in B}W_j},\qquad\widehat q_1\le\cdots\le\widehat q_J

Suppose calibration should not decrease as the original score increases. First group identical scores and calculate event frequencies. Three unit-weight groups at scores 1/5,1/2,4/5 with frequencies 1,0,1 violate monotonicity in the first pair.

Pool the first two groups: one success over weight two gives 1/2. The fitted sequence becomes(1/2,1/2,1). If pooling creates an earlier violation, pool again. PAVA assigns each final block its total weighted successes divided by its total weight.

Use weighted counts rather than an unweighted mean of unequal groups. A weight-three group with frequency 1 and weight-one group with frequency 0 pool to 3/4, not 1/2. Identical scores must receive the same fitted value while retaining their original row addresses.

q^B=∑j∈BSj∑j∈BWj,q^1≤⋯≤q^J\widehat q_B=\frac{\sum_{j\in B}S_j}{\sum_{j\in B}W_j},\qquad\widehat q_1\le\cdots\le\widehat q_J
대학원 연결Graduate bridge

30. 대학원 연결: 통합된 평균이 최적인 이유30. Graduate bridge: why pooled means are optimal

보정의 유한 문제는 1/2 ΣWⱼ(q̂ⱼ−qⱼ)²를 최소화하되 q̂₁≤…≤q̂ⱼ를 지키는 것입니다. 양의 집단 가중치가 있으므로 관측 점수에서의 적합값 벡터는 유일합니다. 여러 집단을 같은 값으로 두는 블록 안에서 미분을 0으로 놓으면 블록 가중 평균이 나옵니다.

전체 순서 제약의 최적성을 보려면 λⱼ≥0을 인접 제약의 승수로 두고 λ₀=λJ=0이라 씁니다. 정류 조건은 Wⱼ(q̂ⱼ−qⱼ)+λⱼ−λⱼ₋₁=0입니다. 따라서 λk=Σj≤k Wⱼ(qⱼ−q̂ⱼ)이고, 서로 다른 적합값 사이에서는 보완성 때문에 λk=0입니다.

앞의 (1,0,1)→(1/2,1/2,1)에서는 승수가 (1/2,0)입니다. 모두 비음수이고 첫 두 값이 같은 곳에서만 양수라 최적성 조건을 확인합니다. 실제 실습은 PAVA 블록과 정확 가중 평균을 보여 주며 관측점 사이 확장까지 이 유일성 정리가 정했다고 말하지 않습니다.

λk=∑j≤kWj(qj−q^j)≥0,λk(q^k−q^k+1)=0\lambda_k=\sum_{j\le k}W_j(q_j-\widehat q_j)\ge0,\qquad \lambda_k(\widehat q_k-\widehat q_{k+1})=0

The finite calibration problem minimizes one-half ΣWⱼ(q̂ⱼ−qⱼ)² subject to q̂₁≤…≤q̂J. Positive group weights give unique fitted values at observed scores. Differentiating within a constant block yields its weighted mean.

Introduce nonnegative multipliers λⱼ for adjacent constraints and λ₀=λJ=0. Stationarity gives Wⱼ(q̂ⱼ−qⱼ)+λⱼ−λⱼ₋₁=0, hence λk=Σj≤k Wⱼ(qⱼ−q̂ⱼ). Complementarity requires λk=0 between different fitted values.

For(1,0,1)→(1/2,1/2,1), the multipliers are(1/2,0). They are nonnegative and positive only where adjacent fitted values coincide, verifying optimality. Unique fitted knots do not uniquely specify an extension between unobserved scores.

λk=∑j≤kWj(qj−q^j)≥0,λk(q^k−q^k+1)=0\lambda_k=\sum_{j\le k}W_j(q_j-\widehat q_j)\ge0,\qquad \lambda_k(\widehat q_k-\widehat q_{k+1})=0
학부Undergraduate

31. 관측 사이와 바깥의 확률은 추가 규칙이다31. Probabilities between and beyond knots need another rule

보정 자료에 원 점수 1/5와 4/5만 있고 적합 확률이 1/4와 3/4라고 합시다. 새 원 점수 2/5에 어떤 값을 줄까요? 두 끝 적합값과 단조성만으로는 1/4와 3/4 사이 여러 값이 가능합니다. 점수가 없던 곳의 유일한 확률이 자료에서 자동으로 나오지 않습니다.

이 실습은 관측 매듭점 사이에 선형 보간을 명시적으로 씁니다. 가로 비율은 [(2/5)−(1/5)]/[(4/5)−(1/5)]=1/3이므로 새 값은 1/4+(1/3)(3/4−1/4)=5/12입니다. 계단 확장도 다른 합리적인 계산 규칙일 수 있으나 같은 규칙이라고 부르지 않습니다.

관측 점수 바깥에서는 가장 가까운 끝 확률을 쓰는 clamp 또는 예측 없음(null)을 선택합니다. 보정 자료가 없으면 두 경우 모두 보정 적합은 미정의입니다. 바깥의 정확한 위험이 끝값과 같다는 과학적 가정이 자료로 검증된 것처럼 표시하지 않습니다.

f(p)=(1−t)q^j+tq^j+1,t=p−pjpj+1−pj(pj<p<pj+1)f(p)=(1-t)\widehat q_j+t\widehat q_{j+1},\quad t=\frac{p-p_j}{p_{j+1}-p_j}\quad(p_j<p<p_{j+1})

Suppose calibration observes only original scores 1/5 and 4/5, with fitted probabilities 1/4 and 3/4. What should a new score 2/5 receive? Endpoint fits and monotonicity alone allow many values between 1/4 and 3/4. The archive does not identify a unique probability at every unseen score.

Our lab explicitly uses linear interpolation between observed knots. The horizontal fraction is[(2/5)−(1/5)]/[(4/5)−(1/5)]=1/3, so the prediction is 1/4+(1/3)(3/4−1/4)=5/12. A step extension is another possible rule, but it is a different rule.

Outside the observed range, choose nearest-endpoint clamping or no prediction(null). With no calibration frame, the fitted map is undefined either way. Clamping does not establish that actual risk beyond the observed range equals the endpoint risk.

f(p)=(1−t)q^j+tq^j+1,t=p−pjpj+1−pj(pj<p<pj+1)f(p)=(1-t)\widehat q_j+t\widehat q_{j+1},\quad t=\frac{p-p_j}{p_{j+1}-p_j}\quad(p_j<p<p_{j+1})
학부Undergraduate

32. 보정 실습: 정답을 보기 전에 지도를 고정한다32. Calibration lab: freeze the map before seeing test answers

아래에서 같은 점수의 빈도·PAVA 블록·관측점 사이 질의를 비교하세요. 보정 표본의 정답이 바뀌면 지도는 바뀔 수 있습니다. 그러나 시험 표본의 정답만 바꿨을 때 이미 적합한 지도가 바뀌면 정보가 새어 들어간 구현입니다. 보정과 평가의 역할을 다른 입력으로 유지합니다.

PAVA가 0 또는 1을 반환할 수 있다는 점도 확인하세요. 보정 표본의 제곱손실은 줄어도 나중의 반대 결과에 로그손실이 무한대가 될 수 있습니다. 점수를 유한하게 만들기 위해 자르기를 추가하려면 그 범위도 훈련·보정 단계에서 정한 별도 규칙으로 기록하고 원 결과를 보존합니다.

다른 보정 방법으로는 logit에 선형식을 적합하는 Platt 변환, 양의 온도로 나누는 온도 변환이 있습니다. 어떤 방법이 보정 표본에서 더 유연한지와 시험 성능이 더 좋은지는 다른 질문입니다. 공식 읽기 자료는 방법 비교의 출발점이지 우리 실제 자료에서 개선을 보장하는 증거가 아닙니다.

Compare identical-score frequencies, PAVA blocks and between-knot queries below. Changing calibration answers can change the map. Changing only test answers must not change a previously fitted map. Calibration and evaluation remain separate inputs.

PAVA can return zero or one. Calibration squared loss can decline while a later opposite outcome produces infinite log loss. If clipping is added, it is another explicitly chosen train/calibration-stage rule with declared bounds; retain the original result.

Alternative maps include Platt’s linear transformation of logits and positive temperature scaling. Flexibility on the calibration sample differs from improved test performance. Primary readings motivate comparison rather than guaranteeing improvement in our actual archives.

학부Undergraduate

33. 훈련·보정·시험을 세 역할로 나눈다33. Separate training, calibration and test roles

훈련 정답은 원 모형의 계수 또는 집단 확률을 정합니다. 보정 정답은 이미 고정된 원 점수를 확률로 다시 연결하는 지도를 정합니다. 시험 정답은 두 규칙을 모두 고정한 뒤 성능을 평가합니다. 세 역할을 구분해야 보정까지 포함한 전체 절차를 실제로 시험할 수 있습니다.

훈련 확률을 구한 후 보정 자료의 원 확률과 결과만으로 PAVA를 적합합니다. 시험 자료의 X를 원 모형에 넣고 PAVA 지도를 통과시킨 뒤 마지막에 시험 Y와 비교합니다. 시험 Y를 보고 평활 모수나 보정 여부를 고르면 원래 시험은 또 하나의 선택 자료가 됩니다.

이 장의 원행 순서 기반 배치는 누구나 반복할 수 있는 교육 설계입니다. 독립 무작위 표본 분할이나 시간 순 배포 실험이라는 근거는 없습니다. 배포 표적이 새 고객·미래 달·새 국가 중 무엇인지에 따라 실제 분석의 분할 단위와 시간 기준을 다시 정해야 합니다.

Training answers determine the base coefficients or group probabilities. Calibration answers determine a probability map for already fixed base scores. Test answers evaluate both frozen rules. These roles let us evaluate the entire calibrated procedure.

After fitting training probabilities, fit PAVA using only calibration scores and labels. Pass test X through the base model and fixed map before comparing with test Y. Selecting smoothing or calibration after seeing test answers turns that test into another selection frame.

Our source-order assignments are reproducible teaching designs. They do not establish independent random splitting or a chronological deployment experiment. New-customer, future-month and new-country targets require different split units and information-time rules.

학부Undergraduate

34. 같은 확률에서도 비용에 따라 행동이 바뀐다34. The same probability can imply different actions under different costs

고객 이탈 확률 p=1/4를 예측했다고 합시다. FP1/FN1이면 행동 1의 기대비용은 3/4, 행동 0의 기대비용은 1/4이므로 0을 고릅니다. FP1/FN4이면 행동 0은 비용 1이 되어 1을 고릅니다. 확률 모형을 다시 적합하지 않아도 비용 가정만으로 행동이 달라집니다.

실제 자료의 평균 관측 비용은 각 행에서 정답과 선택 행동을 비교해 오탐이면 cFP,미탐이면 cFN을 더하고 가용 분모로 나눈 값입니다. 이는 모형의 p로 계산한 기대비용과 같은 개념은 아닙니다. 하나는 관측한 시험 결과의 요약, 다른 하나는 확률 모형 아래 결정 시점의 기대량입니다.

예측을 쓰는 사람이 비용을 제시해야 하며 데이터에 있는 이탈 비율 자체가 비용 비율을 정하지 않습니다. 실제 개입의 부작용·성과·고객군별 제약·예산을 추가하면 최적 행동도 달라질 수 있습니다. 이 장의 비용 실습은 오분류 비용이라는 명시된 범위 안에서 계산합니다.

C^=1W∑iwi{cFP1(ai=1,Yi=0)+cFN1(ai=0,Yi=1)}\widehat C=\frac1W\sum_iw_i\{c_{FP}\mathbf1(a_i=1,Y_i=0)+c_{FN}\mathbf1(a_i=0,Y_i=1)\}

Suppose predicted churn probability is 1/4. Under FP 1/FN 1, action 1 costs 3/4 in expectation and action 0 costs 1/4, so choose 0. Under FP 1/FN 4, action 0 costs 1 and choose 1. Changing a cost assumption can change the action without refitting probabilities.

Empirical mean cost compares each chosen action with its observed test answer, adds cFP or cFN for errors and divides by available weight. This differs conceptually from decision-time expected cost under the model probability p. One summarizes realized outcomes; the other uses a probability model.

The decision maker supplies costs; an observed churn rate does not determine their ratio. Intervention consequences, group constraints and budgets can change optimal actions. This lab remains within its explicitly stated misclassification-cost model.

C^=1W∑iwi{cFP1(ai=1,Yi=0)+cFN1(ai=0,Yi=1)}\widehat C=\frac1W\sum_iw_i\{c_{FP}\mathbf1(a_i=1,Y_i=0)+c_{FN}\mathbf1(a_i=0,Y_i=1)\}
학부Undergraduate

35. 추정 확률에도 불확실성이 있다35. Estimated probabilities also have uncertainty

보정 집단 3명 중 2명이 사건을 겪었다면 관측 비율은 정확히 2/3입니다. 그러나 모집단 확률이 정확히 2/3이라는 말은 아닙니다. 서로 독립인 같은 확률의 Bernoulli 표본이라는 추가 모형 아래, 표본 비율의 분산은 q(1−q)/n입니다. 자료 안의 정확 산술과 자료 밖 확률의 불확실성을 구별합니다.

가용 n이 작거나 성공이 0 또는 n이면 단순 정규 근사와 대입 표준오차가 특히 불안정합니다. 성공 0에서 대입 표준오차가 0이 된다고 사건이 불가능하다고 결론 내리지 않습니다. 추가 표본·정확 Binomial 절차·명시한 사전모형 등은 서로 다른 추론 설계입니다.

Beta(a′,b′) 작업 사후분포의 분산은 a′b′/[(a′+b′)²(a′+b′+1)]입니다. 성공 0/실패 4, 반횟수 사전이면 평균 1/10, 분산 3/200입니다. 이는 가정한 사전·표본 모형 안의 사후 불확실성으로, 실제 자료의 독립성이나 빈도주의 구간의 포함확률을 증명하지 않습니다.

Var⁡(p∣Y)=a′b′(a′+b′)2(a′+b′+1)\operatorname{Var}(p\mid Y)=\frac{a^\prime b^\prime}{(a^\prime+b^\prime)^2(a^\prime+b^\prime+1)}

If two of three calibration records experience an event, the empirical fraction is exactly 2/3. That does not make the population probability exactly 2/3. Under an additional iid Bernoulli(q) model, the sample fraction has variance q(1−q)/n. Exact archive arithmetic differs from uncertainty about a probability beyond the archive.

With small n or all-zero/all-one outcomes, normal approximations and plug-in standard errors are particularly fragile. A zero plug-in standard error after zero successes does not make an event impossible. Additional data, exact Binomial procedures and explicit prior models are different inferential designs.

A working Beta(a′, b′) posterior has variance a′b′/[(a′+b′)²(a′+b′+1)]. Zero successes, four failures and a half-count prior give mean 1/10 and variance 3/200. This is uncertainty under the assumed prior/sample model, not evidence of archive independence or frequentist interval coverage.

Var⁡(p∣Y)=a′b′(a′+b′)2(a′+b′+1)\operatorname{Var}(p\mid Y)=\frac{a^\prime b^\prime}{(a^\prime+b^\prime)^2(a^\prime+b^\prime+1)}
학부 심화 · 선택Advanced undergraduate · optional

36. 참 조건부 확률이면 왜 보정되는가36. Why the true conditional probability is calibrated

실제 모집단에서 q(X)=E[Y|X]를 알고 P=q(X)라고 예측한다고 합시다. P는 X의 함수이므로 반복기대 법칙을 쓰면 E[Y|P]=E[E[Y|X]|P]=E[P|P]=P입니다. 참 조건부 확률은 모집단 보정을 만족합니다.

그 역은 성립하지 않습니다. 모두에게 전체 사건비율 q̄를 주는 상수 예측은 보정될 수 있지만 X에 따른 차이를 모두 잃습니다. 보정은 참 조건부 확률을 완전히 회복했다는 조건보다 약합니다. 또한 원 학습자료에서 구한 성공 비율의 정확 일치가 새 모집단의 보정을 증명하지 않습니다.

로지스틱 모형이 올바르고 계수가 참값이라고 아는 상황과 실제로 모형을 적합한 상황을 구별하세요. 유한 MLE·일치 추정·보정·집단별 형평·인과 타당성은 각각 다른 명제입니다. 어떤 가정이 어느 결론을 주는지 문장별로 적어 보는 것이 대학원 공부의 출발점입니다.

P=E[Y∣X]⟹E[Y∣P]=E[E[Y∣X]∣P]=PP=\mathbb E[Y\mid X]\quad\Longrightarrow\quad\mathbb E[Y\mid P]=\mathbb E[\mathbb E[Y\mid X]\mid P]=P

Suppose the population conditional mean is known and we predict P=q(X)=E[Y|X]. Because P is a function of X, iterated expectation gives E[Y|P]=E[E[Y|X]|P]=P. The true conditional probability is population-calibrated.

The converse fails. A constant overall-event-rate predictor can be calibrated while discarding all variation with X. Calibration is weaker than recovering the full conditional probability. Exact empirical agreement in training also does not establish calibration in another population.

Distinguish a correctly specified logistic family at known true coefficients from a fitted model. Finite-MLE existence, consistency, calibration, group fairness and causal validity are different propositions. Listing which assumptions support each conclusion is a useful graduate habit.

P=E[Y∣X]⟹E[Y∣P]=E[E[Y∣X]∣P]=PP=\mathbb E[Y\mid X]\quad\Longrightarrow\quad\mathbb E[Y\mid P]=\mathbb E[\mathbb E[Y\mid X]\mid P]=P
학부Undergraduate

37. 재표집에서도 전체 절차를 반복한다37. Resampling must repeat the entire procedure

원 모형만 교차검증하고 보정 지도는 모든 정답으로 한 번 적합하면 검증 정답이 이미 지도에 들어갑니다. 보정까지 포함한 절차를 평가하려면 각 바깥 평가 분할 안에서 원 모형 훈련과 보정 적합을 다시 해야 합니다. 자료가 작으면 내부 역할 배치도 불안정해질 수 있습니다.

예를 들어 한 바깥 시험 폴드를 떼어 둔 뒤 나머지를 다시 훈련·보정으로 나눕니다. 원 모형을 내부 훈련으로, 지도를 내부 보정으로 적합하고 바깥 폴드에 적용합니다. 입력 표준화·임계값 선택·평활 선택이 있으면 그 적합 역할까지 이 순서 안에 넣습니다.

같은 고객의 여러 기록이나 같은 국가의 여러 해가 있다면 행만 무작위로 섞어 독립 시험이라 부르지 않습니다. 예측 대상과 의존 단위에 맞춘 집단 또는 시간 분할이 필요합니다. 교차적합의 이름을 붙였다는 사실보다 실제 각 정답이 어느 적합에 쓰였는지가 중요합니다.

Cross-validating only the base model while fitting one calibration map with every label leaks evaluation answers into the map. Evaluating the calibrated procedure requires refitting both stages inside each outer split. Small archives can make even the inner role assignment unstable.

Hold out an outer test fold, then divide the remainder into inner training/calibration frames. Fit the base model on inner training, the map on inner calibration, and evaluate the outer fold. Any scaling, threshold selection or smoothing selection must respect its own fitting role inside this pipeline.

Repeated records from the same customer or multiple years of one country need split units matching dependence and the prediction target. Randomly shuffling rows does not certify independent evaluation. Track precisely which answers fit each stage rather than relying on the name cross-fitting.

대학원 연결Graduate bridge

38. 모집단이 바뀌면 어제의 보정도 달라진다38. Calibration can change when the population changes

어떤 고객 구성에서 20%였던 사건이 다른 시기에 40%가 될 수 있습니다. 원 모형이 과거 자료에서 보정되었다는 이유만으로 새 시기의 보정이 유지되는 것은 아닙니다. 입력 구성·측정 방식·정책·행동·결과 확인 지연 중 무엇이 변했는지 구별해야 합니다.

특별히 Y별 X 분포는 같고 사건 사전비율만 πold에서 πnew로 변한다는 label shift를 가정하면 Bayes 규칙으로 새 오즈=과거 오즈×[πnew/(1−πnew)]/[πold/(1−πold)]입니다. 두 사전비율은 0과 1 사이여야 하고 필요한 조건부 밀도도 정의되어야 합니다. 이 식은 아무 변화에나 쓰는 보정 공식이 아닙니다.

πold=1/5,πnew=2/5이면 배율은 8/3입니다. 과거 p=1/4의 오즈 1/3을 곱하면 새 오즈 8/9,확률 8/17입니다. 실제 국가 사례의 한 오류만 보고 label shift가 성립한다고 진단할 수는 없습니다. 새로운 정답과 정보 시점이 있는 검증 자료가 필요합니다.

pnew(x)1−pnew(x)=pold(x)1−pold(x)πnew/(1−πnew)πold/(1−πold)\frac{p_{new}(x)}{1-p_{new}(x)}=\frac{p_{old}(x)}{1-p_{old}(x)}\frac{\pi_{new}/(1-\pi_{new})}{\pi_{old}/(1-\pi_{old})}

An event rate of 20% in one customer mix can become 40% later. Past calibration need not persist. Distinguish shifts in input composition, measurement, policy, behavior and label delay.

Under the special label-shift assumption that X distributions conditional on Y remain unchanged while prior event probability moves from πold to πnew, Bayes’ rule multiplies old odds by[πnew/(1−πnew)]/[πold/(1−πold)]. Both priors must lie strictly inside the unit interval and the needed conditional densities must be defined. This is not a universal shift correction.

With priors 1/5 and 2/5, the multiplier is 8/3. Old p=1/4 has odds 1/3, so new odds are 8/9 and probability 8/17. One error in our country case does not establish label shift. Assess a new labeled frame with known information timing.

pnew(x)1−pnew(x)=pold(x)1−pold(x)πnew/(1−πnew)πold/(1−πold)\frac{p_{new}(x)}{1-p_{new}(x)}=\frac{p_{old}(x)}{1-p_{old}(x)}\frac{\pi_{new}/(1-\pi_{new})}{\pi_{old}/(1-\pi_{old})}
학부Undergraduate

39. 집단 보정과 같은 행동 비율은 다른 기준이다39. Group calibration and equal action rates are different criteria

집단 A의 실제 사건비율은 1/5,집단 B는 4/5이고 각 집단 안에서 상수 확률을 정확히 그렇게 준다고 가정합시다. 두 집단 모두 모집단 보정을 만족합니다. 그러나 문턱 1/2로 행동 1을 고르면 A는 아무도, B는 모두 선택되어 행동 비율은 같지 않습니다.

따라서 보정만 확인해 모든 형평 기준을 충족했다고 말할 수 없습니다. 반대로 같은 선택 비율만 맞춘다고 개인별 위험이나 오분류 비용을 잘 표현했다는 결론도 나오지 않습니다. 어떤 의사결정·권리·제약을 고려하는지에 따라 평가할 질문이 달라집니다.

이 장의 원자료 집단은 소득 임계값·교육연수·불만 여부라는 설명용 입력입니다. 이를 도덕적 가치나 집단 고유 속성의 판단으로 해석하지 않습니다. 기술적 분모·결측·성능 차이를 공개하고, 실제 정책을 평가하려면 해당 집단 정의·개입 영향·이해관계자의 기준을 따로 확인합니다.

Suppose population event rates are 1/5 in group A and 4/5 in group B, and each receives its exact constant group probability. Both groups are calibrated. At a 1/2 action threshold, nobody in A and everybody in B is selected, so action rates differ.

Calibration therefore does not establish every fairness criterion. Equal selection rates alone also do not establish accurate individual risks or low error costs. The relevant questions depend on the actual decision, rights and constraints.

Our archive groups use teaching income cutoffs, schooling and complaint status. They are not moral judgments or claims about inherent group properties. Disclose denominators, missingness and score differences; real policy evaluation additionally needs a justified grouping, intervention consequences and stakeholder criteria.

학부Undergraduate

40. 실제 자료 실습: 세 단계의 결과를 나란히 읽는다40. Actual-data lab: compare all three stages

국가·개인·기업 사례를 바꾸어 훈련의 집단 성공수와 원 확률을 먼저 확인하세요. MLE를 선택하면 국가의 두 확률은 경계값이지만 유한 로지스틱 MLE가 없다고 표시합니다. Beta 반횟수는 다른 추정 규칙이며 유한 로짓으로 표현되는 확률을 줍니다.

보정을 켜면 지도는 보정 역할의 정답만 사용합니다. 원 확률·보정 확률의 시험 Brier·로그손실·비용을 같은 가용 분모에서 나란히 봅니다. 국가의 보정 후 무한 로그손실은 결함을 숨긴 오류 메시지가 아니라 반대 결과에 확률 0을 준 예측 규칙의 수학적 평가입니다.

기본 화면은 짧은 수치와 상태를 보여 주고, 정확 분수·기호 계수·원행 연결은 펼쳐서 읽습니다. 그래프에는 무엇이 관측 비율이고 무엇이 예측 확률인지 구분합니다. 예측 지도를 바꾸어 결과를 탐색하는 학습과 시험 정답을 보지 않고 고른 절차의 최종 평가를 같은 주장으로 쓰지 않습니다.

Switch among country, person and company cases. First inspect training success counts and raw group probabilities. Selecting MLE gives boundary probabilities for the country case while explicitly reporting no finite logistic MLE. Half-count Beta is another estimator with finite logits.

When calibration is enabled, its map uses calibration answers only. Compare raw/mapped test Brier, log loss and cost on the same available frame. The country’s infinite post-calibration log loss is the mathematical evaluation of a zero-probability realized event, not an implementation error to conceal.

Default output gives compact values and statuses; expand exact fractions, symbolic coefficients and source lineage. Distinguish observed frequencies from predictions in plots. Exploratory changes after viewing test answers differ from a final evaluation of a rule chosen without them.

학부Undergraduate

41. 국가 원자료: 임계값은 우리가 정한 정의다41. Country originals: thresholds are our definitions

World Bank 보관 원 JSON에서 2024년 16국의 GDP와 기대수명 원 소수 토큰을 읽습니다. GDP 지표는 NY.GDP.PCAP.KD이며 2015년 불변 USD/명입니다. 기대수명은 SP.DYN.LE00.IN, 출생 시 기대수명·년입니다. 명목 현재 달러 GDP나 개인별 수명이 아닙니다.

GDP 30,000,기대수명 80이라는 두 임계값을 적용해 이진 입력과 정답을 만듭니다. 따라서 연속 원값을 보존해야 기준을 바꾸면 어떤 행이 바뀌는지 알 수 있습니다. 공식 소득 집단이나 건강의 원인 분류를 발견한 것이 아니라 확률 학습을 위한 명시한 사건을 정의했습니다.

훈련 10국은 두 집단이 완전히 나뉘지만 시험 USA는 GDP 기준 이상이고 기대수명 기준 미만입니다. 반례 한 개가 작은 보정 표본의 과도한 확신을 드러냅니다. 이 사례를 경제성장의 기대수명 인과 효과나 국민 개인의 위험 예측으로 확대하지 않습니다.

Read original decimal tokens for 2024 GDP/person and life expectancy in 16 retained World Bank countries. NY.GDP.PCAP.KD uses constant 2015 USD/person; SP.DYN.LE00.IN is life expectancy at birth in years. These are neither current-dollar GDP nor individual lifetimes.

Apply declared cutoffs 30000 and 80 to derive the binary input and answer. Retaining continuous original values lets us inspect which rows change under another cutoff. We define a teaching event rather than discover official income classes or causal health categories.

The ten training countries separate perfectly, but test USA is above the GDP cutoff and below the life-expectancy cutoff. One counterexample exposes overconfidence after a tiny calibration frame. It does not estimate a causal growth effect or individual survival risk.

학부Undergraduate

42. 개인 원자료: 센트·결측·모집단을 함께 읽는다42. Person originals: read cents, missingness and population together

Card 공개 자료의 code_bk.txt는 1976년 NLS Young Men 단면의 남성 3,613관측이라고 설명합니다. 원 nls.dat의 id는 1–5열,ed76은 18–19열,wage76은 128–132열입니다. id 숫자는 원 식별 부호이고 선택 CSV의 sourceRow는 원행 주소라 서로 바꿔 쓰지 않습니다.

wage76은 원 센트/시간이고 점(.)은 미관측입니다. 원 임금 가용수는 3,017인 반면 잘린 로그임금 lwage76의 사전 가용수는 3,010입니다. 결과를 바꿔도 같은 표본이라고 생각하거나 exp(lwage76)로 원 wage76을 복구했다고 쓰면 잘린 관측의 차이를 놓칩니다.

이번 역할의 가용 분모는 훈련 1,933,보정 545,시험 539입니다. 합은 3,017이고 원행 분모 3,613과 다릅니다. 원자료가 남성·특정 코호트라는 범위,단위 가중치라는 분석 규칙,무작위 교육 배정이 아니라는 사실을 함께 적어야 교육 오즈비를 과대 해석하지 않습니다.

Card’s code_bk.txt describes 3613 observations on men in the 1976 NLS Young Men cross-section. In nls.dat, id occupies columns 1–5, ed76 columns 18–19 and wage76 columns 128–132. Original id and the selected CSV’s sourceRow ordinal are different addresses.

wage76 is raw cents/hour and a dot marks missingness. There are 3017 observed raw wages, whereas the dictionary lists 3010 available trimmed log wages, lwage76. Switching outcomes does not preserve the same frame; exponentiating the trimmed log field does not reconstruct the raw-wage archive.

Available role denominators are 1933 training,545 calibration and 539 test, total 3017 rather than 3613 original rows. State the male/cohort scope, unit analysis weights and lack of randomized schooling before interpreting an education odds ratio.

학부Undergraduate

43. 기업 원자료: 9개월 입력과 12개월 결과43. Business originals: nine-month inputs and twelve-month outcomes

UCI Iranian Churn 문서는 12개월 동안 모은 통신사 자료의 입력이 첫 9개월 누적이고 이탈은 12개월 말 상태라고 설명합니다. 남은 3개월은 계획 간격입니다. 이 서술은 정보 창을 알려 주지만 실제 달력 연도·고객별 원시 기록 시각을 새로 만들어 주지는 않습니다.

원 CSV는 3,150행·14열이고 Complains는 불만 없음 0/있음 1,Churn은 비이탈 0/이탈 1입니다. 모든 14열을 선택 파일에 남겨 입력과 정답의 원 코드를 확인합니다. 이 실습은 그중 불만 입력 한 개만 쓰며 다른 열의 예측력을 모두 평가한 종합모형이 아닙니다.

제공자는 행이 고객을 나타낸다고 설명하지만 실제 CSV에 별도 익명 ID 열이 없으므로 원행 주소로 다른 파일과 고객을 합치지 않습니다. 단순 복제 행·반복 고객·자료 수집 편향의 추가 감사와 미래 서비스 검증은 별도 작업입니다. UCI DOI 10.24432/C5JW3Z와 CC BY4.0 출처를 유지합니다.

UCI Iranian Churn documentation describes inputs aggregated over the first 9 months and churn at the end of month 12, with a three-month planning gap. This identifies a documented window but does not supply actual calendar years or individual raw-record timestamps.

The original CSV has 3150 rows and 14 columns. Complains codes no complaint 0/complaint 1; Churn codes retained 0/departed 1. Preserve all 14 original fields to check codes. This lab uses just one complaint input, not a comprehensive model comparison across every feature.

The provider describes customer rows, but no separate anonymous-ID column appears in this CSV. Do not join customers across files using row ordinal. Duplicate/repeated-customer audits, selection assessment and prospective service validation are additional tasks. Retain UCI DOI 10.24432/C5JW3Z and CC BY 4.0 attribution.

학부Undergraduate

44. 학자·영상: 모형·점수·행동을 연결해 읽는다44. Scholar and video: connect models, scores and actions

Trevor Hastie의 Stanford 공식 소개는 비모수 회귀·분류·통계 계산과 생물학·의학·산업의 실제 예측 문제를 연구 분야로 설명합니다. 이를 유명 인물의 방법을 따르면 현실 가정도 자동으로 맞는다는 권위 논증으로 읽지 않습니다. 연구가 던진 질문과 각 자료가 답할 수 있는 질문을 구분합니다.

본문 학습 자료의 Stanford Online “Statistical Learning4.2 Logistic Regression” 영상을 이 사이트 안의 재생창에서 볼 수 있도록 연결합니다. 시청할 과제는 p,오즈,로짓,결정 경계를 각각 적고 exp(b)가 확률비가 아닌 이유를 우리 두 집단 예시로 설명하는 것입니다.

공식 강의·논문에서 본 일반 원리와 원자료에서 확인한 수치를 나란히 놓으세요. 읽기 문제의 답은 아래 참고자료에도 있어 스스로 점검할 수 있습니다. 영상의 특정 설명을 인용할 때는 직접 확인한 구간을 적고, 수치 예시는 원자료인지 설명용 가정인지 표시합니다.

Trevor Hastie’s official Stanford profile describes nonparametric regression, classification, statistical computing and prediction problems in biology, medicine and industry. A method’s prominent authorship does not establish its assumptions in our data. Separate the researcher’s question from what an archive can answer.

The learning materials link Stanford Online’s “Statistical Learning 4.2 Logistic Regression” to an in-page player. While watching, list probability, odds, logit and decision boundary, then explain with our two-group example why exp(b) is not a probability ratio.

Compare the general principles in official lectures/papers with independently reproduced source values. Reading questions include answers for self-checking. When citing a video explanation, record a directly inspected segment; mark numerical examples as original data or illustrative assumptions.

학부Undergraduate

45. 세 실제 사례를 서로 다른 단위로 읽는다45. Read three actual cases at their distinct units

국가 · 완벽한 훈련 분류가 확률 보장을 하지 않는다

국가별 평균값으로 개인의 생존확률을 예측할 수 있을까요? 이 사례는 그런 해석을 하지 않습니다. 보관한 World Bank 원 JSON에서 2024년 16국의 NY.GDP.PCAP.KD(2015년 불변 USD/명)와 SP.DYN.LE00.IN(출생 시 기대수명·년)을 다시 읽습니다. x=1은 GDP 30,000 이상, y=1은 기대수명 80년 이상이라는 학습용 정의입니다. 공식 소득 분류나 자연스러운 건강 경계가 아닙니다.

보관 순서 처음 10국/다음 3국/마지막 3국이 훈련/보정/시험입니다. 결과를 본 뒤 구성한 자료실 실습이므로 사전 등록된 독립 국가 시험이나 미래 예측이라고 부르지 않습니다. 같은 2024년 지표를 쓰며 실제 공표 시점에 이용 가능했는지도 확인하지 않았습니다.

훈련의 x=0 네 국은 y가 모두 0, x=1 여섯 국은 모두 1입니다. 닫힌 확률 공간의 최대값은 (0,1)이지만 유한 로지스틱 계수의 MLE는 존재하지 않습니다. 큰 유한 계수를 컴퓨터가 반환하더라도 정확한 최적해가 생긴 것은 아닙니다.

역할별 원행·공통 가용 분모
역할원행가용미관측
훈련10100
확률 보정330
최종 시험330

각 집단에 성공·실패 가상횟수 1/2씩을 명시하면 Beta 작업모형의 사후평균은 1/10과 13/14입니다. 이것은 MLE를 계산하기 위한 수치 속임수나 Ridge가 아니라 다른 추정 규칙입니다. 보정 자료는 MEX가 (0,0), KOR·SGP가 (1,1)이어서 PAVA가 다시 0과 1을 반환합니다.

훈련 집단 추정 · MLE는 닫힌 확률 공간의 값
x성공가용확률 MLEBeta 반횟수
00401/10
166113/14

시험의 USA는 x=1이지만 기대수명이 78.890243902439년이어서 y=0입니다. VNM·ZAF는 (0,0)입니다. Beta 원 확률의 평균 Brier는 1441/4900, 약 0.294082입니다. PAVA 뒤에는 1/3으로 커지고 USA에 부여한 확률 1 때문에 평균 로그손실은 양의 무한대입니다. 0.999처럼 임의로 잘라 실패를 숨기지 않습니다.

보정 표본의 정확 점수별 비율 · 새로운 모집단 보정의 보장이 아님
원 확률가용성공 비율PAVA 확률
1/10100
13/14211

맞힌 비율은 두 방법 모두 2/3입니다. 따라서 같은 분류 정확도가 같은 확률 품질을 뜻하지 않습니다. FP 비용 1, FN 비용 4라는 별도의 가정 아래 문턱은 1/5이며 이 시험 평균 비용도 1/3입니다. 실제 보건정책 비용이나 인과 후생을 측정한 수치가 아닙니다.

최종 시험 · 소수는 근사 · 비용은 FP1/FN4 가정
추정·보정가용Brier로그손실평균 비용
mle 원래30.333333∞0.333333
mle PAVA30.333333∞0.333333
beta 원래30.2940820.9499260.333333
beta PAVA30.333333∞0.333333

그래프의 두 점은 보정 세 국가의 집단별 관측 비율입니다. 16국 전체를 대표하는 확률 법칙이나 연속적인 국민 개인 자료가 아닙니다. 점 옆의 표에서 분모 1과 2를 먼저 보고, 자료를 늘리거나 다른 역할 배치를 고정한 경우 결과가 어떻게 달라질지 토론하세요.

원자료 선택 CSV · 원행별 확률·역할 · 모든 평가값

개인 · 교육·임금의 조건부 확률과 결측 분모

한 사람의 교육연수가 12년을 넘는지 알면 임금이 시간당 5달러 이상일 확률을 어떻게 요약할까요? David Card의 공개 proximity.zip 원 nls.dat 3,613행과 code_bk.txt를 다시 읽습니다. 원 교육 ed76은 18–19열, 임금 wage76은 128–132열입니다. 임금은 1976년 명목 센트/시간이며, 잘린 로그임금 lwage76을 지수화한 값이 아닙니다.

x=1은 ed76>12, y=1은 원 wage76≥500센트로 정의합니다. 5달러는 이 사례의 설명용 기준이며 빈곤선이나 현재 구매력 기준이 아닙니다. 원 임금 결측 표시 점(.) 596개를 남기고, 결과가 있는 3,017행만 해당 역할의 공통 가용 분모에 넣습니다. 결측을 0달러나 y=0으로 채우지 않습니다.

원행 위치를 0부터 세어 mod11 잔여 0–6은 훈련, 7–8은 보정, 9–10은 시험입니다. 이는 보관 자료에서 반복할 수 있는 규칙이며 무작위 배정이나 시간 순 시험이 아닙니다. 모든 계산은 단위 행 가중치이며 원 NLS 표본 가중치로 모집단을 복원한 분석도 아닙니다.

역할별 원행·공통 가용 분모
역할원행가용미관측
훈련23011933368
확률 보정656545111
최종 시험656539117

훈련 x=0의 968명 중 479명, x=1의 965명 중 628명이 y=1입니다. 두 집단 모두 성공·실패가 있어 유한 이진입력 로지스틱 MLE가 존재합니다. 집단별 MLE 479/968, 628/965에서 절편은 ln(479/489), 기울기는 ln[(628/337)/(479/489)]입니다. 기울기는 확률 차이가 아니라 로그 오즈비입니다.

훈련 집단 추정 · MLE는 닫힌 확률 공간의 값
x성공가용확률 MLEBeta 반횟수
0479968479/968959/1938
1628965628/965419/644

Beta(1/2,1/2) 사후평균은 959/1938과 419/644입니다. 보정에서는 265명 중 133명, 280명 중 185명이 기준 임금 이상입니다. 두 관측 비율 133/265와 37/56은 증가하므로 PAVA가 합치지 않고 그대로 사용합니다. 표의 소수는 읽기 위한 근사이고 전체 파일에 정확 분수를 보존합니다.

보정 표본의 정확 점수별 비율 · 새로운 모집단 보정의 보장이 아님
원 확률가용성공 비율PAVA 확률
959/1938265133/265133/265
419/64428037/5637/56

시험 가용 539행에서 Beta 원 확률의 평균 Brier는 약 0.238258, 로그손실은 약 0.669299입니다. 보정 뒤 약 0.238398, 0.669591로 조금 악화됩니다. 보정 자료를 더 잘 맞추는 것이 별도의 시험 자료에서도 자동으로 개선된다는 뜻은 아닙니다.

최종 시험 · 소수는 근사 · 비용은 FP1/FN4 가정
추정·보정가용Brier로그손실평균 비용
mle 원래5390.2382580.6692990.428571
mle PAVA5390.2383980.6695910.428571
beta 원래5390.2382580.6692990.428571
beta PAVA5390.2383980.6695910.428571

교육은 무작위 배정되지 않았고 연령·지역·가정 배경 등도 이 두 확률 계산에서 조정하지 않았습니다. 교육을 늘렸을 때 개인 임금이 오른다는 인과 효과나 여성·다른 세대·현재 노동시장으로의 일반화가 아닙니다. 사전은 1976 NLS Young Men 단면의 남성 기록이라고 설명합니다.

원자료 선택 CSV · 원행별 확률·역할 · 모든 평가값

기업 · 불만·이탈 확률과 경영 의사결정 비용

고객의 불만 접수 여부로 이탈 확률을 추정하는 작은 기업 사례입니다. UCI Iranian Churn의 원 ZIP에서 Customer Churn.csv 3,150행·14열을 읽고 모두 보존합니다. 문서는 익명 통신사 고객 자료라고 설명하지만 이 CSV에는 독립적인 고객 식별 열이 없습니다. 원행 번호는 복제 확인의 주소이며 서로 다른 고객·독립 표본이라는 보증은 아닙니다.

입력은 원 Complains 코드 0/1, 결과는 Churn 코드 0/1을 바꾸지 않고 사용합니다. 문서상 입력은 첫 9개월 누적, 결과는 12개월 말의 상태이고 3개월은 계획 간격입니다. 달력 연도나 개인별 원시 타임스탬프가 주어지지 않았으므로 실제 서비스에서 미래 정보가 섞이지 않았다는 검증으로 확대하지 않습니다.

0부터 센 원행 mod7 잔여 0–3은 훈련, 4는 보정, 5–6은 시험입니다. 각 1,800/450/900행이며 원 자료에는 결측이 없습니다. 무작위 추출이라는 제공자의 자료 설명과 이 장에서 정한 결정적 역할 배치는 서로 다른 주장입니다.

역할별 원행·공통 가용 분모
역할원행가용미관측
훈련180018000
확률 보정4504500
최종 시험9009000

훈련에서 불만 없음은 1,654건 중 167건, 불만 있음은 146건 중 121건이 이탈했습니다. Beta 반횟수 사후평균은 67/662와 81/98입니다. 이는 불만을 접수시키는 개입의 인과 효과가 아니라 한 이진 입력에 따른 기술적 예측 규칙입니다.

훈련 집단 추정 · MLE는 닫힌 확률 공간의 값
x성공가용확률 MLEBeta 반횟수
01671654167/165467/662
1121146121/14681/98

보정에서는 불만 없음 417건 중 48건, 불만 있음 33건 중 23건이 이탈했습니다. 증가하는 비율 16/139와 23/33이 PAVA의 두 확률이 됩니다. 특히 두 번째 집단의 작은 분모 33을 숨기지 말고 훈련 비율과 나란히 읽어 보세요.

보정 표본의 정확 점수별 비율 · 새로운 모집단 보정의 보장이 아님
원 확률가용성공 비율PAVA 확률
67/66241716/13916/139
81/983323/3323/33

시험에서 Beta 원 확률의 Brier는 약 0.086861, 로그손실은 약 0.317008입니다. 보정 뒤 Brier 약 0.089714, 로그손실 약 0.325585로 악화됩니다. FP1/FN4를 가정한 평균 비용은 둘 다 163/450이며 정확도 407/450도 같습니다. 확률의 값은 바뀌어도 선택한 문턱을 넘는 집단이 같기 때문입니다.

최종 시험 · 소수는 근사 · 비용은 FP1/FN4 가정
추정·보정가용Brier로그손실평균 비용
mle 원래9000.0868350.3169120.362222
mle PAVA9000.0897140.3255850.362222
beta 원래9000.0868610.3170080.362222
beta PAVA9000.0897140.3255850.362222

비용 비율을 바꾸면 문턱이 바뀝니다. 실제 유지 제안의 비용·반응률·할인 후 이익·개입에 따른 이탈 변화는 이 표에 없습니다. 제안 대상을 고르는 정책 평가에는 해당 정보와 별도의 설계가 필요합니다. 이 파일만으로 경영 이익이나 공정한 고객 대우를 증명하지 않습니다.

원자료 선택 CSV · 원행별 확률·역할 · 모든 평가값

Countries · Perfect training classification is not a probability guarantee

Can a national average predict an individual survival probability? This case makes no such claim. Reread the retained original World Bank JSON for 16 countries in 2024: NY.GDP.PCAP.KD in constant 2015 USD/person and SP.DYN.LE00.IN in years at birth. Define x=1 for GDP/person at least 30000 and y=1 for life expectancy at least 80. These are teaching thresholds, not official income categories or natural health cutoffs.

The first 10/next 3/last 3 retained countries train/calibrate/test. This retrospective archive exercise is not a preregistered independent-country or future forecast evaluation. Both indicators concern 2024; their real-time availability has not been established.

All four training x=0 countries have y=0; all six x=1 countries have y=1. The closed probability-space optimum is(0,1), but no finite logistic coefficient vector attains it. A large finite vector returned by software does not create a finite MLE.

Source rows and common available denominators by role
RoleSourceAvailableUnavailable
Training10100
Calibration330
Final test330

Declared success and failure pseudocounts of 1/2 give independent-group working Beta posterior means 1/10 and 13/14. This is a different estimator, not a numerical trick to obtain the MLE or a ridge fit. Calibration contains MEX(0,0) and KOR/SGP(1,1), so PAVA returns 0 and 1 again.

Training group estimates · MLE column is a closed-space probability
xSuccessAvailableClosure MLEBeta half-count
00401/10
166113/14

The test USA has x=1 but life expectancy 78.890243902439 years, so y=0; VNM/ZAF are(0,0). Raw Beta mean Brier is 1441/4900, approximately 0.294082. After PAVA it increases to 1/3, and assigning probability 1 to the wrong USA event gives positive-infinite mean log loss. Do not conceal this failure by arbitrary clipping to 0.999.

Exact calibration-score frequencies · no guarantee of population calibration
Raw probabilityAvailableEvent frequencyPAVA probability
1/10100
13/14211

Both rules classify 2/3 correctly. Equal accuracy therefore does not imply equal probability quality. Under a separate hypothetical FP cost 1/FN cost 4, the inclusive decision threshold is 1/5 and test mean cost 1/3. These are not measured health-policy costs or causal welfare effects.

Final test · decimals approximate · hypothetical FP 1/FN 4 costs
Estimator/mapAvailableBrierLog lossMean cost
mle/raw30.333333∞0.333333
mle/isotonic30.333333∞0.333333
beta/raw30.2940820.9499260.333333
beta/isotonic30.333333∞0.333333

The two plotted points are observed calibration-country group frequencies, not a probability law representative of all countries or continuous individual data. Read denominators 1 and 2 first, and discuss a larger calibration sample or a differently fixed archive split.

Original selected CSV · Row probabilities and roles · Complete evaluation profiles

People · Schooling, wages, conditional probabilities and missing denominators

How can schooling above 12 years summarize the probability of an hourly wage of at least 5 USD? Reread David Card’s public proximity.zip, nls.dat’s 3613 rows and code_bk.txt. Original ed76 occupies columns 18–19 and wage76 columns 128–132. Wage is nominal 1976 cents/hour, not an exponentiated trimmed log-wage field.

Define x=1 for ed76>12 and y=1 for original wage76≥500 cents. Five dollars is a teaching cutoff, not a poverty line or current purchasing-power threshold. Retain 596 original missing-dot wages; only 3017 observed wages enter common available denominators within their roles. Do not replace missing wages with zero dollars or y=0.

With zero-based source position, mod 11 residues 0–6 train,7–8 calibrate and 9–10 test. This reproducible archive rule is neither random assignment nor a chronological test. All rows receive unit analysis weight; this is not a population estimate using the original NLS sampling weights.

Source rows and common available denominators by role
RoleSourceAvailableUnavailable
Training23011933368
Calibration656545111
Final test656539117

Training has 479 successes among 968 x=0 records and 628 among 965 x=1 records. Each group has both outcomes, so the finite binary-input logistic MLE exists. Probabilities 479/968 and 628/965 give intercept ln(479/489) and slope ln[(628/337)/(479/489)]. The slope is a log odds ratio, not a probability difference.

Training group estimates · MLE column is a closed-space probability
xSuccessAvailableClosure MLEBeta half-count
0479968479/968959/1938
1628965628/965419/644

Beta(1/2,1/2) posterior means are 959/1938 and 419/644. Calibration has 133 successes among 265 and 185 among 280. Frequencies 133/265 and 37/56 increase, so PAVA retains both without pooling. Decimal displays are approximations; the complete files retain exact fractions.

Exact calibration-score frequencies · no guarantee of population calibration
Raw probabilityAvailableEvent frequencyPAVA probability
959/1938265133/265133/265
419/64428037/5637/56

Among 539 available test rows, raw Beta mean Brier is approximately 0.238258 and log loss 0.669299. After calibration these are approximately 0.238398 and 0.669591: slightly worse. Improving calibration-sample fit does not guarantee improvement on a separate test frame.

Final test · decimals approximate · hypothetical FP 1/FN 4 costs
Estimator/mapAvailableBrierLog lossMean cost
mle/raw5390.2382580.6692990.428571
mle/isotonic5390.2383980.6695910.428571
beta/raw5390.2382580.6692990.428571
beta/isotonic5390.2383980.6695910.428571

Schooling was not randomized; age, region and family background are not controlled in these two probabilities. They do not identify a wage intervention effect or generalization to women, other generations or today’s labor market. The dictionary describes men in the 1976 NLS Young Men cross-section.

Original selected CSV · Row probabilities and roles · Complete evaluation profiles

Business · Complaints, churn probabilities and decision costs

This small business case predicts customer churn from recorded complaints. Read all 3150 rows and 14 original columns of Customer Churn.csv from UCI Iranian Churn’s retained ZIP. Documentation describes anonymous telecom customers, but the CSV supplies no separate customer-ID column. Row ordinals locate reproducible records; they do not prove distinct independent customers.

Keep original Complains 0/1 and Churn 0/1 codes. Documentation aggregates inputs over the first 9 months and labels churn at the end of month 12, leaving a three-month planning gap. Calendar years and individual raw timestamps are not supplied, so do not claim a verified prospective service pipeline.

Zero-based source-position mod 7 residues 0–3 train,4 calibrates and 5–6 test:1800/450/900 rows, with no original missing values. The provider’s description of collection and our deterministic archive-role assignment are separate claims.

Source rows and common available denominators by role
RoleSourceAvailableUnavailable
Training180018000
Calibration4504500
Final test9009000

Training churn counts are 167/1654 without complaints and 121/146 with complaints. Half-count Beta posterior means are 67/662 and 81/98. This descriptive prediction rule does not identify the effect of making someone submit a complaint.

Training group estimates · MLE column is a closed-space probability
xSuccessAvailableClosure MLEBeta half-count
01671654167/165467/662
1121146121/14681/98

Calibration churn counts are 48/417 and 23/33. Increasing frequencies 16/139 and 23/33 become PAVA’s two probabilities. Keep the second group’s small denominator 33 visible beside its training frequency.

Exact calibration-score frequencies · no guarantee of population calibration
Raw probabilityAvailableEvent frequencyPAVA probability
67/66241716/13916/139
81/983323/3323/33

Raw Beta test Brier is approximately 0.086861 and log loss 0.317008. Calibration worsens them to approximately 0.089714 and 0.325585. Under hypothetical FP 1/FN 4, both mean costs remain 163/450 and accuracies 407/450, because both rules put the same groups above the selected threshold.

Final test · decimals approximate · hypothetical FP 1/FN 4 costs
Estimator/mapAvailableBrierLog lossMean cost
mle/raw9000.0868350.3169120.362222
mle/isotonic9000.0897140.3255850.362222
beta/raw9000.0868610.3170080.362222
beta/isotonic9000.0897140.3255850.362222

Changing the cost ratio changes the threshold. This archive does not supply actual retention-offer costs, response rates, discounted profits or intervention-induced churn changes. Evaluating a targeting policy requires those quantities and another design; these scores do not establish business profit or fair treatment.

Original selected CSV · Row probabilities and roles · Complete evaluation profiles

학부Undergraduate

46. 공개 파일로 직접 재현하는 실습46. Reproduce the chapter from public files

선택 CSV 세 개와 Python 또는 R 프로그램을 같은 폴더 구조에 둡니다. Python은 표준 라이브러리만 쓰며 정수 빈도·확률·Brier·비용은 Fraction으로 계산합니다. R은 외부 패키지 없이 수치 근삿값을 만듭니다. 원 ZIP과 코드 사전은 원자료 선택을 감사할 때 따로 읽습니다.

순서는 원값·단위 확인→고정된 사건과 역할 적용→가용 분모와 성공수 집계→훈련 확률→보정 지도→각 역할 평가입니다. 가공 파일에는 18개 역할·집단 집계,6개 훈련 집단 추정,12개 보정 매듭,36개 평가 프로필,12개 기호 계수,6,779개 원행 확률을 남깁니다. 합친 프로필을 원자료 자체라고 부르지 않습니다.

먼저 반횟수를 1/2에서 1로 바꾸어 확률이 어떻게 바뀌는지 예상하고 별도 출력 폴더로 재계산하세요. 그 뒤 시험 손실을 확인합니다. 원 결과를 덮어쓰지 말고 추정 규칙을 바꾼 이유와 시험을 이미 봤다는 사실을 기록하세요. 숫자 재현과 새로운 자료에서의 일반화는 서로 다른 과제입니다.

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

Place the three selected CSVs and Python or R program in the documented folder structure. Python uses only the standard library and Fraction for counts, probabilities, Brier and costs. Base R produces numerical approximations without packages. Original ZIPs and dictionaries separately audit source selection.

The sequence is original values/units→fixed events/roles→available counts→training probabilities→calibration map→role scores. Derived files retain 18 role-group summaries,6 training estimates,12 calibration knots,36 score profiles,12 symbolic coefficients and 6779 row probabilities. These derived profiles are not the original archive itself.

Before recomputing, manually change a half-count from 1/2 to 1 and predict its effect on probabilities. Save the altered exercise in another output folder, then inspect test loss. Preserve original results and record that test answers were already visible. Reproduction differs from generalization to new data.

Python · R · Original sources,units and derivation

대학원 연결Graduate bridge

47. 대학원 연결: 로그손실과 KL 간격47. Graduate bridge: log loss and the KL gap

참 사건확률 q∈(0,1)에서 예측 p∈(0,1)의 기대 로그손실은 −q logp−(1−q)log(1−p)입니다. 미분은 (p−q)/[p(1−p)]이므로 q보다 작은 p에서는 감소,큰 p에서는 증가해 유일한 최저점은 p=q입니다. 확률을 정직하게 말하도록 하는 또 하나의 엄격 적절 점수입니다.

참값 q에서의 손실을 빼면 q log(q/p)+(1−q)log[(1−q)/(1−p)]가 됩니다. 이것이 두 Bernoulli 분포의 KL 간격이며 0 이상입니다. 경계 q=0,1은 0log0=0의 연속 확장으로 다루고, 불가능 예측에 반대 결과가 양수 확률로 나오면 기대손실은 무한대입니다.

실제 조건부 확률 q(X)가 로지스틱 가족에 들어 있지 않으면 로그손실 최소 계수는 그 가족 안에서의 최선 근사일 수 있습니다. 잘못된 모형에서 존재·식별·일치성·강건 추론의 결론을 따로 검토해야 합니다. 다음 최근접 이웃 장은 선형 로짓 제약 대신 국소 이웃으로 확률과 평균을 요약하는 선택을 비교합니다.

R(p;q)−R(q;q)=qlog⁡qp+(1−q)log⁡1−q1−p=DKL(Bern⁡(q)∥Bern⁡(p))≥0R(p;q)-R(q;q)=q\log\frac qp+(1-q)\log\frac{1-q}{1-p}=D_{KL}(\operatorname{Bern}(q)\|\operatorname{Bern}(p))\ge0

At true q∈(0,1), expected log loss for p∈(0,1) is−q logp−(1−q)log(1−p). Its derivative(p−q)/[p(1−p)] is negative below q and positive above q, giving the unique minimum p=q. Log loss is another strictly proper score.

Subtracting loss at q leaves q log(q/p)+(1−q)log[(1−q)/(1−p)], the nonnegative KL divergence between Bernoulli distributions. Extend q=0 or 1 continuously with 0 log 0=0. An impossible forecast for an event with positive true probability gives infinite expected loss.

If q(X) is outside the logistic family, the minimum-log-loss coefficients may only be the best approximation inside that family. Existence, identification, consistency and robust inference then need separate assumptions. The next nearest-neighbour chapter compares local probability/mean summaries with a linear-logit restriction.

R(p;q)−R(q;q)=qlog⁡qp+(1−q)log⁡1−q1−p=DKL(Bern⁡(q)∥Bern⁡(p))≥0R(p;q)-R(q;q)=q\log\frac qp+(1-q)\log\frac{1-q}{1-p}=D_{KL}(\operatorname{Bern}(q)\|\operatorname{Bern}(p))\ge0
학부Undergraduate

48. 원문 읽기와 다음 단계의 자가 점검48. Primary reading and a self-check before the next step

CMU Shalizi 강의의 조건부 확률·우도·분리 설명에서 우리 기호 η,p,z,w로 식을 다시 써 보세요. 가중치가 없는 원식에 가중치를 넣었다면 정수 빈도인지 분석 가중치인지도 적습니다. 두 집단의 닫힌 해가 일반 연속 입력의 해를 대신하지 않는 이유를 설명할 수 있어야 합니다.

Zadrozny–Elkan의 PAV 절에서는 관측 점수의 단조 적합과 새로운 점수에 값을 주는 확장을 구별합니다. Guo 등의 보정 논문에서는 원 모형을 고정한 뒤 별도 자료로 보정하는 순서를 봅니다. 논문의 특정 경험적 우열을 우리 세 실제 자료의 성능 보장으로 옮기지 않습니다.

스스로 확인할 질문은 네 가지입니다. 순수 집단에서 유한 MLE가 없는 이유를 설명할 수 있나요? 오즈비와 확률 차이를 계산할 수 있나요? 보정의 정답과 시험의 정답을 분리했나요? 성능 수치에서 가용 분모·확률 품질·행동 비용을 구별했나요? 아래 완전 풀이를 이용해 부족한 절로 돌아가세요.

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

Rewrite conditional-probability, likelihood and separation equations from Shalizi’s CMU notes in our η, p, z, w notation. If adding weights, declare integer frequency versus analysis weights. Explain why a two-group closed form does not solve the general continuous-input model.

In Zadrozny–Elkan’s PAV discussion, distinguish fitted values at observed scores from extension to new ones. In Guo et al., trace calibration after freezing the base model. A paper’s empirical method ranking does not guarantee performance on our three archives.

Check four questions: why is there no finite MLE in a pure group? Can you calculate an odds ratio separately from a probability difference? Did calibration and test answers remain separate? Do score denominators, probability quality and action costs answer different questions? Use the worked solutions to return to any weak step.

Python · R · Original sources,units and derivation

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 ml05-reproduce.py
Rscript --vanilla --encoding=UTF-8 ml05-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.

로지스틱 회귀에서 확률과 결정 경계를 구별하기Separate logistic probabilities from decision boundaries

Stanford Online · Statistical Learning4.2 · 2022

시그모이드와 오즈 해석을 본문 식에 대응시키고, 확률을 0/1 결정으로 바꾸는 추가 규칙을 적어 보세요.Match sigmoid and odds interpretations to our equations, and identify the extra rule converting a probability to a 0/1 action.

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

보고 읽은 뒤 답하기Respond after watching/reading 오즈가 두 배가 되면 확률도 두 배인가요?Does doubling odds double probability?

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

아닙니다. p=1/4의 오즈는 1/3이며 두 배 뒤 확률은 (2/3)/(1+2/3)=2/5입니다.No. Probability 1/4 has odds 1/3; doubling gives probability(2/3)/(1+2/3)=2/5.

Trevor Hastie · 통계적 학습과 실제 예측 문제Trevor Hastie · Statistical learning and prediction problems

Stanford Department of Statistics · official profile

공식 소개에서 비모수 회귀·분류·통계 계산 연구를 확인하고, 이 장에서 점수·확률·행동을 구별한 이유를 연결하세요.Read the official profile’s nonparametric regression, classification and statistical-computing interests, and connect them to our score/probability/action distinction.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 유명한 연구자의 알고리즘을 쓰면 실제 자료의 가정도 성립하나요?Does a method’s authorship establish its assumptions in our data?

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

아닙니다. 자료의 모집단·가용 시점·결측·배포 조건을 별도로 확인해야 합니다.No. Population, information timing, missingness and deployment conditions require separate evidence.

Zadrozny–Elkan · 순위 점수를 확률로 바꾸는 문제Zadrozny–Elkan · Turning ranking scores into probabilities

KDD2002 · original paper,§§2–3

§2–3의 보정과 PAV 목적을 읽습니다. 본 장의 유한 점수에서 PAVA 적합과, 관측하지 않은 점수의 선형 보간·끝값 확장을 구별하세요.Read calibration and PAV objectives in§§2–3. Distinguish our finite-knot PAVA fit from our declared linear interpolation and endpoint extrapolation.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading PAVA가 관측 점수의 적합값을 정하면 사이의 모든 점수 확률도 유일한가요?Do fitted PAVA knots uniquely determine probabilities between them?

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

아닙니다. 관측점 사이에는 여러 단조 확장이 가능합니다. 이 실습은 선형 보간을 명시적으로 선택합니다.No. Several monotone extensions agree at the knots. This lab explicitly chooses linear interpolation.

Guo 등 · 정확도와 확률 보정은 다른 평가다Guo et al. · Accuracy and calibration are different evaluations

ICML2017 · original paper,§4.1–4.2

고정된 원 모형 뒤 보정용 자료에서 Platt·온도 변환을 학습하는 순서를 읽습니다. 신경망 사례의 경험 결과를 이 장 국가·임금·고객 자료의 보장으로 옮기지 않습니다.Read the sequence of fitting Platt/temperature transformations on calibration data after freezing the base model. Neural-network empirical results do not guarantee improvement in our country, wage or customer archives.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 양의 온도로 이진 logit을 나누면 1/2 결정이 바뀌나요?Does dividing binary logits by a positive temperature change the 1/2 decision?

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

아닙니다. 부호는 같지만 확률과 로그손실은 바뀔 수 있습니다. 다른 비용 문턱에서는 행동도 달라질 수 있습니다.No. The sign stays fixed while probabilities and log loss can change. Actions can change at other cost thresholds.

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

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

1. 확률과 오즈를 함께 적기Write probability and odds together

설명용 같은 조건의 열 번 중 사건이 여섯 번 관측되었습니다. 단순 성공 비율 p,오즈 o,로그 오즈를 계산하고 이 관측으로 다음 사건의 정답을 확정할 수 있는지 설명하세요.

In ten illustrative comparable cases, an event occurs six times. Calculate the empirical probability p, odds o and log odds. Does this archive determine the next answer with certainty?

풀이와 확인할 이유Solution and explanation

전체 열 번이 분모이므로 p=6/10=3/5입니다. 비사건은 네 번이라 오즈는 6/4=3/2,로그 오즈는 ln(3/2)≈0.405465입니다. 확률의 분모와 오즈의 분모가 다른 점을 먼저 확인합니다.

다음 정답은 여전히 0 또는 1입니다. 관측 비율 3/5는 자료 요약이며,모집단 조건과 불확실성을 추가 검토하지 않고 다음 사건의 필연적 결과나 정확한 참 확률로 선언할 수 없습니다.

All ten cases form the probability denominator: p=6/10=3/5. Four are nonevents, so odds are 6/4=3/2 and log odds ln(3/2)≈0.405465. The two denominators differ.

The next answer is still 0 or 1. This empirical fraction summarizes the archive; it does not establish a certain next outcome or an exact population probability without further assumptions.

2. 오즈에서 확률로 돌아오기Recover probability from odds

사건 오즈가 3/2입니다. 확률을 구하고,오즈를 두 배인 3으로 바꾸었을 때 확률과 원래 확률의 차이를 계산하세요.

Event odds are 3/2. Recover the probability, then double odds to 3 and calculate the new probability and its change.

풀이와 확인할 이유Solution and explanation

o/(1+o)를 쓰면 원 확률은 (3/2)/(5/2)=3/5입니다. 새 오즈 3의 확률은 3/4입니다. 차이는 3/4−3/5=3/20입니다.

오즈는 두 배가 되었지만 확률비는 (3/4)/(3/5)=5/4입니다. 확률을 단순히 두 배인 6/5로 만들면 확률 범위를 벗어나며 잘못된 계산입니다.

Using o/(1+o), the original probability is(3/2)/(5/2)=3/5. Odds 3 give probability 3/4, a change of 3/20.

The odds doubled, but the probability ratio is 5/4. Doubling the probability to 6/5 would violate its range and confuse the two scales.

3. 사건의 부호를 뒤집기Reverse the event label

원 정의 Y=1의 확률은 4/5입니다. 새 정답 Z=1−Y를 정의할 때 확률·오즈·로짓이 어떻게 바뀌나요? 원 오탐·미탐 비용을 그대로 같은 이름에 둘 수 있는지도 설명하세요.

The original event Y=1 has probability 4/5. Define Z=1−Y. Find the new probability, odds and logit, and explain what happens to false-positive/false-negative cost labels.

풀이와 확인할 이유Solution and explanation

새 사건 확률은 1/5,오즈는 (1/5)/(4/5)=1/4,로짓은 −ln4입니다. 원 오즈 4는 역수가 되고 로그 오즈 ln4는 부호가 바뀝니다.

새 사건의 오탐은 원 사건의 미탐과 대응하므로 원 비용을 같은 이름에 무조건 붙이면 다른 의사결정 문제가 됩니다. 무엇을 사건이라고 정했는지와 행동 의미를 먼저 다시 적어야 합니다.

The new probability is 1/5, odds 1/4 and logit−ln 4. Original odds 4 become their reciprocal, and the original logit ln 4 changes sign.

A false positive for the reversed event corresponds to the original event’s false negative. Keeping cost names without translating actions changes the decision problem.

4. 오즈비·확률비·확률 차이Odds ratio, probability ratio and probability difference

두 집단 사건확률은 p₀=1/4,p₁=1/2입니다. 오즈비,확률비,확률 차이와 이진 로지스틱 기울기를 모두 계산하세요.

Two groups have p₀=1/4, p₁=1/2. Calculate the odds ratio, probability ratio, probability difference and binary-logistic slope.

풀이와 확인할 이유Solution and explanation

오즈는 1/3과 1입니다. 따라서 오즈비는 3,확률비는 2,확률 차이는 1/4입니다. 로지스틱 기울기는 오즈비의 자연로그 ln3≈1.098612입니다.

같은 두 확률에서 나온 수치라도 서로 다릅니다. 기울기 ln3이나 오즈비 3을 “확률이 3만큼 증가한다”로 읽지 않습니다.

The odds are 1/3 and 1. Their ratio is 3, the probability ratio 2, and probability difference 1/4. The logistic slope is ln 3≈1.098612.

These different quantities come from the same probabilities. Neither ln 3 nor odds ratio 3 means that probability increases by 3.

5. 계수에서 두 집단 확률 계산Calculate two group probabilities from coefficients

설명용 모형은 p(X)=σ(a+bX),X∈{0,1},a=−ln3,b=ln9입니다. p₀,p₁,확률 차이와 오즈비를 구하세요.

Let p(X)=σ(a+bX), X∈{0,1}, a=−ln 3, b=ln 9. Find both probabilities, their difference and the odds ratio.

풀이와 확인할 이유Solution and explanation

x=0의 로짓은 −ln3라 오즈 1/3,확률 1/4입니다. x=1의 로짓은 −ln3+ln9=ln3라 오즈 3,확률 3/4입니다. 차이는 1/2입니다.

exp(b)=9이며 실제 두 오즈의 비 3/(1/3)와 같습니다. 계수는 정확한 로그 표현이고 소수로 반올림해야만 존재하는 값이 아닙니다.

At x=0, logit−ln 3 gives odds 1/3 and probability 1/4. At x=1,−ln 3+ln 9=ln 3 gives odds 3 and probability 3/4. The difference is 1/2.

exp(b)=9 agrees with odds ratio 3/(1/3). The exact logarithmic coefficient need not be replaced by a rounded decimal.

6. 미분과 한 단위 차이를 구별하기Distinguish a derivative from a full-unit change

연속 입력 모형 p=σ(2X)의 X=0에서 국소 기울기를 구하세요. X가 0에서 1로 바뀌는 정확 확률 차이와 비교하세요.

For continuous-input p=σ(2 X), find the local slope at X=0 and compare it with the exact change from X=0 to 1.

풀이와 확인할 이유Solution and explanation

X=0에서 p=1/2이므로 dp/dX=2×(1/2)(1/2)=1/2입니다. 정확한 한 단위 차이는 σ(2)−1/2=e²/(1+e²)−1/2≈0.380797입니다.

미분은 아주 작은 변화의 일차 근사입니다. 0에서 1까지 기울기가 변하기 때문에 시작점 기울기 1/2를 전체 차이로 쓰면 과대 계산합니다.

At zero, p=1/2, so dp/dX=2×(1/2)(1/2)=1/2. The exact full-unit change is e²/(1+e²)−1/2≈0.380797.

A derivative is a first-order small-change approximation. The slope changes along the interval, so using its starting value as the full change overstates this example.

7. 비용에 따른 행동 선택Choose an action under stated costs

사건 확률 p=1/4,정답 행동 비용은 0입니다. (i) FP1/FN1,(ii) FP1/FN4에서 행동 0과 1의 기대비용을 계산해 고르세요.

At probability 1/4, correct actions cost zero. Compare action 0 and action 1 under(i)FP 1/FN 1 and(ii)FP 1/FN 4.

풀이와 확인할 이유Solution and explanation

행동 1의 비용은 두 경우 모두 1×(1−1/4)=3/4입니다. (i) 행동 0은 1×1/4=1/4라 0이 낫습니다. (ii) 행동 0은 4×1/4=1이라 1이 낫습니다.

문턱으로도 각각 1/2와 1/5를 얻어 같은 결정을 확인합니다. 사건확률 자체는 바뀌지 않았으며 행동만 비용 가정에 따라 달라졌습니다.

Action 1 costs 3/4 in both cases. In(i), action 0 costs 1/4, so choose 0. In(ii), action 0 costs 1, so choose 1.

Thresholds 1/2 and 1/5 confirm the same decisions. Probability stays fixed; the cost assumption changes the action.

8. 동률과 영비용 처리Handle ties and zero costs

FP1/FN4,p=1/5에서 두 행동의 비용을 구하세요. 동률에 행동 1을 고르는 규칙을 적용하세요. 이어 FP=FN=0이면 어떻게 처리하나요?

With FP 1/FN 4 and p=1/5, calculate both action costs and apply an action 1 tie rule. What if both costs are zero?

풀이와 확인할 이유Solution and explanation

행동 1의 비용은 4/5,행동 0의 비용도 4/5입니다. 비용상 두 행동이 모두 최적이고,명시한 동률 규칙이 행동 1을 선택합니다. 이 선택이 유일하게 비용이 작은 행동이라는 뜻은 아닙니다.

두 비용이 0이면 모든 p에서 모든 행동이 동률입니다. 문턱을 0/0으로 계산하지 않고 동률 규칙을 직접 적용합니다.

Both expected costs equal 4/5. Both actions minimize cost; the declared tie rule selects 1 without making it uniquely cheaper.

When both costs vanish, all actions tie at every p. Do not calculate a 0/0 threshold; apply the tie rule directly.

9. 반올림된 확률 1의 로그손실Log loss when probability rounds to one

유한 로짓 η=1000의 로지스틱 모형이 화면에서 p=1로 보입니다. 실제 정답 Y=0일 때 수학적 로그손실이 무한대인지,어떤 식으로 계산해야 하는지 설명하세요.

A finite logistic logitη=1000 displays p=1. If Y=0, is mathematical log loss infinite? Give a stable expression.

풀이와 확인할 이유Solution and explanation

유한 η에서는 1−p=1/(1+e¹⁰⁰⁰)>0입니다. 따라서 손실은 −log(1−p)=log(1+e¹⁰⁰⁰)=1000+log(1+e⁻¹⁰⁰⁰)로 유한하며 1000보다 조금 큽니다.

화면 p에서 1−p를 계산하면 반올림 때문에 0이 되어 잘못 무한대로 처리할 수 있습니다. 작은 꼬리와 softplus 표현을 사용하고 표시 반올림과 수학적 경계를 구별합니다.

At finiteη, the complement 1/(1+e¹⁰⁰⁰) is positive. Loss equals log(1+e¹⁰⁰⁰)=1000+log(1+e⁻¹⁰⁰⁰), finite and slightly above 1000.

Subtracting the displayed p from 1 can create a spurious zero and infinity. Preserve the small tail and softplus expression; display rounding is not a mathematical boundary.

10. 단위와 결측이 있는 사건 정의Define labels with units and missingness

가상 원기록 A의 교육은 12년,1976년 임금은 500센트/시간입니다. B의 교육은 13년,임금은 미관측 점(.)입니다. x=1은 교육>12,y=1은 원 임금≥500센트일 때 두 행의 x,y와 단위 가중치의 가용 분모를 구하세요.

Illustrative record A has 12 years of schooling and 1976 wage 500 cents/hour. B has 13 years and missing-dot wage. Define x=1 for schooling>12 and y=1 for wage≥500 cents. Find labels and the unit-weight complete denominator.

풀이와 확인할 이유Solution and explanation

A는 x=0,y=1입니다. 초과와 이상이 달라 교육 12는 0이고 임금 500은 1입니다. 500센트는 1976년 명목 5달러/시간입니다. B는 x=1,y는 미관측이며 0으로 채우지 않습니다.

두 행을 원자료 틀에는 남기지만 공통 입력·결과 가용 분모는 A 한 행,즉 W=1입니다. 임금이 없는 B를 y=0으로 넣으면 성공 비율과 손실이 다른 문제로 바뀝니다.

A has x=0, y=1: strictly above 12 differs from at least 500. Five hundred cents means nominal 1976 pay of 5 USD/hour. B has x=1 and missing y, not zero.

Keep both source rows, but the complete input/outcome denominator contains only A, so W=1. Filling B with y=0 changes both the event fraction and the scoring problem.

11. 두 행의 작업우도와 평균 로그손실Two-row working likelihood and mean log loss

조건부 독립 Bernoulli 작업모형에서 두 관측 정답은 Y=(0,1),예측 확률은 p=(1/4,3/4),가중치는 모두 1입니다. 우도·음의 로그우도·평균 로그손실을 구하세요.

Under a conditional-independent Bernoulli working model, Y=(0,1), p=(1/4,3/4), with unit weights. Calculate likelihood, negative log likelihood and mean log loss.

풀이와 확인할 이유Solution and explanation

첫 관측은 비사건이므로 1−1/4=3/4를,둘째는 사건이므로 3/4를 씁니다. 곱 우도는 9/16입니다. 음의 로그우도는 −ln(9/16)=2ln(4/3)입니다.

가용 가중치 W=2로 나누면 평균 로그손실은 ln(4/3)≈0.287682입니다. 이 계산은 관측 정답의 확률 곱이며 계수의 사후확률이 아닙니다.

Use 3/4 for the first nonevent and 3/4 for the second event. Likelihood is 9/16; negative log likelihood is 2 ln(4/3).

Divide by available weight 2 to obtain mean log loss ln(4/3)≈0.287682. This is a product of observed-answer probabilities, not a posterior probability of coefficients.

12. 같은 정확도·다른 확률 품질Equal accuracy, different probability quality

정답 Y=(0,1)에 두 예측 A=(1/10,9/10),B=(2/5,3/5)를 적용합니다. 문턱 1/2의 정확도,평균 Brier,평균 로그손실을 비교하세요. 가중치는 모두 1입니다.

For Y=(0,1), compare forecasts A=(1/10,9/10) and B=(2/5,3/5). Use unit weights and a 1/2 action threshold. Find accuracy, mean Brier and mean log loss.

풀이와 확인할 이유Solution and explanation

두 예측 모두 두 정답을 맞혀 정확도는 1입니다. A의 두 제곱손실은 모두 1/100이라 평균도 1/100입니다. B는 두 손실이 모두 4/25라 평균 4/25입니다.

A의 평균 로그손실은 −ln(9/10)≈0.105361,B는 −ln(3/5)≈0.510826입니다. 같은 정확도가 서로 다른 확신의 품질을 구별하지 못한다는 반례입니다. 반대 정답이 나오면 과도한 확신이 더 큰 손실을 만들 수도 있습니다.

Both classify both answers correctly, so accuracy is 1. A’s mean Brier is 1/100; B’s is 4/25.

Mean log losses are−ln(9/10)≈0.105361 and−ln(3/5)≈0.510826. Equal accuracy misses the difference in confidence quality. An opposite outcome could instead penalize the more confident rule heavily.

13. 영가중치의 불가능 사건An impossible event with zero weight

두 행은 p=(0,1/2),Y=(1,0),가중치 w=(0,2)입니다. 가용 분모·우도 곱·평균 로그손실을 구하세요. 첫 가중치를 정확히 1로 바꾸면 무엇이 달라지나요?

Two rows have p=(0,1/2), Y=(1,0), weights(0,2). Find available weight, frequency-weight likelihood product and mean log loss. What changes if the first weight becomes exactly 1?

풀이와 확인할 이유Solution and explanation

첫 행은 양의 가중치가 없어 제외합니다. W=2,두 번째 사건확률 1/2를 두 번 곱해 우도는 1/4입니다. 음의 로그우도 2ln2를 W로 나누면 평균 ln2입니다. 0×log0을 NaN으로 만들지 않고 정의된 가용 틀에서 합합니다.

첫 가중치가 1이면 불가능 사건이 목적함수에 들어와 우도는 0,평균 로그손실은 양의 무한대입니다. 아주 작은 양수여도 무한대이며,표시가 0으로 반올림되는 것과는 다릅니다.

Exclude the first row because its weight is zero. W=2, the frequency-weight product is(1/2)²=1/4, and mean log loss is(2 ln 2)/2=ln 2. Sum on the defined available frame instead of numerically forming 0×log 0.

With first weight 1, the impossible event enters: likelihood becomes zero and mean log loss positive infinity. Any strictly positive first weight has this boundary result, even if displayed as rounded zero.

14. 가중 성공 비율의 MLEMLE of a weighted success fraction

한 집단에 Y=(1,0),양의 가중치 w=(1/4,3/4)가 있습니다. 가중 Bernoulli 로그 목적함수의 최대 확률과 유한 로짓을 구하세요. 이 비정수 가중치를 단순 표본 반복 횟수라고 불러도 되나요?

One group has Y=(1,0) and weights(1/4,3/4). Maximize the weighted Bernoulli log objective and find its finite logit. Are these ordinary replication counts?

풀이와 확인할 이유Solution and explanation

S=1/4,F=3/4,W=1이므로 p=S/W=1/4입니다. 두 양이 양수여서 내부 최대이며 로짓은 ln[(1/4)/(3/4)]=−ln3입니다. 직접 미분 (1/4)/p−(3/4)/(1−p)=0으로도 확인합니다.

이 가중치는 비정수이므로 원 관측의 정수 반복 횟수는 아닙니다. 명시한 가중 로그손실 또는 거듭제곱 작업우도로는 쓸 수 있으나 정수 표본 독립 곱우도와 동일하다고 말하지 않습니다.

S=1/4, F=3/4, W=1, so p=1/4 and logit−ln 3. Both weighted outcome counts are positive; differentiating(1/4)logp+(3/4)log(1−p)confirms the interior maximum.

These noninteger weights are not ordinary observation replication counts. They define a stated weighted-log or power working objective, not automatically an iid integer-sample likelihood.

15. 두 집단의 전체 우도 계산Calculate the complete two-group likelihood

단위 가중치의 이진 입력 자료에서 x=0은 성공 1·실패 3,x=1은 성공 3·실패 1입니다. 관측된 개별 정답열의 MLE 확률,로지스틱 계수,우도 곱을 구하세요. 조합계수는 넣지 않습니다.

Unit-weight binary-input data have success/failure counts(1,3)at x=0 and(3,1)at x=1. Find MLE probabilities, logistic coefficients and the likelihood of the observed ordered individual outcomes, without combinatorial factors.

풀이와 확인할 이유Solution and explanation

p₀=1/4,p₁=3/4이며 a=−ln3,b=ln9입니다. 각 집단의 관측열 우도는 (1/4)(3/4)³로 같아 전체 곱은 (1/4)²(3/4)⁶=729/65536입니다.

성공수만 관측한 Binomial 질량함수에는 조합계수가 있지만 여기서는 순서가 있는 개별 정답들의 우도입니다. 계수와 무관한 조합계수는 최대점은 바꾸지 않아도 우도 값 자체는 바꿉니다.

p₀=1/4, p₁=3/4, a=−ln 3 and b=ln 9. Each group contributes(1/4)(3/4)³; the full ordered-outcome likelihood is(1/4)²(3/4)⁶=729/65536.

A Binomial mass for counts includes combinatorial factors; the specified likelihood is for ordered individual outcomes. Parameter-constant factors preserve the maximizer but change the likelihood value.

16. 관측되지 않은 x=1An unobserved x=1 level

자료에는 x=0만 있고 성공 2·실패 2입니다. 절편과 기울기를 포함한 p=σ(a+bx)의 전체 유한 MLE 계수와 새 x=1 확률의 식별 집합을 구하세요.

Only x=0 is observed, with two successes and two failures. For p=σ(a+bx), find every finite MLE coefficient and the identified set of a new x=1 probability.

풀이와 확인할 이유Solution and explanation

p₀=1/2이므로 a=0입니다. b는 관측 로짓에 전혀 들어가지 않아 모든 실수 t에 대해 (a,b)=(0,t)가 최대를 이룹니다. b=0 하나만 쓰면 전체 가족을 놓칩니다.

새 p₁=σ(t)는 열린 구간 (0,1) 전체를 움직입니다. 닫힌 확률 공간의 극한까지 포함하면 [0,1]이지만 끝점은 유한 계수에서 나오지 않습니다. p₁=1/2를 대표값으로 고르는 규칙과 식별을 구별합니다.

p₀=1/2 fixes a=0. The slope never enters an observed logit, so every(0, t), t real, is a finite MLE. Reporting only b=0 omits the family.

The new p₁=σ(t)ranges over(0,1). Its closure is[0,1], but endpoints require coefficient limits. Selecting p₁=1/2 as a representative does not identify it from data.

17. 관측되지 않은 x=0An unobserved x=0 level

자료에는 x=1만 있고 성공 3·실패 1입니다. 전체 유한 MLE 계수 가족과 평평한 계수 방향을 구하세요.

Only x=1 is observed, with three successes and one failure. Find the full finite-MLE coefficient family and its flat direction.

풀이와 확인할 이유Solution and explanation

p₁=3/4라 a+b=ln3입니다. 따라서 (a,b)=(ln3−t,t),t∈R입니다. 특수해 (ln3,0)에 방향 (−1,1)의 임의 실수 배수를 더한 가족입니다.

관측 설계행 (1,1)과 방향의 내적은 0이므로 적합값은 같습니다. 이 평평함은 분리에 의한 끝없는 우도 개선이 아니라 순위 결손에 따른 비식별입니다.

p₁=3/4 implies a+b=ln 3. The full family is(ln 3−t, t), or particular point(ln 3,0)plus any real multiple of(−1,1).

The observed design row(1,1)has zero inner product with that direction. Fits remain unchanged; this is rank nonidentification, not an improving separation direction.

18. 가용 정답이 없는 경우No available answers

두 원행은 (x,y,w)=(0,null,1),(1,1,0)입니다. 원자료 행수,양의 완전 가용 행수,유한 계수 최대집합,평균 로그손실을 설명하세요.

Two source rows are(x, y, w)=(0, null,1),(1,1,0). State source count, positive complete count, finite coefficient maximizing set and normalized log loss.

풀이와 확인할 이유Solution and explanation

원행은 2개지만 첫 행은 정답이 없고 둘째는 가중치가 0이라 가용 행은 0,W=0입니다. 가용 로그우도는 빈 합 0으로 모든 유한 (a,b)∈R²가 최대입니다. 자료가 두 확률을 결정하지 않습니다.

평균 로그손실은 0/0이라 미정의입니다. 0으로 보고하거나 첫 후보가 최적이라고 고르지 않습니다. 원행 두 개와 제외 이유는 보존합니다.

There are two source rows but no positive complete rows: one lacks its answer, the other has zero weight. W=0 and the empty log sum is zero, so every finite(a, b)∈R² maximizes it; neither probability is identified.

Normalized log loss is undefined, not zero. Retain both source rows and their exclusion reasons rather than declaring a selected model optimal.

19. 가중치 재배율과 반횟수Weight rescaling and pseudocounts

한 집단의 성공·실패 가중합은 S=1/4,F=3/4입니다. 모든 관측 가중치를 4배하기 전후의 MLE와 Beta(1/2,1/2) 작업 사후평균을 비교하세요. 사전 모수는 재배율하지 않습니다.

Weighted success/failure totals are S=1/4, F=3/4. Multiply all observation weights by 4 while leaving Beta(1/2,1/2)prior shapes fixed. Compare MLE and posterior mean before/after.

풀이와 확인할 이유Solution and explanation

MLE는 처음 (1/4)/1=1/4,재배율 뒤 1/(1+3)=1/4로 같습니다. 가중 로그우도 전체의 양의 배수는 최대점을 바꾸지 않습니다.

반횟수 평균은 처음 (1/4+1/2)/(1+1)=3/8,뒤에는 (1+1/2)/(4+1)=3/10입니다. 사전을 고정한 채 자료의 총 거듭제곱 가중치를 바꾸면 상대 사전 영향이 달라집니다. 따라서 모든 추정 규칙에 같은 재배율 불변성을 주장할 수 없습니다.

MLE remains 1/4: rescaling the entire log objective positively leaves its maximizer unchanged.

The half-count posterior mean changes from(1/4+1/2)/2=3/8 to(1+1/2)/5=3/10. Fixed prior shapes have a different relative influence after likelihood-weight rescaling. The invariance does not apply to every estimator.

20. Newton 첫 단계가 최적해는 아니다A first Newton step is not the optimum

독립 작업모형의 단위 가중치 네 행 중 성공은 3입니다. 절편만 있는 로지스틱에서 θ=0부터 합 음의 로그우도의 Newton 한 단계를 계산하고 정확 MLE와 비교하세요.

Four unit-weight rows have three successes. Start intercept-only logistic summed negative-log-likelihood Newton optimization at θ=0. Calculate one step and compare with the exact MLE.

풀이와 확인할 이유Solution and explanation

시작 p=1/2,기울기 g=4p−3=−1,Hessian H=4p(1−p)=1입니다. HΔ=−g를 풀면 Δ=1,새 θ=1입니다.

새 p=σ(1)≈0.731059라 점수 잔차 4p−3≈−0.075766이 아직 0이 아닙니다. 정확 MLE는 p=3/4,θ=ln3≈1.098612입니다. 반복 한 번을 완료로 부르지 않고 적합·존재·종료 오차를 구별합니다.

Initially p=1/2, g=4 p−3=−1 and H=4 p(1−p)=1. Solving HΔ=−g givesΔ=1 and newθ=1.

Now p≈0.731059 and score residual 4 p−3≈−0.075766, not zero. The exact MLE is p=3/4,θ=ln 3≈1.098612. One iteration does not establish convergence or existence.

21. 두 점의 완전 분리와 최대 마진Complete separation and normalized margin for two points

두 단위 가중치 행 (X,Y)=(−1,0),(1,1)에서 절편 a·기울기 b의 방향을 |a|,|b|≤1로 정규화합니다. 두 부호 점수와 최솟값 마진 γ의 최대값,대표 방향을 구하세요.

Two unit-weight rows are(X, Y)=(−1,0),(1,1). Normalize the intercept/slope direction by|a|,|b|≤1. Find signed scores, the largest minimum marginγ and an optimal direction.

풀이와 확인할 이유Solution and explanation

부호 점수는 첫 행 −a+b,둘째 a+b입니다. 최솟값은 b−|a|≤1입니다. a=0,b=1에서 두 점수 모두 1이므로 γ최대=1이고 이 최적 방향은 유일합니다.

정규화 방향을 실제 계수의 양의 배수로 키우면 두 관측의 우도는 계속 증가합니다. γ>0은 완전 분리의 증거이지 원래 로지스틱 계수가 (0,1)에서 MLE라는 뜻은 아닙니다.

Signed scores are−a+b and a+b; their minimum b−|a|is at most 1. At a=0, b=1, both equal 1, so the maximum margin is 1 and this normalized direction is unique.

Scaling the direction increases observed-outcome likelihood indefinitely. Positiveγ proves complete separation; it does not make(0,1)the logistic MLE.

22. 네 점의 준완전 분리Quasi-complete separation among four points

자료 (X,Y)=(−1,0),(0,0),(0,1),(1,1)와 |a|,|b|≤1을 씁니다. 모든 부호 점수를 비음수로 만드는 조건과 그 합의 최대를 구하고 완전·준분리를 판정하세요.

Use(X, Y)=(−1,0),(0,0),(0,1),(1,1), with|a|,|b|≤1. Find conditions for all signed scores to be nonnegative, maximize their sum and classify separation.

풀이와 확인할 이유Solution and explanation

부호 점수는 (−a+b,−a,a,a+b)입니다. 가운데 두 조건이 a=0을 강제하고 양 끝은 b≥0을 요구합니다. 합은 2b이므로 b=1에서 최대 2입니다.

가운데 점수는 항상 0이라 엄격 최솟값 마진은 0입니다. 하지만 합 개선은 양수이므로 준완전 분리이며 유한 MLE는 없습니다. 같은 X의 반대 정답이 있다는 사실만으로 MLE 존재를 주장하면 안 됩니다.

Signed scores are(−a+b,−a, a, a+b). The middle pair forces a=0; the ends require b≥0. Their sum 2 b is maximized at b=1 with value 2.

The middle scores stay zero, so strict minimum margin is zero. Positive total improvement proves quasi separation and no finite MLE. Contradictory labels at one X do not establish existence.

23. 영공간은 준분리의 증거가 아니다A nullspace direction is not quasi separation

두 행 모두 X=0이고 정답은 0과 1,가중치는 1입니다. 전체 로지스틱 MLE와 방향 d=(0,1)의 부호 점수를 구하세요. 분리 분류는 무엇인가요?

Both rows have X=0, with outcomes 0 and 1 and unit weights. Find all logistic MLEs and signed scores in direction d=(0,1). What is the separation classification?

풀이와 확인할 이유Solution and explanation

상수 확률은 1/2에서 최대라 a=0,b는 임의 실수입니다. d 방향은 두 설계행 (1,0)에 수직이므로 부호 점수는 (0,0)입니다. 손실을 바꾸지 않는 평평한 방향입니다.

비음수 점수를 만드는 방향은 a=0을 요구하고 모든 점수가 0이므로 엄격 개선은 없습니다. 겹침이며 유한 적합값은 유일하지만 계수는 비유일합니다. 이를 준분리로 세지 않습니다.

The constant probability is maximized at 1/2, so a=0 and b is arbitrary. Direction d is orthogonal to both design rows(1,0), giving signed scores(0,0). It is flat.

Every nonnegative-score direction requires a=0 and leaves both scores zero. There is overlap with unique fitted probabilities but nonunique coefficients, not quasi separation.

24. 중복 입력의 유한 계수 가족A finite coefficient family with duplicate inputs

두 입력이 같은 네 행에서 X=(−1,−1)에 Y=0,1이 각각 한 번,X=(1,1)에도 Y=0,1이 각각 한 번 있습니다. 단위 가중치 로지스틱의 전체 MLE 계수 (a,b₁,b₂)와 새 X=(1,0)의 확률 범위를 구하세요.

Two duplicate inputs give four unit-weight rows: at X=(−1,−1), one outcome each 0 and 1; at X=(1,1), again one each 0 and 1. Find all MLE coefficients(a, b₁, b₂)and the range of probability at new X=(1,0).

풀이와 확인할 이유Solution and explanation

두 관측 입력의 성공 비율은 모두 1/2이므로 로짓은 a−b₁−b₂=0,a+b₁+b₂=0입니다. 더하고 빼면 a=0,b₁+b₂=0이므로 전체 가족은 (0,t,−t)입니다.

새 입력 로짓은 t라 확률은 σ(t)∈(0,1) 전체입니다. 네 훈련 예측은 유일하지만 새 입력의 선택 확률까지 식별되지 않습니다. 중복 열의 영공간과 개선 분리를 구분합니다.

Each observed input has empirical probability 1/2, so a−b₁−b₂=0 and a+b₁+b₂=0. Hence a=0, b₁+b₂=0, and the full family is(0, t,−t).

The new input has logit t and probability anywhere in(0,1). Unique training fits do not identify every new-input probability. The duplicate-column nullspace is not improving separation.

25. 아주 작은 양수와 정확한 0A tiny positive weight versus exact zero

두 행은 같은 X=0에서 Y=0,1이며 가중치는 각각 1,ε입니다. ε=10⁻⁴⁰⁰일 때와 ε=0일 때 유한 MLE 존재와 사건확률을 비교하세요.

Two rows share X=0 and have outcomes 0,1 with weights 1,ε. Compare finite-MLE existence and event probability at ε=10⁻⁴⁰⁰ versus ε=0.

풀이와 확인할 이유Solution and explanation

양의 ε에서는 성공 ε·실패 1이므로 p=ε/(1+ε)>0이고 절편은 lnε=−400ln10으로 유한합니다. 기울기는 X=0에서 보이지 않아 임의 실수입니다. 화면의 확률이 0으로 반올림되어도 겹침과 유한 절편은 유지됩니다.

ε=0이면 성공 행이 빠지고 관측 집단은 순수 실패입니다. 닫힌 확률 최대는 0이지만 유한 절편에서는 도달하지 못합니다. 정확한 0 여부가 존재 결론을 바꿉니다.

For positiveε, success totalε and failure total 1 give p=ε/(1+ε)>0 and finite intercept lnε=−400 ln 10. The slope remains arbitrary because X=0. Display underflow does not remove overlap.

At ε=0, the success row is excluded. The observed group has only failures: closed-space optimum 0 is unattainable at a finite intercept. Exact zero changes existence.

26. 절편을 벌점에서 빼면 남는 반례A counterexample with an unpenalized intercept

모든 정답이 Y=1인 두 행의 로지스틱 음의 로그우도에 λb²/2만 더합니다. λ>0,절편 a는 벌점에서 제외합니다. 이 벌점이 항상 유한 최소점을 만드는지 반례를 보이세요.

Two logistic rows both have Y=1. Addλb²/2 forλ>0 but leave intercept a unpenalized. Does this always create a finite minimizer? Give a counterexample.

풀이와 확인할 이유Solution and explanation

b=0이면 두 로짓이 모두 a이고 벌점은 0입니다. 목적함수는 2log(1+e⁻ᵃ)로 a를 키울수록 줄어 0에 가까워집니다. 유한 a에서는 양수입니다.

따라서 하한 0은 유한점에서 달성되지 않습니다. 양의 Ridge라는 이름만 보고 존재를 보장할 수 없으며 어느 계수에 벌점을 줬는지가 중요합니다.

Set b=0. Both logits equal a, the penalty vanishes, and the objective is 2 log(1+e⁻ᵃ). It decreases toward zero as a increases but stays positive at finite a.

The infimum is therefore unattained. A positive ridge label alone does not guarantee existence; which coefficients are penalized matters.

27. 모든 계수의 이차 벌점A quadratic penalty on every coefficient

절편만 있는 두 성공 행의 합 음의 로그우도에 a²/2를 더해 J(a)=2log(1+e⁻ᵃ)+a²/2를 만듭니다. 유일한 유한 최소점의 존재와 그 위치가 1/2와 1 사이라는 사실을 보이세요.

For two successes in an intercept-only model, let J(a)=2 log(1+e⁻ᵃ)+a²/2. Prove a unique finite minimizer exists and lies between 1/2 and 1.

풀이와 확인할 이유Solution and explanation

a²/2 때문에 |a|→∞이면 J→∞이고 J는 연속이라 최소점이 존재합니다. J′=2σ(a)−2+a,J″=2σ(a)(1−σ(a))+1>0이라 유일합니다.

J′(1/2)≈−0.255081<0,J′(1)≈0.462117>0입니다. 미분의 연속성과 엄격 증가로 근은 (1/2,1)에 있습니다. 이 값은 벌점 목적함수의 해이며 원 순수 집단의 MLE가 새로 생긴 것이 아닙니다.

The quadratic makes J coercive and continuity gives existence. J′=2σ(a)−2+a and J″=2σ(a)(1−σ(a))+1>0 give uniqueness.

J′(1/2)≈−0.255081 and J′(1)≈0.462117. A continuous strictly increasing derivative has its unique zero between them. This solves the penalized objective, not the original pure-group likelihood.

28. 분리 방향의 정규화Normalize a separating direction

방향 d=(5,10)이 모든 부호 점수를 엄격히 양수로 만든다고 가정합니다. 계수 무한대 노름이 1인 방향으로 바꾸고 분리 판정이 왜 같은지 설명하세요. 이 상자를 추정계수의 제약이라고 불러도 되나요?

Assume direction d=(5,10)gives strictly positive signed scores for every row. Normalize its coefficient infinity norm to 1 and explain why classification is unchanged. Is the box a constraint on fitted coefficients?

풀이와 확인할 이유Solution and explanation

무한대 노름은 10이므로 d/10=(1/2,1)입니다. 모든 부호 점수가 원 점수의 1/10이 되어 엄격 양수 여부는 그대로입니다. 모든 비영 방향을 양의 배수로 상자 안에 넣을 수 있습니다.

이 상자는 분리 방향의 크기 중복을 없애는 계산 장치입니다. 실제 로지스틱 최적계수를 [−1,1]에 제한하거나 사전분포를 둔 것이 아닙니다.

The infinity norm is 10, so use(1/2,1). Every signed score becomes one-tenth of its former value and stays positive. Any nonzero direction can be positively rescaled into the box.

The box removes redundant direction scale. It neither constrains actual fitted logistic coefficients to[−1,1]nor supplies a prior.

29. 겹침의 존재 증명에서 영공간을 빼는 이유Why remove nullspace in an existence proof?

양의 가용 가중치의 유한 로지스틱 자료가 겹침을 만족합니다. 왜 계수 전체 공간에서 모든 손실 수준집합이 유계라고 바로 주장할 수 없나요? 행공간으로 제한하면 어떤 모순 논증을 쓸 수 있나요?

A finite positive-weight logistic dataset has overlap. Why can one not immediately claim bounded loss sublevel sets in the whole coefficient space? What contradiction works after restricting to the design row space?

풀이와 확인할 이유Solution and explanation

영공간 방향은 로짓과 손실을 바꾸지 않아 길이가 무한해도 같은 손실일 수 있습니다. 따라서 전체 계수 수준집합은 비유계일 수 있습니다. 영공간 성분을 제거한 행공간 대표에서 존재를 검토해야 합니다.

행공간에서 유계 손실의 발산 계수열이 있으면 정규화 부분열의 극한 d는 비영입니다. 음수 부호 점수는 손실 발산을 일으키므로 모든 점수는 비음수이고,행공간 비영성 때문에 일부는 양수입니다. 이는 겹침과 모순입니다. 유계·닫힌 수준집합과 연속성으로 유한 적합의 존재를 얻습니다.

Nullspace directions preserve logits and loss while their norm can diverge. Whole coefficient sublevel sets may therefore be unbounded. Work with row-space representatives.

A bounded-loss divergent sequence in row space has a normalized subsequence converging to nonzero d. A negative signed score would force divergent loss; all scores are nonnegative, and at least one is positive because d is not null. This contradicts overlap. Closed bounded sublevel sets and continuity then give existence.

30. 마진의 표시 underflowDisplay underflow in a positive margin

두 행 (X,Y)=(−ε,0),(ε,1),ε=10⁻⁴⁰⁰과 방향 상자 |a|,|b|≤1이 있습니다. 최대 최솟값 마진과 분리 종류를 구하세요. 화면이 γ=0으로 보이면 겹침인가요?

Rows are(X, Y)=(−ε,0),(ε,1),ε=10⁻⁴⁰⁰, with|a|,|b|≤1. Find the largest minimum signed margin and separation type. Does a displayedγ=0 imply overlap?

풀이와 확인할 이유Solution and explanation

점수는 −a+εb,a+εb라 최솟값은 εb−|a|≤ε입니다. a=0,b=1에서 ε를 달성하므로 정확 최대 마진은 10⁻⁴⁰⁰>0,완전 분리입니다.

이 값은 binary64 표시 범위 아래에서 0으로 반올림될 수 있습니다. 정확 분수의 양수 표지와 원값으로 판정해야 하며 표시값 0만으로 MLE 존재나 겹침을 선언하지 않습니다.

The scores are−a+εb and a+εb; their minimumεb−|a|is at mostε. At a=0, b=1, the exact maximum isε>0, so separation is complete.

Binary 64 display can round this margin to zero. Use its exact positive fraction and nonzero badge; display zero does not establish overlap or finite-MLE existence.

31. Brier의 기대손실 분해Decompose expected Brier loss

설명용 실제 사건확률 q=1/4에서 예측 p=1/4와 p=1/2의 기대 Brier를 계산하세요. 두 값의 차이가 (p−q)²와 같은지 확인하세요.

For illustrative true event probability q=1/4, calculate expected Brier for forecasts p=1/4 and p=1/2. Verify the excess equals(p−q)².

풀이와 확인할 이유Solution and explanation

기대 Brier는 (p−q)²+q(1−q)입니다. q(1−q)=3/16이라 정직한 p=1/4의 손실은 3/16입니다. p=1/2는 1/16+3/16=1/4입니다.

차이는 1/16입니다. 실제 정답 한 번의 손실과 기대손실을 혼동하지 않으며,이 계산은 q를 알고 있다는 설명용 가정 아래 성립합니다.

Expected Brier is(p−q)²+q(1−q). The irreducible term is 3/16; truthful p=1/4 achieves it. Forecasting 1/2 adds 1/16, giving 1/4.

The excess is 1/16. This is an expectation under the stated known-q example, not the loss from a single answer.

32. 로그손실도 참 확률에서 최소다True probability minimizes expected log loss

0<q<1에서 R(p)=−q logp−(1−q)log(1−p),0<p<1입니다. 미분으로 최저점을 증명하고 q=1/4에서 p=1/4와 1/2의 값을 비교하세요.

For 0< q<1, let R(p)=−q logp−(1−q)log(1−p),0< p<1. Prove the minimizer using its derivative, then compare p=1/4 and 1/2 when q=1/4.

풀이와 확인할 이유Solution and explanation

R′=(p−q)/[p(1−p)]입니다. 분모가 양수라 p<q에서는 감소,p>q에서는 증가하므로 유일한 최소는 p=q입니다.

q=1/4에서 참값의 손실은 (1/4)ln4+(3/4)ln(4/3)≈0.562335입니다. p=1/2는 ln2≈0.693147로 더 큽니다. 차이 약 0.130812는 두 Bernoulli 분포의 KL 간격입니다.

R′=(p−q)/[p(1−p)]. Its denominator is positive, so risk decreases below q and increases above it. The minimum is uniquely p=q.

At q=1/4, the truthful risk is(1/4)ln 4+(3/4)ln(4/3)≈0.562335; forecast 1/2 gives ln 2≈0.693147. The excess≈0.130812 is a Bernoulli KL divergence.

33. 정확 점수 그룹의 Murphy 등식Murphy identity at exact score groups

두 단위 가중치 행의 p=(1/4,3/4),Y=(0,1)입니다. 같은 예측 점수별로 묶어 전체 비율,REL,RES,UNC와 Brier를 계산하세요.

Two unit-weight rows have p=(1/4,3/4), Y=(0,1). Group identical forecast scores and compute overall rate, REL, RES, UNC and Brier.

풀이와 확인할 이유Solution and explanation

두 그룹의 관측 비율은 0,1이고 전체는 1/2입니다. REL=[(1/4−0)²+(3/4−1)²]/2=1/16입니다. RES=[(0−1/2)²+(1−1/2)²]/2=1/4,UNC=1/4입니다.

REL−RES+UNC=1/16입니다. 직접 각 행 제곱오차도 1/16이라 Brier가 일치합니다. 같은 점수 그룹 안의 예측이 상수라는 전제가 등식의 핵심입니다.

Group frequencies are 0 and 1, overall rate 1/2. REL=1/16, RES=1/4 and UNC=1/4.

The identity gives 1/16, matching both individual squared errors. The result uses constant forecast values inside each exact-score group.

34. 넓은 한 구간의 추가 항The extra term for one broad bin

p=(1/5,4/5),Y=(0,1),단위 가중치 두 행을 하나의 넓은 구간으로 묶습니다. 구간 평균 REL−RES+UNC와 실제 Brier를 비교하고 분산·공분산 보정으로 차이를 설명하세요.

Put p=(1/5,4/5), Y=(0,1), with unit weights, into one broad bin. Compare binned REL−RES+UNC with actual Brier, and explain the variance/covariance correction.

풀이와 확인할 이유Solution and explanation

평균 예측과 성공 비율은 둘 다 1/2라 구간 REL=0,RES=0,UNC=1/4입니다. 실제 두 제곱오차는 각각 1/25이므로 Brier=1/25입니다.

구간 내 Var(P)=9/100,Cov(P,Y)=3/20입니다. 추가 항 9/100−2×3/20=−21/100을 더하면 1/4−21/100=1/25입니다. 구간 그림의 항등식을 원 점수의 등식으로 잘못 옮기지 않습니다.

Both bin means equal 1/2, so binned REL=0, RES=0 and UNC=1/4. Each actual squared error is 1/25, so original Brier is 1/25.

Within-bin Var(P)=9/100 and Cov(P, Y)=3/20. Adding 9/100−2×3/20=−21/100 to 1/4 recovers 1/25. Broad-bin summaries do not automatically decompose the original score.

35. 세 점의 PAVA와 보정 표본 손실Three-point PAVA and calibration-sample loss

원 점수 (1/5,1/2,4/5),정답 (1,0,1),단위 가중치 세 행에 단조 PAVA를 적합하세요. 원 Brier와 적합 뒤 같은 표본의 Brier를 계산하세요.

Fit monotone PAVA to scores(1/5,1/2,4/5), answers(1,0,1), unit weights. Compare raw and fitted Brier on this same calibration sample.

풀이와 확인할 이유Solution and explanation

관측 비율 (1,0,1)의 첫 두 값이 순서를 위반해 가중 평균 1/2로 합칩니다. 결과는 (1/2,1/2,1)입니다. 마지막 1과도 증가 순서라 더 합치지 않습니다.

원 손실은 [(4/5)²+(1/2)²+(1/5)²]/3=31/100입니다. 적합 뒤는 [(1/2)²+(1/2)²+0]/3=1/6입니다. 같은 보정 표본의 감소이며 새 시험 표본의 개선 보장이 아닙니다.

Pool the violating first pair of empirical frequencies(1,0,1)to 1/2. The fitted values are(1/2,1/2,1), already nondecreasing.

Raw Brier is[(4/5)²+(1/2)²+(1/5)²]/3=31/100. Fitted Brier is 1/6. This reduction is on the fitting calibration sample, not a guaranteed test improvement.

36. 집단 크기가 다른 PAVAPAVA with unequal group sizes

낮은 원 점수 집단은 세 성공·실패 0,높은 점수 집단은 성공 0·실패 1입니다. 각 원행 가중치 1의 단조 보정에서 합친 확률과 평균 제곱손실을 구하세요. 단순 평균 1/2와 비교하세요.

The lower-score group has three successes/no failures; the higher-score group no successes/one failure. With unit row weights, find the pooled isotonic probability and mean squared loss. Compare with unweighted probability 1/2.

풀이와 확인할 이유Solution and explanation

집단 비율 1>0이므로 합칩니다. 성공 3,전체 4라 확률은 3/4입니다. 손실 합은 3(3/4−1)²+(3/4)²=3/4,평균은 3/16입니다.

확률 1/2를 주면 손실 합은 3×1/4+1/4=1,평균 1/4로 더 큽니다. 비율 두 개의 평균이 아니라 원 가용 가중치로 합친 비율을 사용해야 합니다.

Frequencies 1>0 violate order, so pool three successes over four rows to 3/4. Squared-loss sum is 3(3/4−1)²+(3/4)²=3/4; the mean is 3/16.

Using 1/2 gives loss sum 1 and mean 1/4. Pool original weights/counts rather than average two group percentages equally.

37. 같은 점수는 먼저 묶는다Group tied scores first

세 보정 행의 점수는 모두 2/5이고 정답은 (0,1,1)입니다. 단위 가중치에서 올바른 보정 확률을 구하고,정렬된 행의 정답을 그대로 (0,1,1) 예측으로 쓰면 왜 틀리는지 설명하세요.

Three unit-weight calibration rows share score 2/5 and have answers(0,1,1). Find the calibrated probability and explain why copying the sorted answers as predictions(0,1,1)is invalid.

풀이와 확인할 이유Solution and explanation

원 점수가 같으므로 하나의 함수 f(2/5)가 세 행에 같은 값을 줘야 합니다. 성공 2/전체 3으로 유일한 제곱손실 최소 적합값은 2/3입니다.

행별 정답 순서를 이용해 다른 값을 주면 같은 입력에 여러 함수값을 주고 정답 자체를 유출합니다. 같은 점수 집계를 먼저 한 뒤 단조 적합하며 원행 순서를 바꿔도 적합 지도는 같아야 합니다.

A function must assign one value f(2/5)to every tied score. Two successes over three rows give the unique squared-loss fit 2/3.

Copying sorted answers gives multiple outputs at one input and leaks labels. Group exact ties before isotonic fitting; permuting tied source rows must not change the map.

38. 보간과 바깥 확장Interpolation and extrapolation

보정 매듭은 원 점수 1/5→1/4,4/5→3/4입니다. 선형 보간으로 2/5의 예측을 구하세요. 새 점수 0의 clamp와 null 결과도 쓰고 이 값들의 식별 범위를 설명하세요.

Calibration knots map 1/5→1/4 and 4/5→3/4. Find linear interpolation at 2/5 and clamp/null predictions at score 0. Explain what the observations identify.

풀이와 확인할 이유Solution and explanation

가로 비율은 (2/5−1/5)/(4/5−1/5)=1/3입니다. 따라서 예측은 1/4+(1/3)(1/2)=5/12입니다. 점수 0은 관측 범위 밖이라 clamp는 1/4,null은 예측 없음입니다.

관측 적합값과 단조성만으로 2/5의 정확 값은 정해지지 않습니다. 5/12는 선언한 선형 확장의 출력이며 clamp도 별도 끝값 규칙입니다. 두 규칙을 참 위험으로 식별했다고 쓰지 않습니다.

The horizontal fraction is 1/3, giving 1/4+(1/3)(1/2)=5/12. At score 0, clamping gives 1/4 while null extrapolation gives no prediction.

Observed knots and monotonicity do not identify a unique intermediate probability. The value 5/12 comes from the declared linear extension; clamping is another declared rule, not identified true risk.

39. PAVA 적합의 KKT 검산Check PAVA optimality using KKT

세 집단 가중치는 모두 1,관측 비율은 q=(1,0,1)입니다. 제약 z₁≤z₂≤z₃에서 목적함수 (1/2)Σ(zⱼ−qⱼ)²의 후보 z=(1/2,1/2,1)를 승수로 검산하세요.

Three groups have unit weights and observed rates q=(1,0,1). Verify z=(1/2,1/2,1)minimizes one-halfΣ(zⱼ−qⱼ)² subject to z₁≤z₂≤z₃, using multipliers.

풀이와 확인할 이유Solution and explanation

제약 z₁−z₂≤0,z₂−z₃≤0의 승수를 λ₁=1/2,λ₂=0으로 둡니다. 정류식은 첫째 −1/2+1/2=0,둘째 1/2−1/2+0=0,셋째 0−0=0입니다.

승수는 비음수이고 λ₁(z₁−z₂)=0,λ₂(z₂−z₃)=0이며 순서도 맞습니다. 볼록 문제의 KKT를 만족해 최적이고 양의 가중치의 엄격 볼록성 때문에 관측점 적합은 유일합니다.

For constraints z₁−z₂≤0 and z₂−z₃≤0, chooseλ₁=1/2,λ₂=0. Stationarity holds componentwise:−1/2+1/2=0,1/2−1/2=0, and 0=0.

Dual nonnegativity, complementarity and ordering all hold. KKT suffices for this convex problem; positive weights make the observed fitted vector unique.

40. 표본의 완벽한 보정은 모집단 증명이 아니다Perfect empirical calibration is not a population proof

설명용 iid Bernoulli(1/2) 모집단에서 보정 관측 8개가 우연히 모두 1이었습니다. 같은 원 점수에 PAVA가 1을 주었습니다. 이 결과가 참 확률 1을 증명하는지,다음 결과가 0일 때 로그손실은 무엇인지 설명하세요.

In an illustrative iid Bernoulli(1/2)population, eight calibration answers happen to all equal 1. PAVA maps their common score to 1. Does this prove true probability 1? What is log loss if the next answer is 0?

풀이와 확인할 이유Solution and explanation

명시한 모집단에서도 여덟 성공의 확률은 (1/2)⁸=1/256>0입니다. 따라서 관측 비율 1은 참 확률이 1이라는 증거로 확정될 수 없습니다. PAVA는 유한 보정 표본의 제약 목적을 적합했습니다.

새 Y=0에 p=1이면 관측 사건확률은 0이고 로그손실은 양의 무한대입니다. 작은 표본의 경계 확신이 낳는 문제이며,사후적으로 자르기를 넣었다면 그 추가 규칙과 선택 경위를 공개해야 합니다.

Even under the stated true probability 1/2, the eight-success sample has probability 1/256>0. Empirical frequency 1 therefore does not prove population probability 1. PAVA fitted a finite calibration objective.

A new Y=0 at p=1 receives event probability zero and positive-infinite log loss. If clipping is added afterward, disclose the new rule and how it was selected.

41. 시험 정답은 적합 지도를 바꾸지 않는다Test answers must not alter fitted maps

훈련 x=0의 정답은 (0,1),x=1은 (0,1,1)입니다. 평활 없이 집단 MLE를 쓰고,보정에는 (x,y)=(0,0),(1,1)이 있습니다. 시험 두 행의 X는 (0,1)입니다. 시험 정답을 (0,1)에서 (1,0)으로 바꾸면 원 확률·PAVA 지도가 바뀌어야 하나요?

Training answers are(0,1)at x=0 and(0,1,1)at x=1. Use unsmoothed group MLEs. Calibration contains(x, y)=(0,0),(1,1). Test inputs are(0,1). Should changing test answers from(0,1)to(1,0)alter base probabilities or the PAVA map?

풀이와 확인할 이유Solution and explanation

훈련 확률은 p₀=1/2,p₁=2/3입니다. 보정 성공 비율은 두 점수에서 0과 1이라 증가하고 PAVA는 f(1/2)=0,f(2/3)=1을 줍니다.

시험 정답은 두 적합 단계에 쓰지 않으므로 이 값들이 바뀌면 안 됩니다. 시험 예측은 늘 (0,1)이며 정답만 반대로 바꾸면 손실과 비용만 달라집니다. 특히 반대 정답에는 두 불가능 사건의 로그손실이 무한대가 됩니다.

Training probabilities are 1/2 and 2/3. Calibration frequencies 0 and 1 are increasing, so PAVA maps f(1/2)=0, f(2/3)=1.

Test labels fit neither stage, so these values must remain unchanged. Test predictions stay(0,1); only evaluated losses/costs change. Reversed answers produce impossible events and infinite log loss.

42. null 확장과 평가 분모Null extrapolation and evaluation denominators

지도 매듭은 1/5→1/10,4/5→9/10이며 선형 보간을 씁니다. 단위 가중치 시험 점수·정답은 (1/10,0),(1/2,1)입니다. null과 clamp 확장에서 예측·가용 분모·Brier를 구하고 비교의 주의점을 설명하세요.

Knots map 1/5→1/10 and 4/5→9/10 with linear interpolation. Unit-weight test(score, answer)pairs are(1/10,0),(1/2,1). Find predictions, available denominators and Brier for null versus clamp extrapolation.

풀이와 확인할 이유Solution and explanation

가운데 점수 1/2는 두 매듭의 가운데라 예측 1/2입니다. 첫 점수 1/10은 범위 밖이라 null에서는 예측 없음입니다. 가용 W=1이고 Brier=(1/2−1)²=1/4입니다.

clamp에서는 첫 예측 1/10,둘째 1/2라 W=2,Brier=[1/100+1/4]/2=13/100입니다. 수치가 작아졌지만 평가 행이 달라진 비교입니다. 같은 표본의 성능 향상으로 단정하지 않고 분모와 예측 보류 비율을 함께 보고합니다.

Score 1/2 lies midway between knots and maps to 1/2. Score 1/10 is outside support and null gives no prediction. Available weight is 1 and Brier 1/4.

Clamping gives(1/10,1/2), available weight 2, and mean Brier 13/100. The smaller number evaluates a different frame; report denominators and abstention rather than claim improvement on identical cases.

43. 예측 기대비용과 관측 비용Expected decision cost versus observed cost

두 단위 가중치 시험 행의 예측은 p=(1/10,9/10),실제 정답은 Y=(1,0)입니다. FP1/FN4,동률은 행동 1을 씁니다. 행동·관측 평균 비용과 모형 아래 행동별 평균 기대비용을 계산하세요.

Two unit-weight test rows have probabilities(1/10,9/10)and answers(1,0). Use FP 1/FN 4 and an action 1 tie rule. Calculate actions, observed mean cost and mean model-expected cost of those actions.

풀이와 확인할 이유Solution and explanation

문턱은 1/5이므로 행동은 (0,1)입니다. 관측에서는 첫 행이 미탐 비용 4,둘째가 오탐 비용 1이라 평균 비용은 5/2입니다.

모형 아래 선택 행동의 기대비용은 첫째 4×1/10=2/5,둘째 1×(1−9/10)=1/10이라 평균 1/4입니다. 실제 두 정답은 불리하게 나왔고 예측이 잘못 보정되었을 수도 있습니다. 유한 실현 비용이 모형 기대비용과 반드시 같지는 않습니다.

The threshold 1/5 gives actions(0,1). Realized errors cost 4 and 1, so observed mean cost is 5/2.

The model expects costs 4×1/10=2/5 and 1−9/10=1/10, mean 1/4. Realized outcomes may be unfavorable and probabilities may be miscalibrated. A finite realized cost need not equal its modeled expectation.

44. Beta 평균과 MAP의 차이Beta posterior mean versus MAP

독립 Bernoulli 작업모형에서 성공 0,실패 4이며 사전은 Beta(2,2)입니다. 사후분포·평균·내부 MAP·분산을 구하고 이 값이 원 MLE인지 설명하세요.

Under an independent Bernoulli working model, there are zero successes, four failures and prior Beta(2,2). Find posterior, mean, interior MAP and variance. Are these the original MLE?

풀이와 확인할 이유Solution and explanation

사후는 Beta(2,6)입니다. 평균은 2/8=1/4,두 모수가 모두 1보다 커 내부 MAP는 (2−1)/(8−2)=1/6입니다. 분산은 2×6/[8²×9]=1/48입니다.

원 닫힌 확률 MLE는 0이고 유한 로짓 MLE는 없습니다. 평균 1/4,MAP1/6은 각각 명시한 사전모형의 다른 요약이며 서로도 같지 않습니다.

The posterior is Beta(2,6). Its mean is 1/4, interior MAP 1/6 because both shapes exceed 1, and variance 12/(64×9)=1/48.

The original closed-space MLE is zero with no finite logit MLE. Posterior mean and MAP are distinct summaries under the declared prior, not replacements bearing the same estimator name.

45. 반횟수 사후 불확실성Uncertainty under a half-count posterior

성공 0,실패 4에 Beta(1/2,1/2) 작업 사전을 씁니다. 사후평균·분산을 구하고 관측 비율 0의 대입 표준오차 0과 비교해 해석하세요.

Use a Beta(1/2,1/2)working prior after zero successes/four failures. Calculate posterior mean/variance and contrast them with a zero plug-in standard error for the empirical rate.

풀이와 확인할 이유Solution and explanation

사후는 Beta(1/2,9/2),평균은 (1/2)/5=1/10입니다. 분산은 [(1/2)(9/2)]/[5²×6]=3/200입니다.

표본 비율 0을 q(1−q)/n에 대입하면 0이지만 참 사건이 불가능하다는 증명은 아닙니다. 사후분산은 명시한 사전·독립 작업모형 아래의 불확실성입니다. 둘 중 하나를 실제 모집단을 무오류로 안다는 주장으로 쓰지 않습니다.

The posterior is Beta(1/2,9/2), mean 1/10 and variance[(1/2)(9/2)]/(25×6)=3/200.

Plugging the empirical rate zero into q(1−q)/n gives zero but does not prove impossibility. Posterior variance instead belongs to the stated prior/independent working model. Neither quantity supplies assumption-free knowledge of the population.

46. 양의 온도와 결정 문턱Positive temperature and decision thresholds

이진 로짓 η=ln3을 양의 온도 T=2로 나눕니다. 원 확률과 새 확률을 구하고 문턱 1/2에서의 행동 및 문턱 7/10에서의 행동을 비교하세요.

Divide binary logitη=ln 3 by positive temperature T=2. Find original/new probabilities and compare actions at thresholds 1/2 and 7/10.

풀이와 확인할 이유Solution and explanation

원 확률은 3/4입니다. 새 오즈는 exp[(ln3)/2]=√3라 새 확률은 √3/(1+√3)=(3−√3)/2≈0.633975입니다. 로짓 부호가 양수라 문턱 1/2에서는 둘 다 행동 1입니다.

문턱 7/10에서는 원 3/4는 1,새 약 0.634는 0을 택합니다. 양의 온도가 1/2의 분류를 보존해도 모든 비용 문턱의 행동을 보존하지는 않습니다.

Original probability is 3/4. New odds are√3, so probability√3/(1+√3)=(3−√3)/2≈0.633975. Positive logit sign is unchanged; both select 1 at threshold 1/2.

At threshold 7/10, the original selects 1 and the new probability selects 0. Preserving the one-half classification does not preserve every cost-threshold action.

47. 참 조건부 확률의 보정과 역명제Calibration of the true conditional probability and its converse

P=E[Y|X]인 예측이 모집단 보정을 만족함을 보이세요. 반대로 E[Y|P]=P이면 반드시 X에 따른 모든 위험 차이를 알아낸 것인지 상수 예측으로 설명하세요.

Show that P=E[Y|X]is population-calibrated. Does E[Y|P]=P conversely recover all risk differences with X? Use a constant predictor.

풀이와 확인할 이유Solution and explanation

P가 X의 함수이므로 E[Y|P]=E[E[Y|X]|P]=E[P|P]=P입니다. 반복기대는 참 조건부 평균을 알고 있다는 가정 아래 적용됩니다.

반대로 P=E[Y]라는 상수이면 E[Y|P]=E[Y]=P이지만 X의 모든 차이를 버립니다. 보정만으로 전체 조건부 위험의 회복이나 높은 분해능을 결론 내릴 수 없습니다.

Because P is a function of X, iterated expectation gives E[Y|P]=E[E[Y|X]|P]=P.

The constant predictor P=E[Y]also satisfies calibration but discards every X-based difference. Calibration alone does not recover the full conditional probability or ensure resolution.

48. 집단 보정과 선택률Group calibration and selection rates

같은 크기의 두 모집단 집단 A,B의 사건확률은 각각 1/5,4/5입니다. 각 집단에 그 확률을 정확히 상수로 주고 문턱 1/2로 행동 1을 고릅니다. 집단별 보정과 선택률을 계산하세요.

Two equally sized population groups A, B have event probabilities 1/5,4/5. Give each its exact constant probability and select action 1 at threshold 1/2. Assess group calibration and selection rates.

풀이와 확인할 이유Solution and explanation

각 집단에서 예측 확률이 실제 확률과 같아 E[Y|P,집단]=P입니다. 따라서 둘 다 집단별 모집단 보정이 됩니다.

선택률은 A에서 0,B에서 1이며 전체는 1/2입니다. 보정은 같은 선택률을 뜻하지 않습니다. 어떤 형평·권리·의사결정 기준을 요구하는지 따로 정해야 하며 이 산술만으로 정당한 정책을 결론 내리지 않습니다.

Each group receives its true probability, so E[Y|P, group]=P and both are group-calibrated.

Selection rates are 0 in A,1 in B and 1/2 overall. Calibration does not imply equal selection. A justified policy requires separately stated fairness, rights and decision criteria.

49. label shift의 오즈 보정Odds correction under label shift

Y별 X 분포가 유지되는 label shift를 가정합니다. 과거 사건 사전비율 πold=1/5,새 비율 πnew=2/5,어떤 X의 과거 확률 pold=1/4입니다. 새 확률을 구하고 핵심 가정을 쓰세요.

Assume label shift preserves the distribution of X conditional on Y. Old/new event priors are 1/5 and 2/5; old probability at an X is 1/4. Calculate the new probability and state the crucial assumption.

풀이와 확인할 이유Solution and explanation

사전 오즈비 배율은 [(2/5)/(3/5)]/[(1/5)/(4/5)]=(2/3)/(1/4)=8/3입니다. 과거 오즈 1/3에 곱하면 새 오즈 8/9,확률 (8/9)/(17/9)=8/17입니다.

Y별 X 분포가 같고 필요한 확률이 정의된다는 가정이 핵심입니다. 단순히 사건 비율이 바뀌었다는 관측만으로 이 가정이 증명되지 않으며 임의의 구조 변화에 적용하지 않습니다.

The prior-odds multiplier is(2/3)/(1/4)=8/3. Multiply old odds 1/3 to get 8/9; new probability is 8/17.

The crucial condition is unchanged X distributions conditional on Y, with the relevant probabilities defined. A changed event rate alone does not establish it, and arbitrary structural shifts need not follow this formula.

50. 볼록 최적해가 모든 집단 비율을 맞추지는 않는다A convex optimum need not match every group frequency

단위 가중치 자료에서 X=0,1,2의 각 집단은 4행이며 성공수는 각각 1,3,1입니다. 일반 선형 로짓 a+bX에서 a=ln(5/7),b=0이 유일한 MLE임을 점수와 곡률로 확인하세요. 집단별 관측 비율과 비교하세요.

At X=0,1,2, each group contains four unit-weight rows with success counts 1,3,1. For general linear logit a+bX, verify that a=ln(5/7), b=0 is the unique MLE using score and curvature. Compare group frequencies.

풀이와 확인할 이유Solution and explanation

이 계수는 모든 예측을 5/12로 만듭니다. 절편 점수는 총 성공 5−12×5/12=0입니다. 기울기 점수도 ΣXY=0×1+1×3+2×1=5와 ΣX p=12×5/12=5가 같아 0입니다.

설계 (1,X)는 전체 열순위이고 유한 p에서 Hessian은 양정치입니다. 볼록 목적의 영기울기이므로 이 유한점이 유일한 최소손실,즉 MLE입니다. 그러나 집단 비율 (1/4,3/4,1/4)은 맞추지 못합니다. 전체 같은 점수의 관측 비율 5/12와 맞는 경험적 보정만으로 집단 위험 구조가 모두 회복되지 않습니다.

These coefficients forecast 5/12 everywhere. The intercept score is 5−12×5/12=0. The slope score also vanishes:ΣXY=0×1+1×3+2×1=5 and ΣXp=12×5/12=5.

The design(1, X)has full column rank and finite-p Hessian is positive definite. The zero-gradient point is therefore the unique convex optimum/MLE. It does not match group frequencies(1/4,3/4,1/4). Empirical calibration at one overall score does not recover every group pattern.

51. 실제 국가 기록의 사건 정의Define the event in an actual country record

보관 World Bank 2024년 USA의 GDP/명은 66856.5131698371(2015년 불변 USD),출생 시 기대수명은 78.890243902439년입니다. x=1은 GDP≥30000,y=1은 기대수명≥80일 때 x,y를 구하고 개인 생존확률 또는 정책 효과로 읽을 수 있는지 설명하세요.

The retained 2024 USA record has GDP/person 66856.5131698371 constant 2015 USD and life expectancy at birth 78.890243902439 years. Define x=1 for GDP≥30000, y=1 for expectancy≥80. Find x, y and assess individual-survival or policy-effect interpretations.

풀이와 확인할 이유Solution and explanation

GDP는 기준 이상이므로 x=1,기대수명은 80 미만이라 y=0입니다. 정답 0은 기대수명이 관측되지 않았다는 뜻이 아니라 정한 임계 사건이 성립하지 않았다는 뜻입니다.

측정 단위는 국가·연도 지표입니다. 국민 개인의 사망 여부·조건부 생존확률이나 GDP를 늘리는 개입 효과가 아니며,두 임계값도 학습자가 정한 정의입니다.

GDP is above its cutoff, so x=1; life expectancy is below 80, so y=0. This zero is an observed threshold outcome, not missingness.

The unit is a country-year indicator. It is neither an individual survival outcome nor an effect of intervening on GDP, and both thresholds are teaching definitions.

52. 실제 국가 훈련의 경계와 평활Boundary and smoothing in actual country training

실제 선택 훈련 10국에서 x=0은 성공 0·실패 4,x=1은 성공 6·실패 0입니다. 닫힌 확률 MLE와 유한 MLE 상태를 쓰고,Beta(1/2,1/2) 사후평균 및 그 두 확률의 로지스틱 계수를 구하세요.

In the actual ten-country training selection, x=0 has zero successes/four failures and x=1 six successes/no failures. State closed-space MLE probabilities and finite-MLE status, then calculate Beta(1/2,1/2)means and their logistic coefficients.

풀이와 확인할 이유Solution and explanation

원 닫힌 최대는 p₀=0,p₁=1입니다. 둘 다 유한 로짓으로 표현되지 않아 유한 MLE는 없습니다. 반횟수 평균은 p₀=(1/2)/5=1/10,p₁=(13/2)/7=13/14입니다.

평활 오즈는 1/9와 13이므로 a=−ln9,b=ln117입니다. 이 유한 계수는 Beta 사후평균을 표현하는 계수이지 원 우도의 MLE가 아닙니다.

Closed-space maxima are p₀=0, p₁=1, unattainable by finite logits, so no finite MLE exists. Half-count means are 1/10 and 13/14.

The smoothed odds are 1/9 and 13, so a=−ln 9, b=ln 117. These finite coefficients represent posterior-mean probabilities, not the original likelihood MLE.

53. 실제 국가 시험의 무한 로그손실Infinite log loss in the actual country test

실제 시험 세 국은 USA(x=1,y=0),VNM·ZAF(x=0,y=0)입니다. Beta 원 확률은 p₀=1/10,p₁=13/14,보정 지도는 두 확률을 각각 0과 1로 보냅니다. 단위 가중치의 원·보정 Brier와 로그손실을 비교하세요.

Actual test cases are USA(x=1, y=0), VNM/ZAF(x=0, y=0). Raw Beta probabilities are p₀=1/10, p₁=13/14; calibration maps these to 0 and 1. Compare unit-weight raw/mapped Brier and log loss.

풀이와 확인할 이유Solution and explanation

원 Brier는 [(13/14)²+2(1/10)²]/3=1441/4900≈0.294082입니다. 원 평균 로그손실은 [ln14+2ln(10/9)]/3≈0.949926로 유한합니다.

보정 뒤 제곱오차는 (1,0,0)라 평균 1/3입니다. USA의 비사건 확률이 0이 되어 로그손실은 양의 무한대입니다. 두 방법은 문턱 1/2에서 정확도 2/3으로 같지만 확률 평가는 다릅니다.

Raw Brier is[(13/14)²+2(1/10)²]/3=1441/4900≈0.294082. Raw mean log loss is[ln 14+2 ln(10/9)]/3≈0.949926.

Mapped squared errors are(1,0,0), mean 1/3. The realized USA nonevent receives probability zero, so mapped log loss is positive infinity. Both have accuracy 2/3 at threshold 1/2 but different probability quality.

54. 실제 임금의 원행과 가용 분모Original and available denominators in actual wage data

실제 Card 선택 자료 원행은 훈련 2301,보정 656,시험 656입니다. 같은 역할의 임금 가용수는 1933,545,539입니다. 총 원행·가용·결측과 역할별 결측을 계산하세요. 잘린 로그임금 가용수 3010을 대신 써도 되나요?

Actual Card selected source counts are 2301 training,656 calibration,656 test. Available raw wages are 1933,545,539. Calculate total and role-specific missing counts. May trimmed-log-wage availability 3010 replace these denominators?

풀이와 확인할 이유Solution and explanation

총 원행 3613,가용 3017,결측 596입니다. 역할별 결측은 368,111,117이며 합은 596입니다. 이 선택에서 교육 입력은 모두 관측되어 결측은 원 임금의 점(.)에서 옵니다.

3010은 다른 결과 필드인 잘린 로그임금의 가용수입니다. 원 wage76≥500센트라는 사건의 분모를 대신할 수 없습니다. 결과를 바꾸려면 사건 정의와 공통 행 틀을 새로 계산해야 합니다.

Totals are 3613 original rows,3017 available wages and 596 missing. Role missing counts are 368,111,117, summing to 596. Schooling is observed in this selection; missingness comes from raw-wage dots.

Availability 3010 belongs to the distinct trimmed log-wage field. It cannot replace the denominator for raw wage76≥500 cents. Changing outcomes requires redefining the event and available frame.

55. 실제 교육·임금의 기울기A slope from actual schooling/wage counts

실제 훈련에서 교육≤12 집단은 성공 479/가용 968,교육>12는 성공 628/가용 965입니다. 이진입력 MLE 확률·절편·기울기 오즈비를 구하고 인과 해석의 한계를 쓰세요.

Actual training counts are 479/968 successes for schooling≤12 and 628/965 for schooling>12. Find binary-input MLE probabilities, intercept and slope odds ratio, and state the causal limitation.

풀이와 확인할 이유Solution and explanation

실패수는 각각 489,337입니다. p₀=479/968,p₁=628/965,a=ln(479/489),exp(b)=(628/337)/(479/489)=307092/161423입니다. 따라서 b=ln(307092/161423)입니다. 모든 성공·실패수가 양수라 유한 MLE가 존재합니다.

이는 교육 임계값별 기술적 오즈비입니다. 교육은 무작위가 아니며 연령·지역·가정 배경을 여기서 조정하지 않았고 원자료는 특정 남성 코호트입니다. 교육 개입의 임금 효과나 전체 인구 효과로 읽지 않습니다.

Failures are 489 and 337. Thus p₀=479/968, p₁=628/965, a=ln(479/489), and exp(b)=307092/161423. All outcome counts are positive, so the finite MLE exists.

This is a descriptive schooling-threshold odds ratio. Schooling was not randomized, other inputs are not controlled here, and the source is a particular male cohort. It does not identify an education intervention effect.

56. 실제 임금의 보정과 비용 문턱Actual wage calibration and a cost threshold

실제 임금 보정 집단은 성공 133/265와 185/280입니다. 원 Beta 두 확률은 959/1938,419/644입니다. PAVA 지도를 구하세요. FP1/FN4에서 시험 집단의 성공수 126·182,실패수 133·98로 정확도와 평균 비용을 구하세요.

Actual wage calibration counts are 133/265 and 185/280. Raw Beta probabilities are 959/1938 and 419/644. Find the PAVA map. Under FP 1/FN 4, test successes are 126,182 and failures 133,98; calculate accuracy and mean cost.

풀이와 확인할 이유Solution and explanation

원 확률은 증가하고 보정 비율 133/265<185/280=37/56도 증가하므로 합치지 않습니다. 지도는 원 두 점수에 각각 133/265,37/56을 줍니다.

문턱 1/5보다 원·보정 네 확률이 모두 커서 시험 모든 행에 1을 예측합니다. 가용 539에서 성공 308이라 정확도 308/539=4/7,오탐은 231이라 평균 비용 231/539=3/7입니다. 확률은 변해도 이 문턱의 행동은 같습니다.

Both raw probabilities and calibration frequencies increase, so no pooling occurs. The map sends them to 133/265 and 37/56.

All raw/mapped probabilities exceed threshold 1/5, so every test action is 1. Among 539 rows,308 successes give accuracy 4/7 and 231 false positives give mean cost 3/7. Probability changes need not change this threshold’s actions.

57. 실제 불만·이탈의 확률과 오즈비Actual complaint/churn probabilities and odds ratio

실제 통신사 훈련에서 불만 없음의 이탈은 167/1654,불만 있음은 121/146입니다. 원 MLE 오즈비와 Beta(1/2,1/2) 사후평균 두 개를 구하세요.

Actual telecom training churn counts are 167/1654 without complaints and 121/146 with complaints. Calculate the raw MLE odds ratio and two Beta(1/2,1/2)posterior means.

풀이와 확인할 이유Solution and explanation

비이탈수는 1487와 25이므로 오즈비는 (121/25)/(167/1487)=179927/4175입니다. 기울기는 이 수의 자연로그입니다. 확률비 (121/146)/(167/1654)와는 다릅니다.

반횟수 평균은 (167+1/2)/(1654+1)=67/662와 (121+1/2)/(146+1)=81/98입니다. 두 집단의 다른 가용 크기를 분모에 유지하고 불만을 유발하는 개입 효과라고 해석하지 않습니다.

Nonevent counts are 1487 and 25, so the odds ratio is(121/25)/(167/1487)=179927/4175. Its logarithm is the slope, not the probability ratio.

Half-count means are 67/662 and 81/98. Retain different group denominators and do not interpret the association as an effect of causing a complaint.

58. 실제 고객 시험의 오분류 비용Misclassification costs in the actual customer test

실제 고객 시험에서 불만 없음은 이탈 80·비이탈 758,불만 있음은 이탈 56·비이탈 6입니다. 원 확률은 67/662,81/98,보정 확률은 16/139,23/33입니다. FP1/FN4 문턱에서 두 절차의 정확도·평균 비용을 구하세요.

Actual customer test counts are churn 80/retained 758 without complaints and churn 56/retained 6 with complaints. Raw probabilities are 67/662,81/98 and calibrated probabilities 16/139,23/33. Find accuracy and mean cost for both at FP 1/FN 4.

풀이와 확인할 이유Solution and explanation

문턱은 1/5입니다. 두 절차 모두 불만 없음은 그 아래라 행동 0,불만 있음은 그 위라 행동 1입니다. 맞힌 수는 758+56=814/900이라 정확도 407/450입니다.

미탐 80건은 비용 320,오탐 6건은 비용 6이라 평균은 326/900=163/450입니다. 같은 행동이므로 비용·정확도는 같지만 확률을 직접 평가한 로그손실·Brier는 다를 수 있습니다.

At threshold 1/5, both procedures choose 0 without complaints and 1 with complaints. Correct answers total 758+56=814 of 900, accuracy 407/450.

Eighty false negatives cost 320 and six false positives cost 6, so mean cost 326/900=163/450. Equal actions preserve these metrics but not probability-based Brier/log loss.

59. 실제 고객의 Brier를 빈도표로 재현Reproduce actual customer Brier from a frequency table

시험 빈도는 x=0에서 Y0=758,Y1=80,x=1에서 Y0=6,Y1=56입니다. 원 Beta 확률 p₀=67/662,p₁=81/98,보정 확률 q₀=16/139,q₁=23/33입니다. 원·보정 평균 Brier를 분수로 계산하고 개선 여부를 판단하세요.

Test counts are Y 0=758, Y 1=80 at x=0 and Y 0=6, Y 1=56 at x=1. Raw Beta probabilities are 67/662,81/98; calibrated probabilities 16/139,23/33. Compute exact raw/mapped mean Brier and assess improvement.

풀이와 확인할 이유Solution and explanation

두 확률 r₀,r₁의 Brier는 [758r₀²+80(1−r₀)²+6r₁²+56(1−r₁)²]/900입니다. 원 값을 넣으면 2284917417/26305596100≈0.086861입니다.

보정 값을 넣으면 849439603/9468256050≈0.089714로 커집니다. 이 시험 틀에서 Brier는 악화되었습니다. 모든 모집단에서 보정이 해롭다는 정리가 아니라 이 역할 배치·지도·표본의 결과입니다.

For probabilities r₀, r₁, Brier is[758 r₀²+80(1−r₀)²+6 r₁²+56(1−r₁)²]/900. Raw values give 2284917417/26305596100≈0.086861.

Mapped values give 849439603/9468256050≈0.089714, a deterioration on this test frame. This is a result for these roles, map and archive, not a theorem against calibration in every population.

60. 그래프의 작은 분모와 다른 역할Small graph denominators and different roles

실제 고객 자료의 불만 있음 집단에서 보정 이탈은 23/33,시험 이탈은 56/62입니다. 원 Beta 예측은 81/98입니다. 보정 그래프 점의 x,y와 가용 분모를 쓰고 시험 관측 비율과의 차이를 계산하세요. 시간 인과 효과로 해석할 수 있나요?

For actual complaint-positive customer records, calibration churn is 23/33 and test churn 56/62; the raw Beta forecast is 81/98. State the calibration plot point and denominator, then calculate the test-rate difference. Is this a temporal causal effect?

풀이와 확인할 이유Solution and explanation

가로축은 원 예측 81/98,세로축은 관측 보정 비율 23/33,분모는 33입니다. 시험 비율은 28/31이며 차이는 28/31−23/33=211/1023≈0.206256입니다.

역할은 원행 mod 규칙으로 나눈 것이지 시간 순 실험이 아닙니다. 두 작은 집단의 관측 비율 차이는 사건율의 인과적 시간 변화나 불만의 효과를 식별하지 않습니다. 분모·선택·정보 시점·추가 자료를 검토해야 합니다.

The calibration point is x=81/98, y=23/33 with denominator 33. The test frequency is 28/31; its difference is 211/1023≈0.206256.

Roles come from a source-row modulo rule, not a chronological experiment. The difference does not identify a causal time change or complaint effect. Inspect denominators, selection, information timing and additional evidence.

자료와 출처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