DATA-10 · DATA SCIENCE

과제·평가 지표·기준선Tasks, evaluation metrics and baselines

같은 평가 단위에서 손실·기준선·의사결정의 의미를 비교하기Compare losses, benchmarks and decisions on the same evaluation units

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

기초Foundations

1. 먼저 어떤 답을 내놓을지 정한다1. First decide what an answer should contain

주택 지수 한 숫자를 내놓는 문제, 고객이 이탈할지 이름표를 붙이는 문제, 이탈 확률을 내놓는 문제는 서로 다릅니다. 모델을 고르기 전에 관측 단위·답의 형식·사용할 정보·평가할 대상을 한 문장으로 적습니다.

이 장은 복잡한 모델을 만드는 대신 단순 기준선이 어떤 점수를 얻는지 직접 계산합니다. 낮은 점수라는 말에도 손실의 정의와 단위가 필요합니다. 점수가 같은 자료를 다시 요약한 값인지, 따로 남겨 둔 값에 대한 결과인지도 함께 밝힙니다.

Predicting one housing-index number, assigning a churn label and reporting a churn probability are different tasks. Before choosing a model, state the observation unit, answer format, available information and evaluation target.

This chapter calculates simple benchmarks before building elaborate models. A low score needs a loss definition and units. Also state whether the score summarizes reused records or predictions evaluated on separately retained outcomes.

기초Foundations

2. 관측 단위와 정답의 의미를 정한다2. Specify the unit and the meaning of the recorded target

국가 사례의 한 값은 한국의 한 분기 실질 주택가격지수입니다. 사람 사례의 목표는 1976년 시간당 센트 임금의 원 정리 로그입니다. 고객 사례의 정답 1은 원파일에서 기록한 이탈, 0은 비이탈입니다.

국가 지수 오차를 사람 임금의 달러 오차로 읽지 않습니다. 고객의 기록된 이탈도 서비스 개선을 했을 때 이탈이 얼마나 줄어드는지라는 개입 효과와 다릅니다. 정답 열을 갖고 있다는 사실이 측정·대표성·인과 식별을 모두 보증하지는 않습니다.

A country-case value is a Korean quarterly real residential property price index. The person target is the source-trimmed log of 1976 hourly wages in cents. For customers, recorded target 1 denotes churn and 0 denotes no churn.

Index-point errors are not dollar wage errors. Recorded churn also differs from the effect of an intervention intended to reduce churn. Possessing a target column does not establish measurement quality, representation or causal identification.

기초Foundations

3. 예측할 때 알 수 있는 정보만 넣는다3. Use information that is available when predicting

2023년 말에 2024년 네 분기를 예측한다고 정했다면 기준값은 2023년 이하의 값으로 만듭니다. 2024년 값은 나중에 오차를 계산할 때 열어 봅니다. 2026년에 받은 보관본을 썼다면 실제 2023년 공표 빈티지까지 확인했다고 하지 않습니다.

고객 자료 설명은 첫 9개월 입력과 12개월 이탈을 구분합니다. 하지만 원행에 고객 식별자·달력 날짜·실제 운영 배포 기록이 모두 있는 것은 아닙니다. 입력 기간의 설명과 미래 새 고객에 대한 시험 성과 인증을 구별합니다.

For a chosen end-of-2023 origin, construct four 2024 forecasts from values dated no later than 2023. Open the 2024 outcomes later for scoring. A snapshot downloaded in 2026 does not certify the prerevision vintage available during 2023.

Customer metadata distinguishes first-nine-month inputs from month-12 churn. The rows do not provide every customer identity, calendar date or deployment record. A timing description differs from validated future performance for new customers.

기초Foundations

4. 수치·이름표·확률을 구별한다4. Distinguish numbers, labels and probabilities

회귀 예측은 107.8 같은 수치를 내놓습니다. 이진 분류의 이름표는 0 또는 1입니다. 확률 예측은 0과 1 사이의 p를 내놓습니다. p=0.4는 정답이 0.4라는 뜻이 아니라 사건 1에 부여한 확률입니다.

확률을 임계값 0.5와 비교해 이름표를 만들면 p=0.1과 p=0.4가 모두 0이 될 수 있습니다. 이름표 정확도가 같아도 확률 점수는 다를 수 있습니다. 모델 출력과 평가 함수가 같은 형식을 요구하는지 먼저 확인합니다.

A regression prediction is a numerical value such as 107.8. A binary classification label is 0 or 1; a probability prediction is p between 0 and 1. The value p=0.4 is an assigned probability of event 1, not a target value of 0.4.

Thresholding at 0.5 can turn both p=0.1 and p=0.4 into label 0. Identical label accuracy can therefore coexist with different probability scores. Match the output format to the evaluation function.

기초Foundations

5. 어느 자료의 누구를 평가하는지 적는다5. State whose outcomes enter the evaluation

같은 기록을 골라 평균 상수를 계산하고 그 기록에서 오차를 구하면 훈련 내 성질을 봅니다. 기준을 만들 때 쓰지 않은 뒤 기간의 값을 평가하면 다른 범위를 봅니다. 이 장의 사례는 이 두 경우를 서로 다른 이름으로 표시합니다.

평가 단위가 분기 4개인지, 가용 사람 3,010행인지, 고객 3,150행인지도 적습니다. 집단을 같은 무게로 평균하는 것과 사람 한 명을 같은 무게로 평균하는 것은 다른 목표입니다. 서로 다른 평가 집합의 점수를 분모 없이 나란히 놓지 않습니다.

Fitting a mean constant and scoring it on those same records examines an in-data property. Scoring later outcomes that did not define the benchmark examines a different scope. The cases name these settings separately.

State whether evaluation contains four quarters, 3,010 available person records or 3,150 customer records. Equal group weighting and equal person weighting target different summaries. Do not compare scores from different evaluation sets without their denominators.

기초Foundations

6. 정답과 예측을 같은 원행에서 짝짓는다6. Pair each target with its prediction at the same source position

정답 (1, 미관측, 3)과 예측 (1, 2, 미관측)이면 완전한 평가짝은 첫 행 한 개입니다. 각 열에서 결측을 따로 지운 뒤 (1, 3)과 (1, 2)를 붙이면 존재하지 않았던 둘째 짝을 만듭니다. 이 장의 실습은 같은 원위치의 두 값이 모두 가용일 때만 포함합니다.

가용 평가짝이 0개이면 MAE·MSE·RMSE는 미정의입니다. 원행은 보존하고 제외한 위치·가용 분모를 표시합니다. 모델마다 예측 결측 위치가 다르면 점수가 다른 집합에서 나온 것일 수 있으므로 공통 평가짝에서도 다시 비교해야 합니다.

For targets (1, missing, 3) and predictions (1, 2, missing), only the first source position is a complete evaluation pair. Deleting missing entries separately would invent a second pair. The labs retain a position only when both values there are available.

With zero available pairs, MAE, MSE and RMSE are undefined. Preserve source rows and report excluded positions and the available denominator. Different missing predictions can make model scores refer to different sets; also compare a common evaluation set.

기초Foundations

7. 네 평가짝의 오차를 손으로 구한다7. Calculate the errors of four evaluation pairs

설명용 정답은 (1, 2, 3, 4), 예측은 (1, 2, 2, 5)입니다. 이 장은 오차를 정답−예측으로 정의하므로 오차는 (0, 0, 1, −1)입니다. 부호 있는 평균 오차는 0이지만 모든 예측이 맞은 것은 아닙니다.

ei=yi−y^ieˉ=014∑i∣ei∣=1214∑iei2=12\begin{gathered}e_i=y_i-\hat y_i\\\bar e=0\\\frac14\sum_i|e_i|=\frac12\\\frac14\sum_i e_i^2=\frac12\end{gathered}

양의 오차는 예측이 정답보다 작았다는 뜻입니다. 반대 부호 규칙을 쓰는 도구도 있으므로 보고서에 규칙을 적습니다. 절댓값·제곱을 쓰는 지표는 전체 부호 반전에 영향을 받지 않습니다.

Take toy targets (1, 2, 3, 4) and predictions (1, 2, 2, 5). Define error as actual minus prediction, giving (0, 0, 1, −1). Mean signed error is zero even though two predictions are wrong.

ei=yi−y^ieˉ=014∑i∣ei∣=1214∑iei2=12\begin{gathered}e_i=y_i-\hat y_i\\\bar e=0\\\frac14\sum_i|e_i|=\frac12\\\frac14\sum_i e_i^2=\frac12\end{gathered}

Positive error means underprediction. Other tools may choose the opposite sign, so state the convention. Absolute and squared errors are unchanged by reversing every error sign.

기초Foundations

8. 실습 A · 행별 오차와 세 지표를 확인한다8. Lab A · inspect row errors and three numerical scores

정답과 예측을 같은 길이로 입력하고 미관측은 null 또는 NA로 표시합니다. 이 표기는 실습 입력 약속이며 Python/R 전체 문법을 실행하는 것이 아닙니다. 각 원위치의 포함 여부·오차와 MAE·MSE·RMSE를 확인합니다.

한 예측을 크게 바꾸고 세 지표의 반응을 봅니다. 같은 자료에 점수를 냈다는 사실만으로 새 자료의 성능이 검증되지는 않습니다. 조절 결과는 JavaScript 계산이고 실제 Python/R 고정 실행은 별도 기록으로 제공합니다.

Enter equal-length target and prediction lists, using null or NA for unavailable values. This is a lab input convention, not execution of general Python/R syntax. Inspect inclusion, signed error and MAE, MSE and RMSE at each original position.

Change one prediction substantially and compare the scores. Scoring these records alone does not validate new-data performance. Controls calculate in JavaScript; actual fixed Python/R runs are separate records.

기초Foundations

9. 절대오차는 원래 단위로 읽는다9. Read absolute error in the original target unit

가용 평가짝 n≥1개에서 절댓값은 과소·과대 예측이 상쇄되는 것을 막습니다. MAE는 각 오차 크기를 같은 무게로 평균합니다.

MAE=1n∑i=1n∣yi−y^i∣\mathrm{MAE}=\frac1n\sum_{i=1}^n|y_i-\hat y_i|

지수 예측의 MAE가 1.5라면 평균 절대오차는 1.5 지수 포인트입니다. 모든 미래 오차가 1.5 이하라는 뜻은 아닙니다. 관측 집합이 달라지거나 더 큰 단위로 바꾸면 비교 해석도 다시 확인합니다.

For n≥1 available evaluation pairs, absolute values prevent underprediction and overprediction from cancelling. MAE averages error magnitudes with equal record weights.

MAE=1n∑i=1n∣yi−y^i∣\mathrm{MAE}=\frac1n\sum_{i=1}^n|y_i-\hat y_i|

An index-prediction MAE of 1.5 means an average absolute error of 1.5 index points. It does not bound every future error by 1.5. Check the evaluation set and units when comparing scores.

기초Foundations

10. 제곱오차는 큰 오차에 더 민감하다10. Squared error gives more weight to large errors

가용 평가짝 n≥1개에서 MSE는 오차 제곱의 평균입니다. 크기 4의 오차는 크기 2의 오차보다 제곱 기여가 네 배입니다.

MSE=1n∑i=1n(yi−y^i)2\mathrm{MSE}=\frac1n\sum_{i=1}^n(y_i-\hat y_i)^2

목표 단위가 지수 포인트라면 MSE 단위는 포인트²입니다. MSE 4와 MAE 2가 서로 같은 단위의 두 성과라고 읽지 않습니다. 또한 예측 오차의 분모는 평가짝 n이며, 표본분산을 추정할 때의 n−1 보정을 여기로 자동 옮기지 않습니다.

For n≥1 available pairs, MSE averages squared prediction errors. An error of magnitude 4 contributes four times as much as an error of magnitude 2.

MSE=1n∑i=1n(yi−y^i)2\mathrm{MSE}=\frac1n\sum_{i=1}^n(y_i-\hat y_i)^2

For index-point targets, MSE has squared index-point units. MSE 4 and MAE 2 do not share a unit. The evaluation denominator is n; do not import an n−1 sample-variance correction into this definition.

기초Foundations

11. 제곱근은 단위를 돌려준다11. A square root restores the target unit

RMSE는 MSE의 음이 아닌 제곱근입니다. 같은 평가짝에서 RMSE가 작다는 것과 MSE가 작다는 것은 같은 순위를 줍니다. 제곱근 함수가 증가하기 때문입니다.

RMSE=MSEMAE≤RMSE\begin{gathered}\mathrm{RMSE}=\sqrt{\mathrm{MSE}}\\\mathrm{MAE}\leq\mathrm{RMSE}\end{gathered}

둘째 부등식은 오차 절댓값에 Cauchy–Schwarz를 적용하면 얻습니다. 모든 오차 크기가 같을 때 등호가 성립합니다. 설명용 (0, 0, 1, −1)에서는 MAE=1/2, RMSE=1/√2입니다. RMSE를 썼다고 큰 오차에 대한 제곱손실의 선호가 사라지지는 않습니다.

RMSE is the nonnegative square root of MSE. On the same evaluation pairs, the two scores rank predictions identically because square root is increasing.

RMSE=MSEMAE≤RMSE\begin{gathered}\mathrm{RMSE}=\sqrt{\mathrm{MSE}}\\\mathrm{MAE}\leq\mathrm{RMSE}\end{gathered}

Apply Cauchy–Schwarz to absolute errors to obtain the inequality; equality holds when all error magnitudes are equal. For (0, 0, 1, −1), MAE is 1/2 and RMSE is 1/√2. Taking a square root does not remove the squared-loss preference concerning large errors.

기초Foundations

12. 평균은 같은 자료의 상수 MSE를 최소화한다12. The mean minimizes constant MSE on the same data

실수 가용값 y₁, …, yₙ, n≥1에 상수 c를 예측한다고 합시다. S(c)를 상수 MSE로 정의합니다. yᵢ−c=(yᵢ−ȳ)+(ȳ−c)를 제곱해 평균하면 교차항은 Σ(yᵢ−ȳ)=0으로 사라집니다.

yˉ=1n∑iyiS(c)=1n∑i(yi−c)2S(c)=S(yˉ)+(c−yˉ)2\begin{gathered}\bar y=\frac1n\sum_i y_i\\S(c)=\frac1n\sum_i(y_i-c)^2\\S(c)=S(\bar y)+(c-\bar y)^2\end{gathered}

따라서 유일한 최소 상수는 ȳ입니다. 실제 로그 자료의 평균이 같은 자료에서 중앙값보다 작은 MSE를 얻는 것은 이 항등식의 결과입니다. 새 사람에 대한 우수성은 별도 평가가 필요합니다. 확률적 조건부 평균의 최적성은 유한한 이차모멘트 같은 별도 조건 아래 뒤에서 연결합니다.

Let y₁, …, yₙ be n≥1 available real values and predict a constant c. Define S(c) as constant MSE. Expand yᵢ−c=(yᵢ−ȳ)+(ȳ−c); the cross term vanishes because centered values sum to zero.

yˉ=1n∑iyiS(c)=1n∑i(yi−c)2S(c)=S(yˉ)+(c−yˉ)2\begin{gathered}\bar y=\frac1n\sum_i y_i\\S(c)=\frac1n\sum_i(y_i-c)^2\\S(c)=S(\bar y)+(c-\bar y)^2\end{gathered}

The unique minimizing constant is therefore ȳ. Its smaller in-data MSE than a median follows from an identity, not a new-person test. A population conditional-mean result requires additional conditions such as a finite second moment.

기초Foundations

13. 중앙값은 같은 자료의 상수 MAE를 최소화한다13. A median minimizes constant MAE on the same data

가용값 n≥1개를 오름차순으로 정렬합니다. 짝수 n=2m이면 두 중앙값 y₍ₘ₎과 y₍ₘ₊₁₎ 사이 모든 c가 MAE를 최소화합니다. 홀수이면 중앙 순서값이 최소 상수입니다. 중복값 때문에 구간이 한 점으로 줄어들 수도 있습니다.

증명은 양끝값을 짝짓는 방법으로 볼 수 있습니다. a≤b에서 |a−c|+|b−c|≥b−a이며 c∈[a, b]일 때 등호입니다. 바깥부터 안쪽으로 모든 짝을 더하면 중앙 구간에서 동시에 등호가 됩니다. 홀수에 남은 중앙 항도 그 값에서 최소입니다.

∣a−c∣+∣b−c∣≥b−a|a-c|+|b-c|\geq b-a

실습은 짝수 자료의 두 중앙값 평균을 대표 중앙값으로 고릅니다. 이는 여러 최소해 중 하나를 고르는 약속이며 MAE 최소값의 유일성을 주장하지 않습니다.

Sort n≥1 available values. For even n=2m, every c between the two central order values y₍ₘ₎ and y₍ₘ₊₁₎ minimizes MAE. For odd n, the central order value is a minimizing constant. Repeated values can collapse the interval to a point.

Pair values from the outside inward. For a≤b, |a−c|+|b−c|≥b−a, with equality throughout [a, b]. All pairs attain equality simultaneously on the central interval; an odd unpaired central term is minimized at that value.

∣a−c∣+∣b−c∣≥b−a|a-c|+|b-c|\geq b-a

The lab selects the midpoint of the two central values for even samples. That is a declared selection from the minimizers, not a claim of unique MAE minimization.

기초Foundations

14. 같은 자료도 손실에 따라 다른 상수를 고른다14. Different losses can favor different constants on the same records

설명용 값 (1, 2, 3, 10)의 평균은 4, 대표 중앙값은 2.5입니다. 평균 상수의 MSE는 12.5, 중앙값 상수의 MSE는 14.75입니다. MAE는 각각 3과 2.5로 순위가 반대입니다.

큰 오차를 제곱해 더 무겁게 다루려는지, 절대오차를 같은 배율로 더하려는지는 문제의 선택입니다. 작은 지표를 본 뒤 유리한 지표만 골라 발표하지 않습니다. 정확히 무엇을 줄이려는지 미리 설명하고 큰 오차의 분포와 원행도 살펴봅니다.

For toy values (1, 2, 3, 10), the mean is 4 and the selected midpoint median is 2.5. Constant MSE is 12.5 at the mean and 14.75 at the median; MAE is respectively 3 and 2.5, reversing the ranking.

Whether to weight large errors quadratically or add absolute errors linearly is part of the task. Avoid choosing only a favorable metric after viewing results. Explain the desired loss and inspect the source rows and error distribution.

기초Foundations

15. 단위 환산과 로그 변환을 구별한다15. Distinguish unit conversion from a nonlinear target transform

실수 a≠0와 b를 써 정답·예측을 모두 y*=ay+b로 일관되게 바꾸면 오차는 a배입니다. 따라서 MAE와 RMSE는 |a|배, MSE는 a²배입니다. 센트를 달러로 바꾸는 a=1/100에서도 이 법칙이 적용됩니다.

ei∗=aeiMAE∗=∣a∣MAEMSE∗=a2MSERMSE∗=∣a∣RMSE\begin{gathered}e_i^*=a e_i\\\mathrm{MAE}^*=|a|\mathrm{MAE}\\\mathrm{MSE}^*=a^2\mathrm{MSE}\\\mathrm{RMSE}^*=|a|\mathrm{RMSE}\end{gathered}

로그를 지수화하는 변환은 아핀 변환이 아닙니다. 로그 MSE의 개선 비율을 원 달러 임금 MSE 개선 비율로 그대로 옮길 수 없습니다. 상수 exp(로그 평균)/100도 원임금 산술평균과 일반적으로 다릅니다.

Transform both targets and predictions consistently by y*=ay+b, for real a≠0 and b. Errors scale by a, so MAE and RMSE scale by |a| and MSE by a². This applies to converting cents to dollars with a=1/100.

ei∗=aeiMAE∗=∣a∣MAEMSE∗=a2MSERMSE∗=∣a∣RMSE\begin{gathered}e_i^*=a e_i\\\mathrm{MAE}^*=|a|\mathrm{MAE}\\\mathrm{MSE}^*=a^2\mathrm{MSE}\\\mathrm{RMSE}^*=|a|\mathrm{RMSE}\end{gathered}

Exponentiating a log target is not an affine transformation. A proportional improvement in log MSE need not carry over to dollar MSE. Likewise, exp(mean log)/100 generally differs from an arithmetic wage mean.

기초Foundations

16. 실습 B · 훈련값으로만 기준을 정한다16. Lab B · define a benchmark from training values only

훈련값과 평가 정답을 따로 넣습니다. 평균·중앙값은 가용 훈련값에서 구하고 마지막값·계절 기준은 원래 시간 위치를 보존합니다. 마지막 위치가 미관측이면 이전 가용값을 몰래 끌어오지 않습니다. 계절 기준은 마지막 한 주기의 같은 위치를 반복합니다.

평가 정답만 바꿔도 예측 자체가 바뀌지 않는지 확인합니다. 이 실습은 평가값을 차례로 훈련에 넣는 방식이 아니라 한 출발점에서 전체 블록을 예측합니다. 훈련에 미관측밖에 없다면 평균·중앙값은 미정의이며, 계산할 수 없는 예측을 0으로 채우지 않습니다.

Enter training values separately from evaluation outcomes. Mean and median use available training values; last-value and seasonal benchmarks retain original time positions. A missing final value is not silently replaced by an earlier available value. The seasonal rule repeats corresponding positions of the last full cycle.

Change only evaluation outcomes and verify that forecasts remain unchanged. This is one fixed origin for an entire block, not sequential updating with new outcomes. With no available training values, mean and median are undefined; unavailable forecasts are not replaced by zero.

기초Foundations

17. 기준값을 계산하는 집합을 먼저 고정한다17. Fix the records used to define a benchmark

훈련값 (1, 3)으로 평균 상수를 만들면 2입니다. 나중 평가 정답이 5이든 100이든 이 예측은 계속 2여야 합니다. 평가 정답을 100으로 바꿨더니 예측도 100으로 바뀐다면 다른 계산을 한 것입니다.

평균을 구하는 창의 시작·끝과 결측 처리도 기준의 일부입니다. 전체 과거를 쓴 평균과 마지막 4개만 쓴 평균은 이름이 같아도 다른 규칙입니다. 코드에서 훈련 선택과 오차 계산을 별도 단계로 보존합니다.

Training values (1, 3) define mean prediction 2. Whether the later evaluation outcome is 5 or 100, that prediction must stay 2. If changing the evaluation outcome also changes the forecast to 100, a different calculation has occurred.

The fitting window and missing-value policy are part of the benchmark. A mean over all past values and a mean over the last four are different rules. Retain separate code steps for selecting training values and scoring predictions.

기초Foundations

18. 정답을 미리 본 완벽한 예측은 기준이 아니다18. A perfect answer obtained by reading the target is not a benchmark

평가값 한 개가 100일 때 그 값을 보고 상수를 100으로 고르면 평가 MSE는 0입니다. 하지만 예측 시점에 몰랐던 답을 입력에 넣었으므로 미래 예측 기준이라고 부를 수 없습니다. 숫자 오류가 없어도 정보 사용 규칙을 위반할 수 있습니다.

다른 자료로 훈련했다는 말도 충분하지 않을 수 있습니다. 같은 사람의 다른 행이나 미래 시점을 통해 평가 정보가 들어올 수 있습니다. 다음 장의 분할과 누출 검토는 이 문제를 더 자세히 다룹니다. 이 장에서는 무엇으로 기준을 정했는지를 먼저 기록합니다.

If the sole evaluation outcome is 100, reading it first and choosing constant 100 gives MSE zero. The unavailable answer entered the prediction, so this is not a future forecasting benchmark. Correct arithmetic can coexist with an information-use error.

Even “trained on different rows” can be insufficient when related records or future periods reveal evaluation information. The next chapter examines splitting and leakage. Here, first record exactly what defined each benchmark.

기초Foundations

19. 한 출발점의 여러 목표를 구분한다19. Distinguish several horizons from one forecast origin

실제 한국 지수 사례는 2023-Q4라는 한 출발점에서 2024년 네 분기를 동시에 예측합니다. 마지막값 반복은 109.342를 네 번, 명시한 2023년 평균 반복은 111.483625를 네 번 사용합니다. 전년 같은 분기 기준은 2023년의 해당 분기 값을 각각 씁니다.

2024-Q1의 실제값을 받은 뒤 Q2 예측을 갱신하는 방식과 다릅니다. 네 오차가 시간상 떨어져 있다는 이유로 독립 표본이 되지도 않습니다. 이 보관본 안에서 과거 기간만 사용했다는 사실과 당시 실제 공표본을 확보했다는 사실을 구별합니다.

The Korean-index case forecasts all four 2024 quarters from one 2023-Q4 origin. Last-value repetition uses 109.342 four times; repetition of the declared 2023 mean uses 111.483625 four times. The seasonal benchmark uses each matching 2023 quarter.

This differs from updating a Q2 forecast after receiving actual Q1. Time-separated errors are not automatically independent samples. Using only past-dated periods within this snapshot also differs from possessing the actual historical release vintage.

기초Foundations

20. 계절 기준은 같은 위치를 반복하는 약속이다20. A seasonal benchmark repeats corresponding positions

설명용 시계열 (10, 20, 12, 22)의 한 주기를 2개 위치로 선언하면 마지막 주기는 (12, 22)입니다. 다음 3개 목표의 예측은 (12, 22, 12)입니다. 단순한 마지막값 반복 (22, 22, 22)과 다릅니다.

순서·주기·누락 시점이 맞아야 같은 위치라는 말이 의미를 갖습니다. 자료의 한 시점을 통째로 삭제하면 뒤 위치가 밀릴 수 있으므로 실습은 미관측 칸을 보존합니다. 계절 기준을 계산할 수 있다는 것이 실제 계절성을 입증한 것은 아닙니다. 주기 길이도 사용자가 정한 입력입니다.

For toy series (10, 20, 12, 22), declare a cycle of two positions. The last cycle is (12, 22), giving forecasts (12, 22, 12) for three targets. Last-value repetition would instead give (22, 22, 22).

Corresponding positions require an agreed order, period and missing-time policy. Deleting a time slot can shift later positions, so the lab preserves unavailable slots. Computing a seasonal benchmark does not establish actual seasonality; cycle length is a declared input.

기초Foundations

21. 훈련 내 최적성과 새 자료 성능은 다른 명제다21. In-data optimality and new-data performance are different claims

같은 가용 3,010개 로그에서 평균·중앙값을 계산하고 점수를 매기면 평균의 MSE와 중앙값의 MAE 최소성이 구성상 드러납니다. 실제 자료를 사용했어도 새 사람의 결과를 미리 맞혔다는 시험은 아닙니다.

확률적 평가 목표를 쓰려면 새 관측의 법칙을 정해야 합니다. 고정된 예측함수 f의 미래 위험을 E[L(Y, f(X))]로 쓸 때 기대값은 그 법칙에 상대적입니다. 이번 자료 평균 손실은 관측 기록의 값입니다. 서로 같아지는 조건과 추정 오차는 별도 분석 대상입니다.

Fitting and scoring mean/median constants on the same 3,010 logs reveals their in-data MSE/MAE optimality by construction. Actual records were used, but new people were not prospectively predicted.

A probabilistic evaluation target requires a law for new observations. The risk E[L(Y, f(X))] of a fixed prediction function is relative to that law. Average loss in this file is an observed-record summary. Conditions connecting the two and their estimation uncertainty require separate analysis.

기초Foundations

22. 이름표의 맞고 틀림을 네 칸으로 나눈다22. Separate label outcomes into four cells

이진 정답과 예측은 모두 0 또는 1이며 양성은 항상 정답 1로 정합니다. TP는 정답 1·예측 1, FN은 정답 1·예측 0, FP는 정답 0·예측 1, TN은 정답 0·예측 0입니다. 양성이라는 말이 가치판단상 좋은 결과라는 뜻은 아닙니다.

설명용 정답 (0, 0, 1, 1), 예측 (0, 1, 0, 1)은 네 칸에 각각 한 행씩 들어갑니다. 실제 고객에서는 양성을 이탈로 두므로 FN은 놓친 이탈자입니다. 표의 행을 실제값으로 둘지 예측값으로 둘지는 도구마다 다를 수 있어 축 라벨을 함께 읽습니다.

Both actual and predicted binary labels are 0 or 1, with positive class fixed as 1. TP means actual 1/predicted 1; FN actual 1/predicted 0; FP actual 0/predicted 1; TN actual 0/predicted 0. “Positive” does not mean a desirable outcome.

Targets (0, 0, 1, 1) and predictions (0, 1, 0, 1) place one record in each cell. With churn positive, FN is missed churn. Matrix orientation can differ between tools, so read the actual/predicted axis labels.

기초Foundations

23. 정밀도와 재현율은 서로 다른 질문이다23. Precision and recall have different denominators

가용 평가짝 n은 네 칸의 합입니다. 정확도는 모든 평가짝 중 맞은 비율입니다. 정밀도는 양성이라고 예측한 행 중 실제 양성 비율이고, 재현율은 실제 양성 중 찾아낸 비율입니다. 특이도는 실제 음성 중 음성 예측 비율입니다.

n=TP+TN+FP+FNAccuracy=(TP+TN)/nPrecision=TP/(TP+FP)Recall=TP/(TP+FN)Specificity=TN/(TN+FP)\begin{gathered}n=TP+TN+FP+FN\\\mathrm{Accuracy}=(TP+TN)/n\\\mathrm{Precision}=TP/(TP+FP)\\\mathrm{Recall}=TP/(TP+FN)\\\mathrm{Specificity}=TN/(TN+FP)\end{gathered}

각 식은 그 분모가 양수일 때만 정의합니다. 예측 양성이 0개이면 정밀도는 미정의입니다. 실제 양성이 있는데 하나도 찾지 못했다면 재현율은 정의된 0입니다. 실제 한 클래스가 없을 때 두 클래스 평균인 이 장의 균형정확도도 미정의로 남깁니다.

Available-pair count n is the sum of the four cells. Accuracy uses all pairs. Precision asks which predicted positives are actually positive; recall asks which actual positives were found. Specificity concerns correct predictions among actual negatives.

n=TP+TN+FP+FNAccuracy=(TP+TN)/nPrecision=TP/(TP+FP)Recall=TP/(TP+FN)Specificity=TN/(TN+FP)\begin{gathered}n=TP+TN+FP+FN\\\mathrm{Accuracy}=(TP+TN)/n\\\mathrm{Precision}=TP/(TP+FP)\\\mathrm{Recall}=TP/(TP+FN)\\\mathrm{Specificity}=TN/(TN+FP)\end{gathered}

Each formula needs its own positive denominator. With no predicted positives, precision is undefined. If actual positives exist but none is found, recall is a defined zero. When one actual class is absent, the two-class balanced accuracy used here also remains undefined.

기초Foundations

24. 실습 C · 빈 분모와 행별 오류를 추적한다24. Lab C · trace empty denominators and row errors

같은 원위치의 정답·예측 이름표를 넣고 네 칸으로 분류되는 행을 확인합니다. 모두 0을 예측했을 때 실제 양성이 있으면 재현율은 0이지만 정밀도는 미정의임을 확인하세요. 모든 정답·예측이 0일 때는 F1의 별도 분모도 비게 됩니다.

라이브러리가 편의를 위해 0이나 1을 반환하는 관례와 수학적 분모 미정의를 구별합니다. 이 장의 null 표시는 계산 실패를 숨기는 값이 아니라 명시한 정의 상태입니다. 양성 클래스는 1로 고정하며 임의로 뒤집어 좋은 점수만 고르지 않습니다.

Enter aligned actual/predicted labels and inspect the source positions assigned to each cell. Predict all zeros while actual positives exist: recall is zero, but precision is undefined. If every actual and predicted label is zero, the separate F1 denominator is empty too.

A library’s chosen zero-division convention differs from a mathematically empty denominator. Null explicitly records that state here. Positive class stays 1; do not reverse it merely to select a favorable score.

기초Foundations

25. 높은 정확도만으로 양성을 잘 찾았다고 하지 않는다25. High accuracy need not mean good positive-class detection

실제 고객 3,150행 중 이탈은 495, 비이탈은 2,655입니다. 항상 비이탈을 말하면 정확도는 59/70≈84.286%지만 이탈 재현율은 0입니다. 숫자 84%가 높게 들리는지보다 이 기준을 무엇에서 개선하려는지 묻습니다.

두 실제 클래스가 모두 있으면 균형정확도는 재현율과 특이도의 반반 평균입니다. 항상 한 클래스만 예측하는 규칙은 여기서 1/2입니다. 이것은 오류 비용이 실제로 같거나 다른 모집단에도 클래스 비중이 같다는 인증이 아니라 다른 가중 지표의 정의입니다.

BalancedAccuracy=Recall+Specificity2\begin{gathered}\mathrm{BalancedAccuracy}\\=\frac{\mathrm{Recall}+\mathrm{Specificity}}2\end{gathered}

Among 3,150 actual customer records, 495 show churn and 2,655 do not. Always predicting no churn achieves 59/70≈84.286% accuracy but zero churn recall. Ask what should improve over this benchmark rather than judging whether 84% sounds large.

When both actual classes exist, balanced accuracy averages recall and specificity with equal class weights. Always predicting one class gives 1/2 here. This is a different weighting rule, not evidence of equal real costs or unchanged class prevalence in another population.

BalancedAccuracy=Recall+Specificity2\begin{gathered}\mathrm{BalancedAccuracy}\\=\frac{\mathrm{Recall}+\mathrm{Specificity}}2\end{gathered}
기초Foundations

26. F1도 어떤 분모를 강조하는지 확인한다26. Check which errors enter F1

이 장은 양성 F1을 네 칸으로 직접 정의합니다. 정밀도·재현율이 모두 정의되고 그 합이 양수이면 두 값의 조화평균과 같습니다. 직접 식의 분모가 양수이면 정밀도가 미정의인 일부 경우에도 F1을 계산할 수 있습니다.

F1=2TP2TP+FP+FNF_1=\frac{2TP}{2TP+FP+FN}

실제 항상 비이탈 규칙은 TP=FP=0, FN=495라 F1=0입니다. 정밀도 0/0과 다른 정의입니다. 모두 올바른 음성만 있으면 분모도 0이어서 F1은 미정의입니다. TN이 식에 없고 비용의 크기도 들어 있지 않으므로 F1 하나가 모든 평가 목적을 대표하지 않습니다.

Define positive-class F1 directly from the four counts. When precision and recall are both defined with a positive sum, it equals their harmonic mean. The direct expression is also defined in some cases where precision is not.

F1=2TP2TP+FP+FNF_1=\frac{2TP}{2TP+FP+FN}

Always-no-churn has TP=FP=0 and FN=495, so F1 is zero although precision is 0/0. If there are only correctly predicted negatives, the F1 denominator is zero too. TN and cost magnitudes do not enter this expression, so F1 does not represent every evaluation goal.

기초Foundations

27. 같은 이름표라도 확률 점수는 다를 수 있다27. Identical labels can have different probability scores

실제 정답이 1인 한 행에 확률 0.1과 0.4를 제시했다고 합시다. 임계값 0.5에서는 둘 다 이름표 0이므로 둘 다 틀립니다. 하지만 이진 제곱 확률오차는 각각 0.81과 0.36입니다. 사건이 일어날 가능성을 다르게 말했기 때문입니다.

확률을 평가할 때는 p가 무엇의 확률인지 정합니다. 이 장에서는 정답 1의 확률입니다. 정답을 보고 실제 발생한 쪽 확률을 1로 바꾸면 예측이 아니라 정답 복사가 됩니다. 이름표 지표와 확률 지표를 같은 열에 섞지 않습니다.

For one actual target 1, consider probabilities 0.1 and 0.4. Threshold 0.5 makes both labels zero, so both are wrong. Yet their binary squared probability errors are 0.81 and 0.36 because they assigned different chances to the event.

Specify what p refers to: here it is the probability of target 1. Changing the realized event’s probability to one after reading the outcome copies the answer. Keep label metrics and probability scores distinct.

기초Foundations

28. 이진 Brier의 0~1 정의를 고정한다28. Fix the binary zero-to-one Brier convention

가용 평가짝 n≥1, 정답 yᵢ∈{0, 1}, 확률 pᵢ∈[0, 1]에서 이진 Brier는 다음과 같습니다. 이 장은 두 클래스 제곱오차를 더한 0~2 정의가 아니라 양성 확률 하나의 0~1 정의를 사용합니다.

Brier=1n∑i(yi−pi)2\mathrm{Brier}=\frac1n\sum_i(y_i-p_i)^2

완벽히 맞은 0/1 확률은 기여 0, 확신한 채 틀린 0/1 확률은 기여 1입니다. 실제 고객의 전체 이탈률 상수와 불만 집단 비율을 같은 파일에 맞춘 점수는 각각 약 0.132449와 0.094955입니다. 낮은 훈련 내 점수가 독립 시험·확률 보정만의 개선을 인증하지 않습니다.

For n≥1 available pairs, binary targets yᵢ and probabilities pᵢ between zero and one, define the following binary Brier score. We use the positive-class 0–1 convention, not a two-class sum ranging from zero to two.

Brier=1n∑i(yi−pi)2\mathrm{Brier}=\frac1n\sum_i(y_i-p_i)^2

A correct certain prediction contributes zero; a wrong certain prediction contributes one. Pooled and complaint-group probabilities fitted to the same customer file score approximately 0.132449 and 0.094955. Lower in-data loss does not establish independent test performance or improvement in calibration alone.

기초Foundations

29. 가정한 참확률에서 기대 Brier를 분해한다29. Decompose expected Brier under a stated true probability

추가 가정 Y∼Bernoulli(q), q∈[0, 1]에서 결정된 확률 p∈[0, 1]를 평가합니다. 실제 기록의 평균과 달리 여기서는 선언한 법칙에 대한 기대값입니다. 두 경우 Y=0, 1의 확률을 곱해 더하면 다음 분해를 얻습니다.

B(p)=q(1−p)2+(1−q)p2B(p)=q(1−q)+(p−q)2\begin{gathered}B(p)=q(1-p)^2+(1-q)p^2\\B(p)=q(1-q)+(p-q)^2\end{gathered}

유일한 기대손실 최소는 p=q입니다. 입력 X를 조건으로 쓰면 q는 해당 조건부 확률이어야 합니다. 이번 데이터에서 확률을 맞추고 같은 자료에 점수를 냈다는 사실만으로 그 확률이 실제 미래 q와 같아지지는 않습니다. 이론적 최적성, 적합, 일반화를 나눕니다.

Assume Y∼Bernoulli(q), with q∈[0, 1], and evaluate a fixed p∈[0, 1]. This expectation refers to the stated law, rather than an observed-file average. Weight the two outcomes to obtain the decomposition.

B(p)=q(1−p)2+(1−q)p2B(p)=q(1−q)+(p−q)2\begin{gathered}B(p)=q(1-p)^2+(1-q)p^2\\B(p)=q(1-q)+(p-q)^2\end{gathered}

The unique expected-loss minimizer is p=q. Conditional use with inputs X requires the corresponding conditional probability. Fitting and scoring on one file does not establish equality with the future q. Separate theoretical optimality, fitting and generalization.

기초Foundations

30. 자연로그 손실은 실제 일어난 사건의 확률을 본다30. Natural-log loss scores the probability of the observed event

가용짝이 n≥1개일 때, 각 가용짝에서 관측 사건의 확률을 rᵢ라 둡니다. yᵢ=1이면 rᵢ=pᵢ, yᵢ=0이면 rᵢ=1−pᵢ입니다. 자연로그 손실은 −log rᵢ의 평균입니다. 0<rᵢ≤1이면 기여는 유한한 비음수입니다.

ri={piyi=11−piyi=0LogLoss=−1n∑ilog⁡ri\begin{gathered}r_i=\begin{cases}p_i&y_i=1\\1-p_i&y_i=0\end{cases}\\\mathrm{LogLoss}=-\frac1n\sum_i\log r_i\end{gathered}

관측 사건에 정확한 확률 0을 주면 손실은 +∞입니다. 반대로 확률 1로 맞추면 기여는 0입니다. 0·log0 같은 불필요한 곱을 기계적으로 계산하지 않고 실제 관측한 쪽 확률로 정의합니다. 실습은 0이나 1을 작은 ε로 몰래 바꾸지 않습니다.

For n≥1 available pairs, let rᵢ be the probability assigned to the observed event: pᵢ when yᵢ=1 and 1−pᵢ when yᵢ=0. Natural-log loss averages −log rᵢ. For 0<rᵢ≤1, the contribution is finite and nonnegative.

ri={piyi=11−piyi=0LogLoss=−1n∑ilog⁡ri\begin{gathered}r_i=\begin{cases}p_i&y_i=1\\1-p_i&y_i=0\end{cases}\\\mathrm{LogLoss}=-\frac1n\sum_i\log r_i\end{gathered}

An exact zero probability for an observed event gives +∞ loss; a correct certain probability gives zero. Defining the observed-event probability avoids unnecessary products such as 0·log 0. The lab does not silently replace boundary probabilities by ε.

기초Foundations

31. 로그 손실의 기대 최적성과 경계를 구별한다31. Separate expected log-loss optimality from boundary cases

Y∼Bernoulli(q), 0<q<1이라고 가정합니다. 0<p<1에서 기대 로그 손실 H(p)를 미분하면 기울기의 부호가 p−q의 부호와 같습니다. 그러므로 p=q까지 감소하고 그 뒤 증가합니다.

H(p)=−qlog⁡p−(1−q)log⁡(1−p)H′(p)=p−qp(1−p)\begin{gathered}H(p)=-q\log p-(1-q)\log(1-p)\\H^\prime(p)=\frac{p-q}{p(1-p)}\end{gathered}

이 내부 q에서는 p=0 또는 p=1의 기대손실은 무한대입니다. q=0이면 −log(1−p)가 p=0에서, q=1이면 −log p가 p=1에서 각각 유일 최소입니다. 경계에서 내부 미분식을 나누어 쓰지 않습니다. 참확률의 이론적 기대 최적성이 같은 자료에서 고른 확률의 시험 성능을 보장하는 것은 아닙니다.

Assume Y∼Bernoulli(q), with 0<q<1. On 0<p<1, the derivative of expected natural-log loss has the sign of p−q, so loss decreases up to q and increases after it.

H(p)=−qlog⁡p−(1−q)log⁡(1−p)H′(p)=p−qp(1−p)\begin{gathered}H(p)=-q\log p-(1-q)\log(1-p)\\H^\prime(p)=\frac{p-q}{p(1-p)}\end{gathered}

For interior q, either boundary prediction has infinite expected loss. When q=0, −log(1−p) is uniquely minimized at p=0; when q=1, −log p is uniquely minimized at p=1. Do not divide by the interior derivative’s denominator at boundaries. This theoretical result does not guarantee test performance of fitted probabilities.

기초Foundations

32. 실습 D · 정확한 0과 표시된 0을 구별한다32. Lab D · distinguish exact zero from a displayed zero

정답과 그 정답 1에 대한 확률을 입력합니다. 확률 0·1을 맞히거나 틀린 경우의 손실을 비교하세요. 정답 1에 p=1e-400을 주면 확률 표시가 0이어도 −log p≈921.034인 유한 손실입니다. 정확히 p=0을 주면 무한 손실로 달라집니다.

정답 0에 같은 양의 p를 주면 −log(1−p)는 엄격히 양수지만 화면 근삿값은 0으로 underflow할 수 있습니다. 실습은 정확 0 여부·로그 크기·표시 상태를 함께 남깁니다. 이진 Brier는 원분수로, 초월 로그값은 근사로 구분합니다. R 고정 극소 예제는 선언한 10의 거듭제곱 로그를 해석적으로 계산한 제한 예제입니다.

Enter binary outcomes and probabilities of target 1. Compare correct and wrong predictions at probabilities zero and one. For actual target 1 and p=1e-400, the probability can display as zero while −log p≈921.034 remains finite. Exact p=0 instead gives infinite loss.

For actual target 0 and the same positive p, −log(1−p) is strictly positive but can underflow to a displayed zero. Retain exact-zero status, log magnitude and display flags. Brier uses exact fractions; transcendental logarithms are numerical. The fixed R extreme example analytically uses the declared power-of-ten logarithm, rather than a general exact-number parser.

기초Foundations

33. 같은 확률을 임계값으로 함께 분류한다33. Move tied scores together when applying a threshold

이 장의 규칙은 p≥t이면 이름표 1입니다. 같은 p를 가진 두 행이 같은 임계값에서 서로 다른 이름표를 얻지 않게 합니다. 예를 들어 확률 (0.5, 0.5, 0.25, 0.75)에서 t=0.5이면 앞 두 행과 마지막 행을 양성으로 분류합니다.

관측 확률의 서로 다른 값 사이에서는 이름표가 바뀌지 않습니다. 따라서 가능한 서로 다른 이름표 분할은 점수의 동률 묶음이 통째로 이동할 때만 바뀝니다. 실습 표는 모든 양성부터 모든 음성까지 비교합니다. 점수 1이 있으면 “항상 음성”은 [0, 1] 안의 ≥ 임계값으로 표현되지 않으므로 별도 규칙으로 표시합니다.

The rule here predicts label 1 when p≥t. Records with identical probabilities therefore move together. For scores (0.5, 0.5, 0.25, 0.75), threshold 0.5 labels the first two and last records positive.

Labels stay unchanged between distinct observed scores. Different monotone label partitions arise only as entire tied groups move. The table compares all-positive through all-negative rules. If a score is exactly one, always-negative is a separate rule rather than a ≥ threshold inside [0, 1].

기초Foundations

34. 가정 오류 비용에서 확률 임계값을 유도한다34. Derive a probability cutoff from assumed error costs

추가 모형에서 p가 해당 조건의 참 양성확률이라고 합시다. FP 비용은 c_FP≥0, FN 비용은 c_FN≥0이며 합은 양수라고 둡니다. 맞은 이름표의 비용은 0입니다. 양성을 고를 기대비용과 음성을 고를 기대비용을 비교합니다.

R(1)=cFP(1−p)R(0)=cFNpR(1)≤R(0)  ⟺  p≥cFPcFP+cFN\begin{gathered}R(1)=c_{FP}(1-p)\\R(0)=c_{FN}p\\R(1)\le R(0)\\\iff p\ge\frac{c_{FP}}{c_{FP}+c_{FN}}\end{gathered}

동률이면 두 행동의 기대비용이 같고 실습은 양성을 고릅니다. 두 비용이 모두 0이면 모든 행동이 동률이며 분수 0/0을 만들지 않습니다. 이 유도는 실제 기업 비용이나 적합 확률의 정확성을 입증한 것이 아닙니다. 확률과 비용이 의사결정 대상에 맞는지 별도 근거가 필요합니다.

Assume p is the true relevant conditional probability of a positive outcome. Let FP and FN costs be nonnegative with a positive sum; correct labels cost zero. Compare the expected costs of the two actions.

R(1)=cFP(1−p)R(0)=cFNpR(1)≤R(0)  ⟺  p≥cFPcFP+cFN\begin{gathered}R(1)=c_{FP}(1-p)\\R(0)=c_{FN}p\\R(1)\le R(0)\\\iff p\ge\frac{c_{FP}}{c_{FP}+c_{FN}}\end{gathered}

At equality both actions tie; the lab selects positive. If both costs are zero, every action ties and the cutoff is not 0/0. This derivation does not validate actual company costs or fitted probabilities. Their relevance to the decision needs separate evidence.

기초Foundations

35. 정확도 순위와 손실 순위가 바뀔 수 있다35. Accuracy and decision-loss rankings can differ

실제 고객의 세 이름표 규칙을 다시 보되 FN 한 건 20단위, FP 한 건 1단위라는 가정 손실을 선택합니다. 항상 비이탈은 20×495=9,900, 항상 이탈은 2,655, 불만 규칙은 20×295+41=5,941입니다.

이 선택에서는 정확도가 가장 낮은 항상 이탈 규칙이 셋 중 가장 작은 가정 손실을 얻습니다. 실제 이탈이 개입으로 막혔다고 계산한 수익은 아닙니다. 오류당 벌점은 이번 가정이고, 연락·관리 비용이나 개입의 성공률을 더하면 다른 의사결정 문제가 됩니다.

Choose hypothetical loss 20 per FN and one per FP for the actual customer labels. Always-no-churn loses 20×495=9,900 units; always-churn loses 2,655; the complaint rule loses 20×295+41=5,941.

Under this choice, the lowest-accuracy rule has the smallest loss among the three. These are not intervention revenues from actually preventing churn. Costs are assumptions; adding contact costs or intervention success probabilities creates another decision problem.

기초Foundations

36. 참확률의 최적 규칙과 적합된 점수를 구별한다36. Distinguish a true-probability rule from a fitted score

c_FP=1, c_FN=20이면 이론 임계값은 1/21≈0.047619입니다. 실제 파일에서 맞춘 두 불만 집단 확률 295/2909와 200/241은 모두 이 값보다 큽니다. 이 확률을 대입한 규칙은 두 집단 모두 이탈로 예측합니다.

그러나 이 파일의 집단 비율이 미래 각 고객의 참 조건부 확률과 같다는 가정은 관측만으로 확인되지 않았습니다. 같은 정답으로 확률을 맞추고 임계값까지 골랐다면 독립 시험은 더더욱 아닙니다. 참확률 아래의 조건부 기대 최적성, 이번 자료의 실현 손실, 새 환경의 성과를 별도로 보고합니다.

Costs c_FP=1 and c_FN=20 give theoretical cutoff 1/21≈0.047619. Both fitted complaint-group fractions, 295/2909 and 200/241, exceed it, so plugging them into the rule predicts churn in both groups.

Those file fractions are not established as future customers’ true conditional probabilities. Fitting probabilities and selecting a cutoff with the same labels is not independent testing. Report true-probability expected optimality, realized loss in this file and new-environment performance separately.

기초Foundations

37. 실습 E · 비용·동률·같은 자료의 최솟값을 비교한다37. Lab E · compare costs, ties and an in-data minimum

정답·확률·가정 FP/FN 비용·선택 임계값을 바꿉니다. 선택한 규칙의 네 칸·총손실과 같은 점수의 모든 동률 분할을 비교합니다. 확률이 같은 행이 임의 순서 때문에 갈라지지 않는지 확인하세요.

비용을 둘 다 0으로 바꿔 모든 후보가 동률임을 확인합니다. 표의 가장 작은 실현 손실은 같은 평가 정답을 보고 고른 결과입니다. 그 행에 “최선의 미래 정책”이라는 이름을 붙이지 않습니다. 최적 후보가 항상 음성일 때는 별도 규칙 표시와 수치 임계값을 구별합니다.

Change outcomes, probabilities, assumed FP/FN costs and the selected threshold. Compare its four cells and total loss with all partitions that retain score ties. Confirm that arbitrary row ordering never separates identical probabilities.

Set both costs to zero and inspect the resulting ties. The smallest realized loss was selected using these evaluation outcomes; it is not the best future policy. Distinguish an always-negative candidate from a numerical threshold when that special rule is needed.

기초Foundations

38. 여러 임계값의 곡선도 분모를 보존한다38. Threshold curves still require explicit denominators

실제 양성과 음성이 모두 있을 때, 각 임계값의 재현율 TPR과 거짓양성률 FPR을 구할 수 있습니다. FPR은 FP/(FP+TN)이며 1−정밀도와 다릅니다. ROC는 두 실제 클래스의 분모를, 정밀도–재현율 비교는 예측 양성 분모와 실제 양성 분모를 사용합니다.

임계값을 올리면 양성 예측 집합이 작아져 TP와 FP는 증가하지 않습니다. 정밀도는 분자·분모가 함께 바뀌므로 반드시 증가하지는 않습니다. 이 장의 임계값 표는 실제 네 칸을 보존합니다. 곡선 하나가 비용 선택·확률 보정·새 자료 성능을 동시에 인증하지 않습니다.

When actual positives and negatives both exist, each threshold gives recall TPR and false-positive rate FPR. Here FPR=FP/(FP+TN), which differs from one minus precision. ROC uses actual-class denominators; precision–recall comparisons also use a predicted-positive denominator.

Raising a threshold shrinks the positive set, so TP and FP cannot increase. Precision need not increase because its numerator and denominator both change. Retain the four counts. One curve does not simultaneously establish chosen costs, calibration and new-data performance.

기초Foundations

39. 오차 네 개가 자동으로 독립 시험 네 번이 되지 않는다39. Four errors are not automatically four independent tests

2024년 네 분기의 오차는 한 출발점에서 여러 기간을 본 것입니다. 계절·경제 충격·공통 기준값 때문에 서로 의존할 수 있습니다. n=4라는 숫자만 넣어 iid 정규 평균 CI를 자동 붙이지 않습니다.

고객 3,150행도 같은 소매 운영 환경이나 반복 단위를 포함할 수 있습니다. 평가 분할·표집·군집·시간 구조를 정하지 않은 채 정확도 소수 여섯 자리만으로 불확실성이 작다고 하지 않습니다. 이번 장은 기록된 점수를 계산하며, 불확실성 추론은 그에 맞는 별도 설계를 요구합니다.

Four quarterly errors evaluate several horizons from one origin. Seasons, common shocks and a shared benchmark can make them dependent. Entering n=4 does not automatically justify an iid-normal mean CI.

Likewise, 3,150 customer rows can share an operating environment or related units. Six decimal places of accuracy do not imply little uncertainty without a splitting, sampling, clustering or time design. This chapter computes recorded scores; inference about them needs a matching design.

대학원 연결Graduate bridge

40. 많이 비교한 뒤 고른 최솟값의 범위를 밝힌다40. Disclose selection among many evaluated candidates

같은 평가 정답에서 많은 모델·임계값·지표를 찾아 가장 작은 숫자만 고르면 선택 과정이 숨겨집니다. 검토한 후보와 선택 규칙을 보고하고, 최종 시험 자료를 별도로 둘 이유를 설명합니다. 단순 기준선을 먼저 정하는 습관이 출발점입니다.

심화 연결로, 유한한 후보 j의 무작위 평가손실 L̂ⱼ가 각각 적분 가능하다고 합시다. 모든 j에서 minₖ L̂ₖ≤L̂ⱼ이므로 기대값을 취하면 아래 상계입니다. 선택된 미래 위험 자체의 공식은 아니며, 이번 평가의 최소를 읽을 때 생기는 선택 효과를 보여 줍니다.

E[min⁡jL^j]≤min⁡jE[L^j]E[\min_j\widehat L_j]\leq\min_j E[\widehat L_j]

Searching many models, cutoffs and metrics on the same outcomes and reporting only the smallest number hides selection. Disclose candidates and rules, and explain why a separate final test set is useful. Prespecifying a simple benchmark is a starting habit.

For an advanced connection, take finitely many integrable random evaluation losses L̂ⱼ. Since their minimum is no larger than each L̂ⱼ, taking expectations gives the following bound. It is not a formula for the selected model’s future risk; it illustrates why the evaluated minimum requires care.

E[min⁡jL^j]≤min⁡jE[L^j]E[\min_j\widehat L_j]\leq\min_j E[\widehat L_j]
기초Foundations

41. 실제 코드·반환값·환경을 함께 남긴다41. Retain actual code, outputs and execution environments

이 장의 고정 프로그램은 실제 Python 3.11.8·Matplotlib 3.10.0 또는 R 4.5.1 새 프로세스에서 실행했습니다. R의 digits=17, warn=1과 두 언어의 locale·시간대도 기록합니다. 브라우저 조절은 같은 정의의 JavaScript 집계이며 두 언어를 방금 실행한 것이 아닙니다.

보관된 회귀 예제에서 정답 (1, 2, 3, 4), 예측 (1, 2, 2, 5)의 MAE·MSE는 모두 0.5입니다. 같은 계산의 짧은 Python 표현은 다음과 같습니다. 코드를 바꾸거나 새 입력을 넣어 실행하려면 내려받은 파일을 자신의 실제 언어 환경에서 실행합니다.

actual = [1, 2, 3, 4]
predicted = [1, 2, 2, 5]
errors = [y - p for y, p in zip(actual, predicted)]
mae = sum(abs(e) for e in errors) / len(errors)
mse = sum(e * e for e in errors) / len(errors)
print(mae, mse)

Fixed programs ran in fresh Python 3.11.8/Matplotlib 3.10.0 or R 4.5.1 processes. Archive R options digits=17 and warn=1, plus locale and time-zone settings. Browser controls perform JavaScript aggregation under the same definitions; they do not execute those languages.

For archived toy targets (1, 2, 3, 4) and predictions (1, 2, 2, 5), MAE and MSE are both 0.5. A short Python expression for the same calculation follows. Download the actual program and run it in a real language environment to change its code or inputs.

actual = [1, 2, 3, 4]
predicted = [1, 2, 2, 5]
errors = [y - p for y, p in zip(actual, predicted)]
mae = sum(abs(e) for e in errors) / len(errors)
mse = sum(e * e for e in errors) / len(errors)
print(mae, mse)
기초Foundations

42. 정의 경계와 브라우저 계산 범위를 나눈다42. Separate definition boundaries from browser computation limits

가용 평가짝 0개에서는 평균 손실이 미정의이고, 실제 관측 사건에 확률 0을 주면 로그 손실은 무한대입니다. 작은 양수의 표시 underflow는 둘과 다릅니다. 원값·정의 상태·로그 크기를 각각 보존합니다.

live 설명용 배열은 각 200개 위치까지 허용합니다. 정확 분수 입력의 총 자릿수 예산과 회귀 값 범위도 있습니다. 그 예산을 넘는다고 MAE나 확률 법칙이 수학적으로 사라진 것은 아닙니다. 오래된 표를 남겨 새 계산이 성공한 것처럼 보이지 않게 오류 상태와 복구를 표시합니다.

With zero available pairs, mean loss is undefined. Giving an observed event exact probability zero produces infinite log loss. Positive-value display underflow is different from both. Preserve the original value, definition status and log magnitude.

Live toy arrays allow at most 200 source positions. Exact-input digit budgets and regression-value bounds also apply. Exceeding a browser budget does not make the mathematical score or probability law disappear. Clear stale results and show error recovery explicitly.

기초Foundations

43. 실습 F · 실제 자료의 기준과 점수를 다시 계산한다43. Lab F · recompute actual benchmarks and their scores

국가는 마지막값·2023년 평균·전년 같은 분기를, 사람은 같은 자료의 평균·중앙값을, 고객은 이름표 규칙·확률 규칙을 바꿔 비교합니다. 원행 수·가용 분모·단위·적합과 평가의 재사용 여부를 함께 읽습니다.

국가 MAE와 RMSE는 같은 포인트 단위지만 MSE는 포인트²입니다. 사람의 점수는 원 정리 로그 단위이며 고객 비용은 명시한 가정 단위입니다. 범주별 성과를 시간경로처럼 선으로 연결하지 않습니다. 실제 고정 Python/R 실행 코드·출력·그림도 별도로 확인합니다.

Compare last value, the 2023 mean and matching prior quarters for the country; same-data mean/median constants for people; and label/probability rules for customers. Read source counts, available denominators, units and fitting/evaluation reuse together.

Country MAE and RMSE share index-point units; MSE uses squared points. Person scores use the recorded-log scale, and customer costs use declared hypothetical units. Do not connect categorical performance points into a supposed time path. Inspect actual fixed Python/R code, output and plots separately.

기초Foundations

44. 국가 기준선의 작은 승리를 정확히 보고한다44. Report a small benchmark comparison with its full scope

보관본에서 2023-Q4 반복의 네 목표 MAE는 약 1.575375, RMSE는 약 1.616712입니다. 명시한 2023년 평균 반복과 전년 같은 분기 기준보다 이번 두 지표가 작습니다. 평가 대상은 2024년 네 값이고 기준 출발점은 하나입니다.

이 결론을 모든 미래 시점·주택시장·출발점의 최적 예측법이라고 바꾸지 않습니다. 실제 2023년 공표 빈티지, 더 많은 출발점, 다른 지평과 기준을 검토해야 새 주장에 맞는 근거가 생깁니다. 같은 네 오차를 보고 모형을 추가 선택했다면 그 탐색도 공개합니다.

In the retained snapshot, repeating 2023-Q4 gives four-target MAE about 1.575375 and RMSE about 1.616712, below the declared 2023-mean and matching-quarter benchmarks. The evaluation has four 2024 targets and one origin.

Do not turn this result into optimal forecasting for every future period, origin or housing market. Historical release vintages, more origins and other horizons need examination. Disclose further model selection performed after viewing these four errors.

기초Foundations

45. 사람 기준선은 원 변수와 결측을 유지한다45. Retain the person variable’s scale and missing records

Card 3,613행 중 정리 로그 3,010개와 미관측 603개를 보존합니다. 가용 평균은 약 6.261832, 선택 중앙값은 약 6.286928입니다. 평균 상수는 같은 자료에서 MSE 약 0.196891, 중앙값 상수는 MAE 약 0.353750을 얻습니다.

각 지표의 최적 상수가 다른 이유를 앞의 제곱 분해와 중앙값 증명으로 설명합니다. 기록된 로그를 실제 원임금의 산술평균·현재 임금·모든 사람의 소득분포라고 바꾸지 않습니다. 미관측 집단이 달라지면 평가 목표도 달라질 수 있습니다.

Preserve all 3,613 Card rows, including 3,010 available trimmed logs and 603 unavailable values. The available mean is about 6.261832 and selected median about 6.286928. Their in-data strengths differ: mean-constant MSE is about 0.196891, while median-constant MAE is about 0.353750.

Use the square decomposition and median proof to explain the different minimizing constants. Recorded logs are not an arithmetic raw-wage mean, current wages or a representative distribution for all people. Missing-group differences can also change the evaluation target.

기초Foundations

46. 고객 성과는 이름표·확률·행동을 구분해 쓴다46. Report customer labels, probabilities and actions separately

불만 코드만으로 만든 같은 파일의 이름표 규칙은 TP=200, TN=2614, FP=41, FN=295입니다. 정확도는 67/75≈89.333%, 이탈 재현율은 40/99≈40.404%입니다. 무엇을 맞히고 무엇을 놓쳤는지 네 칸과 함께 적습니다.

같은 자료의 두 집단 확률은 Brier·로그 손실로 별도 평가하고 가정 비용에 따른 행동도 따로 계산합니다. 첫 9개월 입력과 12개월 정답이라는 사전의 설명은 유지하지만, 원행 달력 시점·고객 독립성·배포 성능·개입 성공을 이 파일의 점수로 인증하지 않습니다.

The same-file complaint-label rule has TP=200, TN=2614, FP=41 and FN=295. Accuracy is 67/75≈89.333%; churn recall is 40/99≈40.404%. Retain all four counts to show what was found and missed.

Score fitted group probabilities separately with Brier/log loss, then calculate actions under chosen costs separately again. Preserve the metadata’s first-nine-month inputs and month-12 outcome while avoiding claims of row-level calendar timing, independence, deployment performance or successful intervention from these scores.

기초Foundations

47. 세 실제 사례의 자료·기준·평가 범위를 연결한다47. Connect actual source records, benchmarks and evaluation scopes

국가 예측 문제 · 네 분기를 볼 때 먼저 이길 단순 기준을 정한다

BIS 한국 실질 주택가격지수의 실제 2023~2024년 8개 분기를 사용합니다. 목표는 2023-Q4를 기준으로 2024년 네 분기를 한꺼번에 계산한 단순 기준예측을 비교하는 것입니다. ①마지막 2023-Q4 값 반복, ②2023년 네 분기 평균 반복, ③각각 전년 같은 분기 값입니다. 후속 2024년 관측을 받아 매번 갱신하는 한 단계 예측과는 다릅니다.

중요한 자료 시점: 이번 입력은 2026년에 내려받은 보관본입니다. 2023년에 실제 공개됐던 개정 전 빈티지를 확보한 것은 아닙니다. 따라서 “2023년 당시의 실시간 예측 성과”라고 인증하지 않습니다. 이 사본 안에서 기간이 2023년 이하인 값만 기준 계산에 쓰고 2024년 값은 오차 계산에만 쓴 재구성 연습입니다. 단위는 지수 포인트이며 원화 주택가격 예측이 아닙니다.

실제 목표와 명시적 기준 값 · 소수 반올림
2024분기실제마지막 값2023평균전년 동분기
1108.3502109.3420111.483625114.8287
2107.7932109.3420111.483625111.7513
3107.4475109.3420111.483625110.0125
4107.4756109.3420111.483625109.3420
ei=yi−y^i,MAE=1n∑i∣ei∣,MSE=1n∑iei2,RMSE=MSE.\begin{aligned}e_i&=y_i-\hat y_i,\\\mathrm{MAE}&=\frac1n\sum_i|e_i|,\\\mathrm{MSE}&=\frac1n\sum_i e_i^2,\\\mathrm{RMSE}&=\sqrt{\mathrm{MSE}}.\end{aligned}
고정 한 출발점·네 목표의 오차 · 소수 반올림
기준MAE 포인트MSE 포인트²RMSE 포인트
2023-Q4 반복1.5753752.6137571.616712
2023년 평균 반복3.71700013.9480403.734707
전년 같은 분기3.71700016.9250484.114006
먼저 생각한 뒤 풀이 보기: 세 기준 중 여기서 가장 낮은 오차를 얻으면 앞으로도 최선인가요?

이 네 목표와 이 사본에서의 결과입니다. 미래 모든 출발점의 우승을 보장하지 않고, 네 오차를 독립 무작위 표본으로 가정하지 않습니다. 여러 출발점·기간 길이·개정 빈티지를 별도 검증해야 합니다. 계절 기준을 비교했다고 이 계열의 강한 계절성을 입증한 것도 아닙니다. 오차의 정의·크기·단위와 평가 범위를 함께 적습니다.

사람 회귀 문제 · 손실이 바뀌면 최선의 상수도 달라진다

Card 실제 3,613행 중 가용한 3,010개 정리 로그 임금으로 상수 두 개를 계산합니다. 원 변수는 1976년 시간당 임금(센트)의 로그이며 미가용 603행은 보존합니다. 같은 3,010개로 평균·중앙값을 고른 뒤 바로 같은 자료에서 점수를 냅니다. 이는 상수의 유한자료 성질을 배우는 훈련 내 비교이며 새 사람의 시험 성능이 아닙니다.

같은 자료에서 고르고 평가한 상수 · 소수 반올림
상수값MAE 로그MSE 로그²RMSE 로그
가용 평균6.2618320.3542080.1968910.443724
가용 중앙값6.2869280.3537500.1975210.444433
S(c)=1n∑i(yi−c)2S(c)=S(yˉ)+(c−yˉ)2\begin{gathered}S(c)=\frac1n\sum_i(y_i-c)^2\\S(c)=S(\bar y)+(c-\bar y)^2\end{gathered}
먼저 생각한 뒤 풀이 보기: 평균과 중앙값 중 하나가 계산 오류인가요?

아닙니다. 평균은 같은 자료에서 상수 MSE를 최소화하고 중앙값은 상수 MAE를 최소화합니다. 짝수 자료의 두 중앙 순서값 사이에 여러 MAE 최소 상수가 있을 수도 있으며 여기서는 두 값의 평균을 선택했습니다. 제곱오차는 큰 오차에 더 큰 무게를 줍니다. 데이터·지표·평가 대상을 같이 고정한 뒤 비교해야 합니다.

먼저 생각한 뒤 풀이 보기: 로그 MSE가 작아지면 달러 임금 MSE도 같은 비율로 작아지나요?

지수 변환은 비선형이라 일반적으로 그렇지 않습니다. 원 단위의 손실과 로그 단위의 손실은 다른 질문입니다. 또 같은 자료에서 상수를 골랐으므로 낮은 점수를 일반화 성능으로 읽지 않습니다. 다음 단계의 분할과 전처리에서도 가용 분모·원행 단위를 보존해야 합니다.

고객 분류 문제 · 정확도 84% 기준보다 무엇을 잘해야 할까?

실제 UCI 3,150고객은 이탈 495·비이탈 2,655라 “항상 비이탈”만 말해도 정확도는 2655/3150≈84.286%입니다. 그러나 이탈자 재현율은 0입니다. 비교할 이름표 규칙은 항상 비이탈, 항상 이탈, 첫 9개월 불만이 있으면 이탈 예측입니다. 마지막은 탐색에서 선택한 단순 규칙이며 독립 시험자료의 결과가 아닙니다. 실제 입력 시점과 12개월 이탈 시점은 구분하되 이 표에서 미래 성능을 검증했다고 하지 않습니다.

실제 결과와 세 이름표 규칙 · 같은 3,150행
규칙TPTNFPFN정확도 %이탈 재현율 %균형정확도 %
항상 비이탈02655049584.2860.00050.000
항상 이탈49502655015.714100.00050.000
불만 코드만20026144129589.33340.40469.430
먼저 생각한 뒤 풀이 보기: 항상 비이탈의 양성 정밀도는 0인가요?

이탈 예측 수 TP+FP가 0이라 정밀도 TP/(TP+FP)는 미정의입니다. 분모를 숨기고 0이라고 바꾸지 않습니다. 재현율은 TP/(TP+FN)=0/495=0으로 정의됩니다. 같은 0처럼 보이는 값을 만들기보다 어떤 분모가 비었는지 표시합니다. F1은 이 예의 별도 식 2TP/(2TP+FP+FN)에 따라 0입니다.

명시적 가정: 놓친 이탈 FN 한 건의 손실을 20단위, 잘못 경고한 FP를 1단위로 정하면 총손실은 20FN+FP입니다. 세 규칙의 손실은 각각 9900, 2655, 5941입니다. 이는 실제 회사의 비용·원화·USD가 아니라 학습자가 정한 예시입니다. 정확도 순위와 의사결정 손실 순위가 달라질 수 있습니다.

먼저 생각한 뒤 풀이 보기: 0/1 이름표와 확률의 점수는 같은가요?

확률 예측에는 이진 Brier=평균(y−p)²처럼 별도 점수를 쓸 수 있습니다. 이 자료의 전체 이탈률 상수와 불만 집단별 이탈률을 같은 자료로 맞추면 Brier는 각각 0.132449, 0.094955입니다. 범위 0~1의 이진 정의를 썼습니다. 같은 자료로 비율을 맞춘 점수이므로 낮아진 값이 독립 시험 성능·확률 보정을 인증하지 않습니다. 자연로그 손실도 CSV에 함께 보존하되 보정 하나만을 측정한다고 말하지 않습니다.

Country prediction task · Establish simple benchmarks before comparing models

Use eight actual 2023–2024 BIS Korean real-property-price index periods. Compare three fixed-origin benchmarks for all four 2024 quarters from a chosen 2023-Q4 cutoff: repeat the last value; repeat the 2023 four-quarter mean; or use the matching 2023 quarter. This is not a one-step forecast updated after each new 2024 observation.

Data vintage matters: inputs are a snapshot downloaded in 2026, not verified prerevision releases available during 2023. This is a reconstructed cutoff exercise within that snapshot, not certified real-time 2023 forecasting performance. Only values dated no later than 2023 define the benchmarks; 2024 values calculate errors. Units are index points, not predicted KRW housing prices.

Actual targets and explicit benchmarks · rounded
2024 quarterActualLast value2023 meanSame quarter
1108.3502109.3420111.483625114.8287
2107.7932109.3420111.483625111.7513
3107.4475109.3420111.483625110.0125
4107.4756109.3420111.483625109.3420
ei=yi−y^i,MAE=1n∑i∣ei∣,MSE=1n∑iei2,RMSE=MSE.\begin{aligned}e_i&=y_i-\hat y_i,\\\mathrm{MAE}&=\frac1n\sum_i|e_i|,\\\mathrm{MSE}&=\frac1n\sum_i e_i^2,\\\mathrm{RMSE}&=\sqrt{\mathrm{MSE}}.\end{aligned}
Errors at one fixed origin/four targets · rounded
BenchmarkMAE pointsMSE points²RMSE points
Repeat 2023-Q41.5753752.6137571.616712
Repeat 2023 mean3.71700013.9480403.734707
Matching 2023 quarter3.71700016.9250484.114006
Think first, then reveal: Does the smallest error here establish the best future method?

It is a result for four targets in this snapshot, not every future origin. Do not assume the four errors are independent random draws. Validate additional origins, horizons and vintages. Comparing a seasonal benchmark does not prove strong seasonality. Report score definition, units and evaluation scope.

Person regression task · A different loss can favor a different constant

Use the 3,010 available source-trimmed logs of 1976 hourly wages in cents from 3,613 actual Card records, preserving all 603 unavailable rows. Fit the mean and median constants and evaluate them on those same available records. This teaches finite-data properties of constants; it is not test performance for new people.

Constants fitted and scored on the same data · rounded
ConstantValueMAE logMSE log²RMSE log
Available mean6.2618320.3542080.1968910.443724
Available median6.2869280.3537500.1975210.444433
S(c)=1n∑i(yi−c)2S(c)=S(yˉ)+(c−yˉ)2\begin{gathered}S(c)=\frac1n\sum_i(y_i-c)^2\\S(c)=S(\bar y)+(c-\bar y)^2\end{gathered}
Think first, then reveal: Must either the mean or median calculation be wrong?

No. The mean minimizes in-data constant MSE; a median minimizes constant MAE. With even n, a whole interval between central order statistics can minimize MAE; we choose their midpoint. Squared loss gives more weight to larger errors. Fix the data, score and evaluation target together.

Think first, then reveal: Does an improvement in log MSE imply the same proportional improvement in dollar MSE?

No general equality follows through a nonlinear exponential transform. Losses on log and level scales ask different questions. In-data fitting also prevents interpreting these scores as generalization performance. Preserve units and source rows when later splitting and preprocessing.

Customer classification task · What should improve over an 84% baseline?

The actual UCI file has 495 churn and 2,655 non-churn records, so always predicting no churn achieves 2655/3150≈84.286% accuracy but zero churn recall. Compare always-no-churn, always-churn and the first-nine-month complaint flag as a label rule. The last is an exploratory rule, not an independent test result. Input timing precedes month-12 churn, but this table does not validate future performance.

Actual outcomes and three label rules · same 3,150 rows
RuleTPTNFPFNAccuracy %Churn recall %Balanced accuracy %
Always no churn02655049584.2860.00050.000
Always churn49502655015.714100.00050.000
Complaint flag only20026144129589.33340.40469.430
Think first, then reveal: Is precision zero for always-no-churn?

No positive labels are predicted, so TP+FP=0 and precision is undefined. Do not silently replace an empty denominator by zero. Recall is defined as 0/495=0. The separate F1 formula 2TP/(2TP+FP+FN) yields zero here. Display the actual denominator contract.

Explicit assumption: assign 20 loss units to each missed churn (FN) and one to each false alert (FP), giving 20FN+FP. Losses are 9900, 2655, 5941 for the three rules. These are chosen loss units, not actual company costs or currency. Accuracy and decision-loss rankings can differ.

Think first, then reveal: Are label scores and probability scores the same task?

Probability predictions can use binary Brier=mean(y−p)². Fitting the pooled fraction or complaint-group fractions on these same records gives 0.132449 and 0.094955. We use the binary 0–1 convention. Lower in-data scores do not certify independent test performance or calibration. Natural-log loss is also retained; neither is a pure calibration-only measure.

기초Foundations

48. 공식 정의와 이 장의 계산 약속을 대조한다48. Compare official definitions with this chapter’s explicit conventions

FPP3 5.2의 평균·마지막값·계절 기준 정의를 읽습니다. 이 장은 2023년이라는 명시한 평균 창과 한 출발점을 사용합니다. 단순 기준의 보편적 최적성을 주장하지 않습니다.

공식 scikit-learn 평가 문서에서는 이진 균형정확도·F1의 분모와 zero_division 관례·이진 Brier의 0~1 선택·보정만을 뜻하지 않는 확률 점수 설명을 지정해 읽습니다. 본문 계산은 표준 Python·base R·JavaScript의 명시 식이며 이 패키지를 실행한 기록이 아닙니다.

고정 프로그램 30개에는 빈 평가짝의 예상 실패 2개가 포함되고, 나머지 28개 중 2개 극소 확률 예제는 그림 없이 출력하므로 SVG는 26개입니다. 코드·입력·stdout·환경 해시는 재현 범위를 남기며 측정 진실성·인과·시각적 접근성을 모두 인증하지는 않습니다.

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

Read mean, last-value and seasonal definitions in FPP3 section 5.2. This chapter declares a 2023 mean window and one origin; it does not claim universal benchmark optimality.

In the official scikit-learn evaluation documentation, read binary balanced accuracy, F1 denominators/zero-division conventions, the binary 0–1 Brier choice and why probability scores do not measure calibration alone. Our recorded arithmetic uses standard Python/base R and explicit JavaScript formulas, not execution of that package.

The 30 fixed programs include two expected empty-pair failures. Of 28 successful programs, two extreme-probability examples have no plot, leaving 26 SVGs. Code, inputs, stdout and environment hashes document reproduction scope; they do not certify measurement truth, causality or actual visual accessibility.

Python · R · Inputs, units, transformations and sources

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

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

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

Crash Course · 예측이 실패하는 이유를 질문으로 바꾸기Crash Course · Turn prediction failures into questions

CrashCourse Statistics 43

공식 영상의 부족한 자료·편향된 모형·예측 한계를 보고 평가 대상·시점·기준을 먼저 적습니다. 사례의 계산식은 본문과 재현 코드에서 별도로 확인합니다.Use the official discussion of data/model limits to state the target, timing and benchmark. Verify the case score formulas separately in the chapter and reproduction code.

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

보고 읽은 뒤 답하기Respond after watching/reading 실패를 사후 설명하는 것과 사전 예측을 검증하는 것은 같나요?Is explaining a failure afterwards the same as validating an advance prediction?

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

아닙니다. 입력 가능 시점·평가 자료·사전 기준을 기록해야 합니다.No. Record information timing, evaluation data and prespecified benchmarks.

조지 박스 · 모형의 실무적 유용성을 비교하기George Box · Compare practical model usefulness

University of Wisconsin–Madison official profile

통계학과 창설과 실제 실험 문제를 강조한 소개를 읽습니다. 복잡한 식 자체보다 명시한 문제에서 기준을 얼마나 개선했는지 확인하는 습관을 연결합니다.Read the official account of the statistics-department founder and his emphasis on practical experimentation. Ask how a model improves a stated benchmark rather than judging complexity alone.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 복잡한 모델이면 기준모형 비교를 생략해도 되나요?Does a complex model remove the need for benchmarks?

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

아닙니다. 같은 목표·자료·지표·평가 조건에서 비교합니다.No. Compare the same target, data, score and evaluation conditions.

FPP3 · 단순 예측 기준과 기준 시점FPP3 · Simple forecasting benchmarks and the forecast origin

Hyndman & Athanasopoulos · Forecasting: Principles and Practice 3e, 5.2

5.2의 mean·naïve·seasonal naïve 정의만 읽습니다. 본문은 평균 창을 2023년으로 명시한 변형이며, 네 미래 목표를 한 출발점에서 계산합니다.Read the mean, naïve and seasonal-naïve definitions in 5.2. Our mean uses the explicit 2023 window and all four target periods share one origin.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 전년도 같은 분기 예측은 2024년 관측을 입력으로 쓰나요?Does a matching-2023-quarter benchmark require 2024 observations?

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

기준값 계산에는 쓰지 않고 2024년 관측은 사후 오차 계산에 씁니다. 실시간 개정 빈티지는 별도 확인이 필요합니다.Not to define the benchmark; 2024 outcomes calculate errors later. Real-time revision vintage needs separate verification.

scikit-learn 공식 · 불균형 분류와 이진 확률 점수Official scikit-learn · Imbalanced classification and binary probability scores

scikit-learn model evaluation · balanced accuracy/Brier definitions

균형정확도와 이진 Brier의 0~1 정의를 지정해 읽습니다. 문서 버전과 설치 런타임을 구별하며 여기의 재현은 표준 Python·base R 산술로 실행합니다.Read balanced accuracy and the binary 0–1 Brier convention. Online documentation is distinct from an installed runtime; our reproduction uses standard Python/base-R arithmetic.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading Brier가 낮아지면 보정만 좋아진 것인가요?Does lower Brier loss prove that calibration alone improved?

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

아닙니다. 판별력과 자료의 불확실성 등도 함께 반영하며 별도 보정 진단이 필요합니다.No. It reflects resolution and uncertainty as well; calibration needs separate diagnostics.

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

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

1. 예측 과제의 네 요소Four elements of a prediction task

고객의 다음 달 이탈을 예측하려 합니다. 관측 단위·출력 형식·입력 가능 시점·평가 대상에서 최소 한 가지씩 명시한 질문을 만드세요.

Specify a churn-prediction question with an observation unit, output format, information cutoff and evaluation target.

풀이와 확인할 이유Solution and explanation

예: 한 고객 계정의 이번 달 말까지 가용한 사용 기록으로 다음 달 이탈 확률을 예측하고, 모형 선택 때 쓰지 않은 다음 기간 계정에서 평가합니다. 계정이 자연인과 같은지, 달력 시점이 실제 자료에 있는지도 별도로 확인합니다. 이 문장을 썼다는 사실만으로 필요한 자료가 확보된 것은 아닙니다.

For example: use account records available by this month’s end to predict next-month churn probability, then evaluate later accounts unused in model selection. Verify account identity and calendar availability separately. Stating a desired design does not establish that the data support it.

2. 오차의 단위Error units

목표가 분기 주택가격지수 포인트이고 MAE=2, MSE=9, RMSE=3입니다. 세 지표의 단위를 쓰고 MSE=9를 원화 9원 손실이라고 할 수 있는지 설명하세요.

The target uses quarterly housing-index points. MAE=2, MSE=9 and RMSE=3. State each unit and whether MSE means a loss of nine won.

풀이와 확인할 이유Solution and explanation

MAE와 RMSE는 지수 포인트, MSE는 포인트²입니다. 지수점과 원화 가격은 같지 않으므로 9원 손실로 바꿀 수 없습니다. 서로 다른 지표를 비교할 때도 그 단위를 붙입니다.

MAE and RMSE use index points; MSE uses squared index points. None converts to nine won without another price/currency model. Retain units when comparing scores.

3. 정보 시점의 구분Information timing

2026년에 내려받은 보관본에서 2023년 값만 써 2024년을 예측했습니다. “2023년 당시의 실제 실시간 성과를 인증했다”를 고치세요.

A snapshot downloaded in 2026 uses only 2023-dated values to predict 2024. Repair the claim that this certifies actual real-time 2023 forecasting performance.

풀이와 확인할 이유Solution and explanation

보관본 안에서 과거 기간만 쓴 재구성 평가입니다. 실제 2023년 공표 빈티지와 이후 개정 전 값을 확보했는지는 별도 확인이 필요합니다. 기간상 과거라는 조건과 당시 이용 가능했던 값이라는 조건을 나눕니다.

It is a reconstructed cutoff exercise within that snapshot. Actual historical releases and revisions need separate verification. Past observation dates and historical information availability are different conditions.

4. 이름표와 확률Labels and probabilities

정답 1인 행에 p=0.1과 p=0.4를 각각 제시했습니다. 이름표는 p≥0.5일 때 1입니다. 두 이름표와 두 Brier 기여를 구하세요.

For actual target 1, compare probabilities 0.1 and 0.4. Predict label 1 when p≥0.5. Find both labels and Brier contributions.

풀이와 확인할 이유Solution and explanation

둘 다 이름표 0이라 틀립니다. 제곱 확률오차는 (1−0.1)²=0.81과 (1−0.4)²=0.36입니다. 이름표 오류가 같아도 제시한 확률은 다릅니다.

Both labels are zero and wrong. Contributions are 0.81 and 0.36. Identical label errors need not give identical probability scores.

5. 같은 원행의 완전짝Complete pairs at the same source position

정답 (1, null, 3), 예측 (1, 2, null)에서 같은 위치의 가용짝만 평가합니다. 가용 분모·제외 위치·MAE·MSE를 구하세요. 위치는 1부터 셉니다.

Evaluate aligned targets (1, null, 3) and predictions (1, 2, null), retaining only complete positions. Give the denominator, excluded one-based positions, MAE and MSE.

풀이와 확인할 이유Solution and explanation

첫 위치 한 개만 가용이므로 n=1, 제외 위치는 2·3입니다. 오차 0이라 MAE=MSE=0입니다. 두 열의 결측을 따로 지워 만들어지는 (3, 2)는 원래 없었던 짝입니다.

Only position one is complete: n=1, with positions two and three omitted. Its error is zero, so MAE=MSE=0. Pair (3, 2), formed after separate deletion, never existed in the source alignment.

6. 평가짝이 없는 경우No available evaluation pairs

정답 (null, 2), 예측 (1, null)에서 MAE를 계산하려 합니다. 0이라고 채우는 것을 고치세요.

Targets are (null, 2) and predictions (1, null). Repair a reported MAE of zero.

풀이와 확인할 이유Solution and explanation

같은 위치에서 두 값이 모두 가용인 짝이 없습니다. n=0이므로 평균 절대오차는 미정의입니다. 빈 오류합이 0이어도 0/0을 평균 0으로 정의하지 않습니다. 원행과 제외 이유를 보존합니다.

There are no complete aligned pairs. Mean loss is undefined at n=0. An empty error sum of zero does not turn 0/0 into mean zero; preserve the rows and omission reason.

7. 네 행의 부호 있는 오차Signed errors of four rows

설명용 정답 (1, 2, 3, 4), 예측 (1, 2, 2, 5)에서 e=y−예측으로 오차·평균 오차·MAE·MSE를 구하세요.

For toy targets (1, 2, 3, 4) and predictions (1, 2, 2, 5), use actual-minus-predicted errors. Find errors, mean signed error, MAE and MSE.

풀이와 확인할 이유Solution and explanation

오차는 (0, 0, 1, −1)입니다. 합은 0이라 평균 오차 0, 절대합과 제곱합은 모두 2라 MAE=MSE=1/2입니다. 평균 오차 0이 완벽한 예측을 뜻하지는 않습니다.

Errors are (0, 0, 1, −1). Their mean is zero, while absolute and squared sums are both two, giving MAE=MSE=1/2. Cancellation is not perfect prediction.

8. 상쇄되는 두 오차Two cancelling errors

가용 오차가 (−5, 5)입니다. 평균 오차와 MAE·MSE·RMSE를 계산하고 마지막 두 지표의 단위를 비교하세요.

Available errors are (−5, 5). Calculate mean error, MAE, MSE and RMSE, and compare the units of the last two.

풀이와 확인할 이유Solution and explanation

평균 오차 0, MAE=5, MSE=25, RMSE=5입니다. MSE는 원단위²이고 RMSE는 원단위입니다. 오차 크기가 같아서 MAE=RMSE입니다.

Mean error is zero; MAE=5, MSE=25 and RMSE=5. MSE uses squared target units and RMSE uses target units. Equal error magnitudes give MAE=RMSE.

9. 큰 오차 한 개One large error

가용 오차가 (0, 0, 0, 4)입니다. MAE·MSE·RMSE를 구하고 오류 하나가 네 지표 위치에서 어디에 기여하는지 설명하세요.

Errors are (0, 0, 0, 4). Find MAE, MSE and RMSE and identify the contributing source position.

풀이와 확인할 이유Solution and explanation

절대합 4를 4로 나눠 MAE=1, 제곱합 16을 4로 나눠 MSE=4, RMSE=2입니다. 비영 기여는 네 번째 위치 한 개이고 다른 위치를 임의로 삭제해 분모를 1로 바꾸지 않습니다.

Absolute sum four gives MAE one; squared sum sixteen gives MSE four and RMSE two. Only the fourth position contributes a nonzero term. Do not delete the other valid pairs and change the denominator to one.

10. 오차 MSE의 분모The MSE denominator

설명용 정답 (1, 3), 예측 (2, 2)의 MSE를 계산하세요. n−1로 나누는 표본분산 공식과 비교하세요.

Targets are (1, 3) and predictions (2, 2). Calculate prediction MSE and compare its denominator with an n−1 sample-variance formula.

풀이와 확인할 이유Solution and explanation

오차는 (−1, 1), 제곱합은 2입니다. 예측 MSE의 정의는 평가짝 n=2로 나누므로 1입니다. n−1로 나누면 2이지만 그것은 다른 통계이며 이 MSE 정의가 아닙니다.

Errors (−1, 1) have squared sum two. Divide by the two evaluation pairs to obtain MSE one. Division by n−1 gives another statistic, not this prediction-score definition.

11. RMSE는 MSE와 같은 순위인가Do RMSE and MSE have the same ranking?

같은 가용 평가짝에서 모델 A의 MSE=4, 모델 B의 MSE=9입니다. RMSE와 순위를 구하고 서로 다른 평가 집합에서도 직접 비교해도 되는지 설명하세요.

On identical available evaluation pairs, models A and B have MSE 4 and 9. Find RMSE and discuss comparison across different evaluation sets.

풀이와 확인할 이유Solution and explanation

RMSE는 2와 3이라 두 지표 모두 A를 더 낮게 평가합니다. 제곱근이 증가함수이기 때문입니다. 다른 평가 집합이면 이 순위 보존 논리만으로 공정한 모델 비교가 되지 않으며 공통 대상·단위·분모를 확인해야 합니다.

Their RMSE values are two and three, preserving A’s lower score because square root is increasing. Different evaluation sets still require matching targets, units and denominators for a fair comparison.

12. 절대평균과 제곱평균Absolute mean versus root mean square

실수 오차 e₁, …, eₙ, 정수 n≥1에서 MAE≤RMSE를 증명하고 등호 조건을 쓰세요.

For real errors e₁, …, eₙ with integer n≥1, prove MAE≤RMSE and give equality conditions.

풀이와 확인할 이유Solution and explanation

Cauchy–Schwarz를 절댓값 벡터와 모두 1인 벡터에 적용합니다.

(∑i∣ei∣)2≤n∑iei2(MAE)2≤MSE\begin{gathered}(\sum_i|e_i|)^2\leq n\sum_i e_i^2\\(\mathrm{MAE})^2\leq\mathrm{MSE}\end{gathered}

음이 아닌 제곱근을 취하면 결론입니다. 등호는 모든 |eᵢ|가 같은 경우이며 모두 0도 포함합니다.

Apply Cauchy–Schwarz to absolute errors and the all-ones vector.

(∑i∣ei∣)2≤n∑iei2(MAE)2≤MSE\begin{gathered}(\sum_i|e_i|)^2\leq n\sum_i e_i^2\\(\mathrm{MAE})^2\leq\mathrm{MSE}\end{gathered}

Take nonnegative square roots. Equality holds when all error magnitudes are equal, including the all-zero case.

13. 센트를 달러로Cents to dollars

센트/시간 목표의 MAE=50, MSE=10000, RMSE=100입니다. 정답과 예측을 모두 100으로 나눌 때 세 지표는 얼마인가요?

For cents/hour targets, MAE=50, MSE=10000 and RMSE=100. Convert both targets and predictions by dividing by 100. Find the new scores.

풀이와 확인할 이유Solution and explanation

MAE는 0.5달러/시간, MSE는 1(달러/시간)², RMSE는 1달러/시간입니다. 두 원수치를 같은 양의 배율로 바꾸었고 MSE에만 제곱 배율을 적용합니다.

MAE is 0.5 dollars/hour, MSE is one squared dollar/hour unit and RMSE is one dollar/hour. MSE scales by the square of the common conversion factor.

14. 음의 아핀 배율A negative affine scale

모든 정답·예측을 y*=−2y+7로 일관되게 바꿉니다. 원 MAE=3, MSE=16일 때 새 MAE·MSE·RMSE를 구하세요.

Transform every target and prediction consistently by y*=−2y+7. Original MAE=3 and MSE=16. Find transformed MAE, MSE and RMSE.

풀이와 확인할 이유Solution and explanation

오차는 −2배라 크기는 2배입니다. 새 MAE=6, MSE=64, RMSE=8입니다. +7은 두 값에서 상쇄됩니다. 음의 배율에서도 절대값과 제곱 배율이 중요합니다.

Errors change by factor −2, so MAE becomes six, MSE 64 and RMSE eight. The common shift cancels. Use an absolute scale for MAE/RMSE and a squared scale for MSE.

15. 공통 이동A common shift

정답과 예측에 모두 10을 더하면 MAE·MSE가 어떻게 되나요? 예측에만 10을 더한 경우도 같나요?

What happens to MAE and MSE after adding 10 to both targets and predictions? Is adding 10 only to predictions equivalent?

풀이와 확인할 이유Solution and explanation

두 값에 함께 더하면 차이가 보존되어 두 지표 모두 같습니다. 예측에만 더하면 새 오차는 e−10이므로 일반적으로 다릅니다. 같은 단위 변환과 예측 규칙 자체의 변경을 구별합니다.

A common shift preserves errors and both scores. Shifting only predictions changes each error to e−10 and generally changes scores. Unit-coordinate changes differ from changing the prediction rule.

16. 로그와 원값의 순위 반례A reversal between log and level losses

양수 정답은 (1, 9)입니다. 두 상수 예측 3과 5를 비교합니다. 원값 MSE를 구하고 자연로그 눈금에서는 상수 3이 더 작은 MSE인 이유를 보이세요.

Positive targets are (1, 9). Compare constant predictions 3 and 5. Find level MSE and explain why constant 3 has lower MSE on the natural-log scale.

풀이와 확인할 이유Solution and explanation

원값 MSE는 3에서 (4+36)/2=20, 5에서 (16+16)/2=16입니다. 로그 정답은 (0, log9)이며 그 평균은 log3입니다. 제곱오차 분해에 따라 log3이 유일한 최적 로그 상수이므로 log5보다 작습니다. 비선형 변환으로 순위가 뒤집힙니다.

Level MSE is twenty for prediction three and sixteen for prediction five. Log targets (0, log 9) have mean log 3, which uniquely minimizes constant log MSE. Thus log 3 beats log 5 and reverses the level ranking.

17. 평균 상수와 다른 상수A mean constant versus another constant

가용값 (1, 2, 3, 10)의 평균을 구하고 상수 c=2.5의 MSE가 평균 상수 MSE보다 얼마나 큰지 계산하세요.

For available values (1, 2, 3, 10), find the mean and the excess MSE at constant c=2.5 over the mean prediction.

풀이와 확인할 이유Solution and explanation

평균은 4입니다. 평균 상수 MSE는 12.5이고 증가량은 (2.5−4)²=2.25입니다. 따라서 MSE(2.5)=14.75입니다. 같은 자료의 정확 분해이며 새 자료의 우열을 검증한 것은 아닙니다.

The mean is four and its MSE 12.5. The excess is (2.5−4)²=2.25, giving MSE 14.75. This is an in-data identity rather than a new-data validation.

18. 평균 최소성 증명Prove mean minimization without differentiation

정수 n≥1과 유한한 실수 y₁, …, yₙ에 S(c)=n⁻¹Σ(yᵢ−c)²를 정의합니다. ȳ가 유일 최소임을 미분 없이 증명하세요.

For integer n≥1 and finite real values y₁, …, yₙ, define S(c)=n⁻¹Σ(yᵢ−c)². Prove unique minimization at ȳ without differentiation.

풀이와 확인할 이유Solution and explanation

중심화 합이 0이므로 제곱을 전개한 교차항이 사라집니다.

S(c)−S(yˉ)=(c−yˉ)2≥0S(c)-S(\bar y)=(c-\bar y)^2\geq0

등호는 c=ȳ일 때만 성립하므로 유일 최소입니다. n=1도 포함되며 이 경우 최소 제곱오차는 0입니다.

Expand around the mean; the centered sum makes the cross term vanish.

S(c)−S(yˉ)=(c−yˉ)2≥0S(c)-S(\bar y)=(c-\bar y)^2\geq0

Equality holds only at c=ȳ, proving uniqueness even when n=1.

19. 중앙값 전체 최소구간The complete median-minimizer interval

가용값 (1, 3, 7, 9)에 대한 상수 MAE의 모든 최소해와 실습이 고르는 대표값을 구하세요.

For values (1, 3, 7, 9), find all constants minimizing MAE and the lab’s selected representative.

풀이와 확인할 이유Solution and explanation

정렬된 두 중앙값은 3과 7이므로 모든 c∈[3, 7]이 최소입니다. 각 c에서 절대합은 12, MAE는 3입니다. 실습은 중점 5를 고르지만 3과 7을 비롯한 다른 최소해를 지우지 않습니다.

The middle values are three and seven, giving every c in [3, 7]. Absolute sum twelve gives MAE three throughout. The lab selects midpoint five without claiming that it is the only minimizer.

20. 홀수와 중복값An odd sample with repeated values

가용값 (2, 2, 8)의 상수 MAE 최소해·최소값과 평균 상수를 구하세요. 서로 다른 두 손실의 최적성이 왜 다를 수 있나요?

For values (2, 2, 8), find the MAE-minimizing constant, minimum MAE and mean constant. Explain why the optima may differ.

풀이와 확인할 이유Solution and explanation

중앙값 최소해는 2, 최소 MAE는 (0+0+6)/3=2입니다. 평균은 4이며 제곱손실의 유일 최소 상수입니다. 절대값과 제곱은 서로 다른 손실이므로 다른 상수를 선택해도 모순이 아닙니다.

The median minimizer is two with MAE two. Mean four uniquely minimizes squared loss. Absolute and squared losses ask different questions, so differing optimal constants are consistent.

21. 같은 값의 두 기준선Two benchmarks on the same values

가용값 (1, 2, 3, 10)에 같은 자료로 평균 4와 중앙값 대표 2.5를 적합했습니다. 두 상수의 MAE를 구하고, 평균이 MSE를 최소화한다는 사실과 모순인지 설명하세요.

Fit mean 4 and selected median 2.5 to values (1, 2, 3, 10). Calculate their MAE values and explain whether the result contradicts mean minimization of MSE.

풀이와 확인할 이유Solution and explanation

상수 4의 절대오차 합은 3+2+1+6=12라 MAE=3입니다. 상수 2.5의 합은 1.5+0.5+0.5+7.5=10이라 MAE=2.5입니다. 평균의 최소성은 제곱손실에 관한 것이므로 모순이 아닙니다. 이 비교는 같은 자료를 재사용했습니다.

The mean constant has absolute sum twelve and MAE three. The median constant has absolute sum ten and MAE 2.5. Mean minimization concerns squared loss, so there is no contradiction. Both scores reuse the fitting data.

22. 훈련 평균을 뒤 자료에 적용하기Apply a training mean to later values

훈련값 (1, 3)으로 평균 상수를 만들고, 따로 남겨 둔 정답 (5,100)에 적용합니다. 예측·MAE·MSE를 구하세요. 뒤 정답을 보고 평균을 다시 적합하지 않습니다.

Fit a mean constant using training values (1, 3), then evaluate held-aside targets (5,100). Give forecasts, MAE and MSE without refitting on the evaluation targets.

풀이와 확인할 이유Solution and explanation

훈련 평균 2를 두 번 예측합니다. 오차는 (3, 98), MAE=(3+98)/2=50.5, MSE=(9+9604)/2=4806.5입니다. 훈련 안의 최소 MSE 성질이 이 뒤 자료의 작은 손실까지 보장하지 않습니다.

Forecast (2, 2). Errors (3, 98) give MAE 50.5 and MSE 4806.5. In-training mean minimization does not guarantee a small later loss.

23. 평가 정답만 바꾼 경우Change only evaluation outcomes

훈련값 (3, 7)의 평균 기준선을 두 평가 위치에 적용합니다. 평가 정답을 (4, 6)에서 (40, 60)으로 바꿀 때 예측과 MSE가 어떻게 바뀌나요? 훈련 자료는 그대로입니다.

Fit a training-mean benchmark to (3, 7) for two evaluation positions. Change evaluation outcomes from (4, 6) to (40, 60), retaining the same training data. What changes?

풀이와 확인할 이유Solution and explanation

예측은 두 경우 모두 (5, 5)입니다. 첫 MSE는 1, 두 번째 MSE는 (35²+55²)/2=2125입니다. 정답은 점수에 영향을 주지만 이미 정한 훈련 전용 기준값을 바꾸지 않습니다.

Forecasts remain (5, 5). MSE changes from one to (35²+55²)/2=2125. Evaluation outcomes change the score, not the already fitted training-only constant.

24. 계절 위치의 반복Repeat seasonal positions

시간순 훈련값 (10, 20, 12, 22), 계절 길이 2에서 마지막 계절 블록을 반복해 뒤 세 위치를 한 출발점에서 예측합니다. 예측을 쓰세요.

Training values in time order are (10, 20, 12, 22), with season length two. Forecast the next three positions from one origin by repeating the final seasonal block.

풀이와 확인할 이유Solution and explanation

마지막 블록은 (12, 22)입니다. 뒤 세 예측은 (12, 22, 12)입니다. 새 정답을 받으며 매번 갱신하는 방식과 다르며, 한 출발점에서 선언한 블록을 반복합니다.

The final block is (12, 22), producing forecasts (12, 22, 12). This fixed-origin rule does not update whenever another outcome arrives.

25. 계절 블록의 미관측 위치An unavailable seasonal position

훈련값 (10, 20, null, 22)의 계절 길이는 2입니다. 마지막 두 위치를 그대로 반복해 정답 (12, 23, 13)을 평가하세요. 가용짝 수와 MAE·MSE도 구하세요.

Use season length two for training values (10, 20, null, 22). Repeat the final two positions to evaluate targets (12, 23, 13). Find forecasts, available-pair count, MAE and MSE.

풀이와 확인할 이유Solution and explanation

예측은 (null, 22, null)입니다. 두 번째 위치만 가용이므로 n=1, 오차 1, MAE=MSE=1입니다. null을 제거해 시간을 압축하거나 과거 20을 대신 넣지 않습니다.

Forecasts are (null, 22, null). Only the second pair is available: n=1 and MAE=MSE=1. Do not compress time after deleting nulls or silently substitute the earlier value twenty.

26. 마지막 위치와 마지막 가용값Last position versus last available value

훈련값 (1, 3, null)에서 이 장의 마지막 위치 반복 규칙으로 두 미래 위치를 예측합니다. 예측을 3으로 채워도 되나요?

Under this chapter’s last-position rule, forecast two positions after training values (1, 3, null). May both forecasts silently be filled with three?

풀이와 확인할 이유Solution and explanation

두 예측은 모두 null입니다. 마지막 시간 위치가 미관측이기 때문입니다. 마지막 가용값 3을 쓰는 것은 별도 규칙이므로, 선택했다면 이름과 정보 사용을 명시해야 합니다.

Both forecasts are null because the final time position is unavailable. Reusing the last available value three is a different rule that needs an explicit name and declaration.

27. 한 출발점과 순차 갱신One origin versus sequential updating

훈련 마지막 값이 10이고 뒤 정답은 (12, 15)입니다. 한 출발점의 마지막값 반복과, 첫 정답 12를 받은 뒤 두 번째 예측을 갱신하는 규칙의 두 예측 및 MSE를 비교하세요.

The final training value is ten and later targets are (12, 15). Compare forecasts and MSE for fixed-origin last-value repetition and a rule that updates after observing twelve.

풀이와 확인할 이유Solution and explanation

한 출발점 예측은 (10, 10), MSE=(4+25)/2=14.5입니다. 갱신 규칙은 (10, 12), MSE=(4+9)/2=6.5입니다. 정보 집합과 평가 절차가 다르므로 같은 규칙의 계산 오류로 읽지 않습니다.

Fixed-origin forecasts (10, 10) give MSE 14.5. Updated forecasts (10, 12) give MSE 6.5. They use different information sets and evaluation procedures.

28. 실제 네 분기의 마지막값 기준An actual four-quarter last-value benchmark

보관본의 2023-Q4 값 109.3420을 반복해 2024년 정답 (108.3502, 107.7932, 107.4475, 107.4756)을 예측합니다. MAE·MSE를 구하고 무엇을 비교했는지 적으세요.

Repeat archived 2023-Q4 value 109.3420 for 2024 targets (108.3502, 107.7932, 107.4475, 107.4756). Find MAE and MSE, and state the evaluation scope.

풀이와 확인할 이유Solution and explanation

오차는 (−0.9918, −1.5488, −1.8945, −1.8664)입니다.

MAE=126038000=1.575375MSE=1045502789400000000\begin{gathered}\mathrm{MAE}=\frac{12603}{8000}=1.575375\\\mathrm{MSE}=\frac{1045502789}{400000000}\end{gathered}

MAE 단위는 지수 포인트, MSE는 포인트²입니다. 2026년 보관본의 한 출발점·네 목표 비교이며 실제 2023년 공표 빈티지나 보편적 미래 최적성을 확인한 것은 아닙니다.

Errors are (−0.9918, −1.5488, −1.8945, −1.8664).

MAE=126038000=1.575375MSE=1045502789400000000\begin{gathered}\mathrm{MAE}=\frac{12603}{8000}=1.575375\\\mathrm{MSE}=\frac{1045502789}{400000000}\end{gathered}

Units are index points and squared points. This is one origin with four targets in a 2026 snapshot; it does not verify historical release vintages or universal future optimality.

29. 같은 MAE와 다른 MSEEqual MAE with different MSE

정답 (0, 0)에 예측 A=(1, 3), B=(2, 2)를 제시했습니다. 두 MAE·MSE·RMSE를 구하고 같은 MAE가 모든 오차 크기 정보를 보존하는지 설명하세요.

For targets (0, 0), forecasts are A=(1, 3) and B=(2, 2). Calculate MAE, MSE and RMSE and discuss the information retained by equal MAE.

풀이와 확인할 이유Solution and explanation

두 MAE는 모두 2입니다. A의 MSE는 5, RMSE는 √5이고 B의 MSE는 4, RMSE는 2입니다. 같은 절대합이라도 제곱합은 다를 수 있습니다. 한 요약값이 전체 오차 벡터를 대신하지 않습니다.

Both MAE values are two. A has MSE five and RMSE √5; B has MSE four and RMSE two. Equal absolute sums can hide different squared sums and error patterns.

30. 같은 사람 자료의 최소값A minimum on the same person records

Card의 가용 정리 로그 3,010개로 평균 상수를 적합하고 같은 3,010개에서 MSE를 최소화했습니다. 이것이 미관측 603명과 미래 새 사람에게도 최선임을 보이나요? 원행은 3,613개입니다.

Fit a mean to 3,010 available Card trimmed logs and minimize MSE on those same values. Does this establish optimality for 603 unavailable records or future people? There are 3,613 source rows.

풀이와 확인할 이유Solution and explanation

보이지 않습니다. 정확 최소성은 적합과 평가에 같은 가용값을 쓴 결과입니다. 원행 3,613·가용 3,010·미관측 603을 보고하고 결측 집단 및 미래 평가의 별도 조건을 밝혀야 합니다.

No. Exact minimization refers to the reused available values. Report 3,613 source rows, 3,010 available logs and 603 unavailable values, then state separate assumptions for missing groups and future evaluation.

31. 네 칸의 손계산Calculate all four cells

정답 (0, 0, 1, 1), 예측 이름표 (0, 1, 0, 1)에서 양성은 1입니다. TP·TN·FP·FN과 정확도·정밀도·재현율·특이도·F1을 구하세요.

Actual labels are (0, 0, 1, 1) and predictions (0, 1, 0, 1), with positive class one. Find TP, TN, FP, FN, accuracy, precision, recall, specificity and F1.

풀이와 확인할 이유Solution and explanation

네 칸은 각각 1입니다. 정확도 1/2, 정밀도 1/2, 재현율 1/2, 특이도 1/2, F1=1/2입니다. 분모가 우연히 같더라도 정의상 서로 다른 모집합을 셉니다.

Each cell equals one. All five requested scores equal 1/2, although their definitions use different denominator sets.

32. 양성을 전혀 예측하지 않음Predict no positives

정답 (0, 1, 1)에 예측 (0, 0, 0)을 냈습니다. 정확도·정밀도·재현율·F1을 이 장의 분모 규칙으로 구하세요.

Actual labels are (0, 1, 1) and predictions (0, 0, 0). Calculate accuracy, precision, recall and F1 under this chapter’s denominator conventions.

풀이와 확인할 이유Solution and explanation

TN=1, FN=2, TP=FP=0입니다. 정확도는 1/3, 정밀도는 0/0이라 미정의, 재현율은 0, 직접 식 F1=2TP/(2TP+FP+FN)은 0입니다. 미정의 정밀도를 임의로 0으로 바꾸어 얻은 결과가 아닙니다.

TN=1, FN=2 and TP=FP=0. Accuracy is 1/3; precision is undefined; recall and the direct F1 formula are zero. The F1 result does not require replacing undefined precision by zero.

33. 실제도 예측도 모두 음성All actual and predicted labels are negative

정답 (0, 0), 예측 (0, 0)에서 정확도·정밀도·재현율·특이도·F1·균형정확도를 구하세요. 미정의 분모는 그대로 표시합니다.

For actual labels (0, 0) and predictions (0, 0), find accuracy, precision, recall, specificity, F1 and balanced accuracy. Preserve undefined denominators.

풀이와 확인할 이유Solution and explanation

TN=2이고 나머지는 0입니다. 정확도 1, 특이도 1입니다. 정밀도·재현율·F1은 분모 0으로 미정의입니다. 두 실제 클래스의 재현율을 평균하는 균형정확도도 이 장에서는 미정의입니다.

TN=2 and the other cells are zero. Accuracy and specificity are one. Precision, recall and F1 are undefined, as is this chapter’s balanced accuracy requiring both actual classes.

34. 실제 음성이 없는 경우No actual negatives

정답 (1, 1), 예측 (1, 0)에서 이탈 재현율·특이도·균형정확도를 구하세요. 양성은 1입니다.

For actual labels (1, 1) and predictions (1, 0), find positive-class recall, specificity and balanced accuracy.

풀이와 확인할 이유Solution and explanation

TP=1, FN=1, TN=FP=0입니다. 재현율은 1/2입니다. 실제 음성 분모가 0이라 특이도는 미정의이며, 따라서 두 실제 클래스의 균형정확도도 미정의입니다.

TP=1, FN=1 and TN=FP=0. Recall is 1/2. With no actual negatives, specificity and this chapter’s two-class balanced accuracy are undefined.

35. 실제 불만 규칙의 분모Denominators for the actual complaint rule

실제 고객 불만 규칙의 TP=200, TN=2614, FP=41, FN=295입니다. 정밀도·재현율·F1을 구하고 각 분모를 설명하세요.

The actual complaint rule has TP=200, TN=2614, FP=41 and FN=295. Find precision, recall and F1 and explain their denominators.

풀이와 확인할 이유Solution and explanation

정밀도는 200/241, 재현율은 200/495=40/99입니다. F1은 400/(400+41+295)=25/46입니다. 정밀도는 예측 이탈 241행, 재현율은 실제 이탈 495행을 분모로 씁니다.

Precision is 200/241, recall is 40/99 and F1 is 25/46. Precision uses 241 predicted positives; recall uses 495 actual positives.

36. 불균형 자료의 기준 정확도A baseline accuracy under imbalance

실제 3,150행 중 이탈 495행, 비이탈 2,655행입니다. 항상 비이탈 예측의 정확도와 균형정확도를 구하고 이탈 발견 능력을 설명하세요.

Among 3,150 actual records, 495 churn and 2,655 do not. Find always-no-churn accuracy and balanced accuracy, and describe its ability to find churn.

풀이와 확인할 이유Solution and explanation

정확도는 2655/3150=59/70≈84.286%입니다. 이탈 재현율 0과 비이탈 특이도 1의 평균은 1/2입니다. 큰 정확도만으로 이탈을 발견했다고 할 수 없습니다.

Accuracy is 59/70≈84.286%. Recall zero and specificity one give balanced accuracy 1/2. High overall accuracy does not imply finding any churn cases.

37. 양성 이름을 바꾸기Rename the positive class

이탈을 양성으로 둔 TP=2, TN=6, FP=2, FN=0 표에서 비이탈을 양성으로 다시 이름 붙입니다. 새 네 칸과 새 재현율을 구하세요.

With churn positive, TP=2, TN=6, FP=2 and FN=0. Rename no-churn as positive in both actual and predicted labels. Find the new cells and recall.

풀이와 확인할 이유Solution and explanation

정답과 예측의 0/1 의미를 함께 뒤집으면 새 TP=6, TN=2, FP=0, FN=2입니다. 새 재현율은 6/8=3/4로 원래 특이도와 같습니다. 맞힌 행 수는 그대로이며 양성 이름 변경이 성능 개선은 아닙니다.

New cells are TP=6, TN=2, FP=0 and FN=2. Recall becomes 3/4, the original specificity. Correct-row count is unchanged; renaming the positive class is not an improvement.

38. 가정 벌점에 따른 순위Ranking under assumed error costs

실제 이름표 규칙의 (FP, FN)은 항상 비이탈 (0,495), 항상 이탈 (2655, 0), 불만 규칙 (41,295)입니다. FP 비용 1, FN 비용 20에서 총손실과 최소 규칙을 구하세요.

The (FP, FN) pairs are (0,495), (2655, 0) and (41,295) for always-no-churn, always-churn and complaint rules. With FP cost one and FN cost twenty, find total losses and the minimum.

풀이와 확인할 이유Solution and explanation

총손실은 차례로 9900, 2655, 5941입니다. 세 규칙 중 항상 이탈이 최소입니다. 이 벌점은 가정이며 실제 개입 수익·예방 가능 이탈·기업 비용을 측정한 결과는 아닙니다.

Losses are 9,900, 2,655 and 5,941; always-churn is smallest among these three. These are assumed penalties, not measured intervention revenues, preventable churn or actual firm costs.

39. 비율과 퍼센트포인트Fractions, percentages and percentage points

같은 평가 자료의 정확도가 0.80에서 0.85로 변했습니다. 정확도 차이를 비율과 퍼센트포인트로, 원 정확도 대비 상대 증가를 퍼센트로 쓰세요.

Accuracy on the same evaluation set rises from 0.80 to 0.85. Give the fractional difference, percentage-point difference and relative percentage increase.

풀이와 확인할 이유Solution and explanation

차이는 비율 0.05, 즉 5퍼센트포인트입니다. 원 정확도 대비 상대 증가는 0.05/0.80=0.0625, 즉 6.25%입니다. 단위를 쓰지 않고 모두 “5% 개선”이라고 합치지 않습니다.

The difference is 0.05, or five percentage points. Relative increase is 0.05/0.80=6.25%. The three descriptions need their respective units.

40. 거짓양성률의 분모The false-positive-rate denominator

TP=2, TN=6, FP=2, FN=0입니다. FPR과 1−정밀도를 계산해 같지 않음을 보이세요.

With TP=2, TN=6, FP=2 and FN=0, calculate FPR and one minus precision to show that they differ.

풀이와 확인할 이유Solution and explanation

FPR=2/(2+6)=1/4입니다. 정밀도는 2/(2+2)=1/2라 1−정밀도=1/2입니다. 실제 음성 8행과 예측 양성 4행이라는 다른 분모를 사용합니다.

FPR=2/8=1/4; one minus precision equals 1−2/4=1/2. Their denominators are actual negatives and predicted positives, respectively.

41. Brier 손실 두 개Two Brier contributions

정답 (0, 1)에 확률 (0.1, 0.8)을 제시했습니다. 이진 0~1 Brier 평균을 구하세요.

For actual labels (0, 1) and probabilities (0.1, 0.8), calculate the binary 0–1 Brier mean.

풀이와 확인할 이유Solution and explanation

기여는 0.1²=0.01과 (1−0.8)²=0.04입니다. 평균은 0.025=1/40입니다. 두 클래스 오차를 다시 합해 두 배로 만드는 다른 관례를 적용하지 않습니다.

Contributions 0.01 and 0.04 average to 0.025=1/40. Do not double it by summing a separate error for both classes under another convention.

42. Brier의 참확률 최소성Brier minimization at the true probability

Y∼Bernoulli(q), 0≤q≤1이고 상수 확률 p∈[0, 1]을 제시합니다. E[(Y−p)²]=q(1−q)+(p−q)²를 유도하고 최소해를 구하세요.

Let Y∼Bernoulli(q), with 0≤q≤1, and quote constant probability p∈[0, 1]. Derive E[(Y−p)²]=q(1−q)+(p−q)² and find the minimum.

풀이와 확인할 이유Solution and explanation

Y−p=(Y−q)+(q−p)를 전개하면 E[Y−q]=0이라 교차항이 사라집니다. E[(Y−q)²]=q(1−q)이므로 식을 얻습니다. 최소해는 p=q로 유일하며 q=0, 1도 포함합니다. 참확률 아래의 기대값 명제이고 한 파일의 실현 최솟값과는 다릅니다.

Expand Y−p=(Y−q)+(q−p). The centered cross term vanishes, leaving variance q(1−q) plus squared discrepancy. The unique minimum is p=q, including boundary q. This is an expectation under the true law, not an assertion about a realized file minimum.

43. 참확률과 다른 확률의 기대 점수Expected scores for two quoted probabilities

Y∼Bernoulli(1/4)에서 상수 p=1/2와 p=1/4의 기대 Brier 손실을 구하세요.

For Y∼Bernoulli(1/4), find expected Brier loss at p=1/2 and p=1/4.

풀이와 확인할 이유Solution and explanation

참분산은 3/16입니다. p=1/2에서는 3/16+(1/4)²=1/4이고, p=1/4에서는 3/16입니다. 증가량은 1/16입니다.

Variance is 3/16. Quoting 1/2 adds discrepancy 1/16, giving 1/4. Quoting 1/4 gives 3/16.

44. 자연로그 손실의 평균Mean natural-log loss

정답 (0, 1), 확률 (0.1, 0.8)의 자연로그 손실을 식으로 구하세요. 로그 밑을 10으로 바꾸지 않습니다.

For outcomes (0, 1) and probabilities (0.1, 0.8), give mean natural-log loss. Do not change to base-ten logarithms.

풀이와 확인할 이유Solution and explanation

실제로 관측된 사건에 준 확률은 0.9와 0.8입니다. 평균 손실은 −(ln0.9+ln0.8)/2=−ln0.72/2≈0.1642520335입니다. Brier 0.025와는 단위·정의가 다른 점수입니다.

Observed-event probabilities are 0.9 and 0.8, giving −ln(0.72)/2≈0.1642520335. Its definition and scale differ from Brier 0.025.

45. 확률 끝점의 진짜 무한대A genuinely infinite endpoint loss

정답 1에 p=1과 p=0을 각각 제시했습니다. 두 자연로그 손실을 구하고 무한대를 표시 underflow와 구별하세요.

For actual outcome one, compare p=1 and p=0 under natural-log loss. Distinguish infinity from display underflow.

풀이와 확인할 이유Solution and explanation

p=1이면 −ln1=0입니다. p=0이면 관측 사건에 확률 0을 주었으므로 손실은 +∞입니다. 이는 작은 양수가 숫자 표시에서 0으로 보이는 경우와 다르며 임의 ε로 바꾸면 점수 정의가 달라집니다.

At p=1 the loss is zero; at p=0 it is +∞. This differs from a positive probability displayed as zero. Replacing zero by an arbitrary epsilon changes the scoring rule.

46. 극소 양수의 유한 로그 손실A finite log loss for a tiny positive probability

정답 1에 정확한 양수 확률 p=10⁻⁴⁰⁰을 제시했습니다. 자연로그 손실과 보통 부동소수점에서 p가 0으로 보일 때의 해석을 쓰세요.

For actual outcome one, quote exact p=10⁻⁴⁰⁰. Find natural-log loss and interpret a floating-point display of zero for p.

풀이와 확인할 이유Solution and explanation

손실은 400ln10≈921.0340372로 유한합니다. p의 표시 underflow를 참확률 0으로 오해해 +∞로 만들지 않습니다. 원 확률 문자열과 로그를 보존해야 합니다.

Loss is the finite value 400 ln 10≈921.0340372. Probability display underflow does not make the true probability zero or the loss infinite; retain the original input and its logarithm.

47. 극소 양수의 작은 비영 손실A small but nonzero loss

이번에는 정답 0에 p=10⁻⁴⁰⁰을 제시합니다. 손실의 부호·유한성·표시 0의 의미를 설명하세요.

Now quote p=10⁻⁴⁰⁰ for actual outcome zero. Discuss the loss sign, finiteness and a numerical display of zero.

풀이와 확인할 이유Solution and explanation

손실 −ln(1−10⁻⁴⁰⁰)은 엄격 양수이고 유한하며 약 10⁻⁴⁰⁰입니다. 수치 표시가 0이어도 정확한 영 손실이 아닙니다. 로그 손실 크기의 로그는 약 −400ln10이며 로그 크기와 손실 자체를 구별합니다.

Loss −ln(1−10⁻⁴⁰⁰) is finite and strictly positive, approximately 10⁻⁴⁰⁰. A zero display is not exact zero loss. Its magnitude has logarithm about −400 ln 10; distinguish that logarithm from the loss itself.

48. 같은 이름표와 다른 확률 점수Identical labels with different probability scores

정답 (0, 1)에서 확률 A=(0.4, 0.6), B=(0.1, 0.9)입니다. 임계값은 ≥0.5입니다. 이름표 정확도와 Brier를 비교하세요.

For outcomes (0, 1), compare A=(0.4, 0.6) and B=(0.1, 0.9) at threshold ≥0.5. Find label accuracy and Brier.

풀이와 확인할 이유Solution and explanation

둘 다 이름표 (0, 1)로 정확도 1입니다. A의 Brier는 0.16, B는 0.01입니다. 이름표 정확도만으로 이 확률들의 차이를 구분하지 못합니다. 이 두 행의 비교가 모든 환경의 보정을 입증하지도 않습니다.

Both produce labels (0, 1) and accuracy one. Brier is 0.16 for A and 0.01 for B. Label accuracy misses the difference; these two records do not establish general calibration either.

49. 가정 비용의 임계값 증명Derive the assumed-cost cutoff

p가 참 조건부 양성확률이고 맞은 행동 비용은 0입니다. FP 비용 a≥0, FN 비용 b≥0, a+b>0에서 양성을 고르는 기대비용 최소 조건을 유도하세요.

Let p be the true conditional positive probability and correct actions cost zero. With FP cost a≥0, FN cost b≥0 and a+b>0, derive when predicting positive minimizes expected cost.

풀이와 확인할 이유Solution and explanation

양성 행동의 기대비용은 a(1−p), 음성은 bp입니다. a(1−p)≤bp를 풀면 p≥a/(a+b)입니다. 등호에서는 두 행동이 동률입니다. 참확률과 비용의 관련성이 전제이며 적합된 파일 비율이 자동으로 이를 만족하는 것은 아닙니다.

Compare a(1−p) with bp. The positive action is optimal when p≥a/(a+b), with both actions tied at equality. The interpretation requires relevant true probabilities and costs; fitted file fractions do not automatically supply them.

50. 임계값의 기대비용 동률Expected-cost tie at a threshold

FP 비용 1, FN 비용 20, 참 조건부 확률 p=1/21입니다. 두 행동의 기대비용과 이 장의 ≥ 규칙이 고르는 행동을 구하세요.

FP cost is one, FN cost twenty and the true conditional probability is 1/21. Find both expected costs and the action selected by the lab’s ≥ convention.

풀이와 확인할 이유Solution and explanation

양성 비용 1×20/21과 음성 비용 20×1/21은 모두 20/21입니다. 두 행동이 최적 동률이며 실습의 ≥ 관례는 양성을 고릅니다. 이 관례가 양성 행동의 엄격한 우월성을 뜻하지는 않습니다.

Both costs equal 20/21. Both actions minimize expected cost; the ≥ convention selects positive without implying strict superiority.

51. 비용이 모두 영인 경우Both error costs are zero

FP와 FN 비용이 모두 0입니다. a/(a+b)를 임계값 0으로 보고 유일 최적 행동을 주장해도 되나요?

When FP and FN costs are both zero, may a/(a+b) be reported as cutoff zero with a unique optimal action?

풀이와 확인할 이유Solution and explanation

안 됩니다. 분수는 0/0으로 정의되지 않고 모든 행동의 비용이 0이라 동률입니다. 실습은 이론 임계값을 미정의로 두고 모든 후보의 손실 0을 보존합니다.

No. The fraction is undefined 0/0 and every action has zero cost. Preserve all ties and an undefined theoretical cutoff.

52. 동률 점수를 함께 이동하기Move tied scores together

정답 (0, 1, 0, 1), 확률 (1/2, 1/2, 1/4, 3/4), FP 비용 1, FN 비용 20입니다. ≥ 임계값 1/4, 1/2, 3/4 및 별도 항상 음성 규칙의 총손실을 구하세요.

Outcomes are (0, 1, 0, 1), probabilities (1/2, 1/2, 1/4, 3/4), FP cost one and FN cost twenty. Find losses at ≥ cutoffs 1/4, 1/2, 3/4 and for a separate always-negative rule.

풀이와 확인할 이유Solution and explanation

네 손실은 차례로 2, 1, 20, 40입니다. 1/2에서 앞 두 동률 행은 모두 양성이므로 FP=1, FN=0입니다. 최소 실현 손실 1은 이 평가 정답을 보고 고른 값이며 독립 미래 성과가 아닙니다.

Losses are two, one, twenty and forty. At 1/2, both tied first records remain positive, giving FP=1 and FN=0. The evaluated minimum one was selected using these outcomes, not an independent future test.

53. 항상 음성을 수치 임계값으로 쓰지 못할 때When always-negative has no allowed numerical cutoff

확률 배열에 p=1인 행이 있습니다. ≥ 임계값 규칙에서 t∈[0, 1]만 허용할 때 항상 음성을 만드는 t가 있나요?

A score array contains p=1. Under a ≥ threshold with t restricted to [0, 1], does any allowed t predict every record negative?

풀이와 확인할 이유Solution and explanation

없습니다. p=1인 행은 모든 허용 t에서 양성입니다. 항상 음성 후보를 비교하려면 별도 규칙으로 표시하거나 허용 임계값 영역을 명시적으로 바꿔야 합니다. t=1을 항상 음성이라고 부르지 않습니다.

No. The score-one record remains positive for every allowed threshold. Represent always-negative as a separate rule or explicitly change the threshold domain. Cutoff one is not always-negative here.

54. 선택한 평가 최솟값의 기대값Expectation of a selected evaluation minimum

유한한 J≥1개 후보의 무작위 평가손실 L̂₁, …, L̂ⱼ가 모두 적분 가능합니다. E[minⱼL̂ⱼ]≤minⱼE[L̂ⱼ]를 증명하고 선택된 미래 위험 공식인지 설명하세요.

Let finitely many J≥1 random evaluation losses L̂₁, …, L̂ⱼ be integrable. Prove E[minⱼL̂ⱼ]≤minⱼE[L̂ⱼ] and state whether it is a selected model’s future-risk formula.

풀이와 확인할 이유Solution and explanation

유한 최소의 절댓값은 Σ|L̂ⱼ| 이하이므로 적분 가능합니다. 각 j에서 minₖL̂ₖ≤L̂ⱼ입니다. 기대값을 취한 뒤 오른쪽의 최소를 취하면 결론입니다. 같은 평가에서 고른 최솟값의 명제이며 선택된 모델의 별도 미래 손실 자체를 계산한 공식은 아닙니다.

The minimum is integrable because its magnitude is bounded by the sum of absolute losses. It is no larger than each candidate loss; take expectations and then the minimum of their expectations. This concerns the selected evaluation minimum, not a separate future-risk formula.

55. 임계값을 높이면 정밀도도 높아지는가Must precision increase with a threshold?

정답 (0, 1, 1), 확률 (0.9, 0.8, 0.1)입니다. ≥ 임계값을 0.1에서 0.8로 높일 때 정밀도·재현율을 비교하세요.

Outcomes are (0, 1, 1), probabilities (0.9, 0.8, 0.1). Compare precision and recall when a ≥ threshold rises from 0.1 to 0.8.

풀이와 확인할 이유Solution and explanation

0.1에서는 모두 양성으로 정밀도 2/3, 재현율 1입니다. 0.8에서는 첫 두 행만 양성으로 정밀도 1/2, 재현율 1/2입니다. TP와 FP가 증가하지 않아도 분자·분모가 함께 바뀌는 정밀도는 낮아질 수 있습니다.

At 0.1 all records are positive: precision 2/3 and recall one. At 0.8 only the first two are positive: precision and recall 1/2. Precision can decrease even though TP and FP cannot increase.

56. 네 오차의 독립성Independence of four errors

한 출발점에서 뒤 네 분기의 오차를 얻었습니다. n=4라는 이유만으로 iid 정규 평균 구간을 자동 붙이는 주장을 고치세요.

Four quarterly errors come from one forecast origin. Repair the claim that n=4 automatically justifies an iid-normal mean interval.

풀이와 확인할 이유Solution and explanation

같은 출발점·계절·공통 충격은 오차의 의존을 만들 수 있습니다. 네 개라는 개수는 독립성이나 정규성을 보증하지 않습니다. 실제 오차와 기간을 보고하고 표집·시간 구조와 맞는 불확실성 모형을 별도로 정해야 합니다.

A common origin, seasons and shared shocks can create dependence. Count four establishes neither independence nor normality. Report the periods and errors, then justify a matching uncertainty model separately.

57. 실제 실행 기록의 개수Count actual execution records

고정 프로그램 30개 중 빈 평가짝으로 예상 실패한 것이 2개입니다. 성공한 것 중 극소 확률 출력 전용 2개에는 그림이 없습니다. 성공 프로그램과 SVG 수, 브라우저 조절의 실행 언어를 쓰세요.

Of 30 fixed programs, two are expected empty-pair failures. Two successful extreme-probability programs print results without plots. State successful-program and SVG counts, and the language used by live browser controls.

풀이와 확인할 이유Solution and explanation

성공 프로그램은 28개, SVG는 26개입니다. 보관 Python/R은 실제 새 프로세스 실행 기록이고 live 브라우저 조절은 JavaScript 계산입니다. 기록 선택이나 JavaScript 집계를 새 Python/R 실행이라고 부르지 않습니다.

There are 28 successful programs and 26 SVGs. Archived Python/R records came from actual fresh processes; live browser controls calculate in JavaScript. Neither selecting a record nor changing a browser control is a fresh Python/R execution.

58. 표본분산과 훈련 MSESample variance and training MSE

같은 가용 실수 y₁, …, yₙ, 정수 n≥2에서 평균 상수의 훈련 MSE와 표본분산 s²=(n−1)⁻¹Σ(yᵢ−ȳ)²의 관계를 쓰세요. 훈련 MSE가 미래 성과 신뢰구간인가요?

For the same finite real values y₁, …, yₙ with integer n≥2, relate training MSE at the mean constant to sample variance s²=Σ(yᵢ−ȳ)²/(n−1). Is training MSE a future-performance confidence interval?

풀이와 확인할 이유Solution and explanation

훈련 MSE=(n−1)s²/n입니다. 분모와 쓰임이 다른 통계이며 같은 값의 제곱합을 공유합니다. 훈련 MSE 하나만으로 미래 성과의 신뢰구간을 얻지 못하며 평가 설계와 추론 조건이 더 필요합니다.

Training MSE=(n−1)s²/n. They share a centered squared sum but have different denominators and purposes. One training score is not a future-performance interval; an evaluation design and inferential conditions are still required.

59. 짧은 결과 보고서의 범위Scope a short results report

2026년 보관본에서 2023-Q4 반복이 2024년 네 분기에 가장 작은 MAE를 얻었습니다. 보고서에 정보 시점·평가 지평·비교 후보·추가 선택을 포함한 두 문장을 쓰세요.

In a 2026 snapshot, repeating 2023-Q4 has the smallest MAE over four 2024 targets. Write two sentences disclosing timing, horizon, candidates and further selection.

풀이와 확인할 이유Solution and explanation

예: “2026년 보관본에서 2023년 이하 값으로 만든 마지막값·2023년 평균·전년 같은 분기 기준을 한 출발점의 2024년 네 목표에서 비교했고 마지막값 MAE가 가장 작았다. 실제 2023년 빈티지와 다른 출발점은 검증하지 않았으며, 이 결과를 본 뒤 추가 후보를 선택했다면 그 목록과 규칙을 별도로 공개한다.”

Example: “Within a 2026 snapshot, we compared last value, a declared 2023 mean and matching prior quarters at one origin over four 2024 targets; last value had the lowest MAE. Historical 2023 vintages and other origins were not verified, and any additional candidates selected after seeing these errors must be disclosed with their selection rule.”

60. 고객 결과의 최종 감사A final audit of customer results

같은 파일의 불만 규칙은 TP=200, TN=2614, FP=41, FN=295이고 항상 이탈 규칙은 FP=2655, FN=0입니다. 불만 규칙의 정확도·재현율·FP 비용 1/FN 비용 20의 총손실을 구해 항상 이탈과 비교하고 미래 정책 주장을 제한하세요.

The same-file complaint rule has TP=200, TN=2614, FP=41, FN=295; always-churn has FP=2655 and FN=0. Find complaint accuracy, recall and total loss at FP cost one/FN cost twenty. Compare losses and limit any future-policy claim.

풀이와 확인할 이유Solution and explanation

정확도는 2814/3150=67/75, 재현율은 200/495=40/99, 가정 손실은 41+20×295=5941입니다. 항상 이탈의 가정 손실 2655보다 큽니다. 같은 자료 적합·평가와 가정 벌점을 보고하며 새 고객의 성능·실제 기업 비용·개입 성공을 확정하지 않습니다.

Accuracy is 67/75, recall 40/99 and assumed loss 41+20×295=5941, above always-churn loss 2655. Disclose same-data fitting/evaluation and hypothetical penalties. These results establish neither new-customer performance, actual firm costs nor intervention success.

자료와 출처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