ML-04 · MACHINE LEARNING

선형 회귀·정규화·Ridge·LassoLinear regression, regularization, ridge and lasso

계수 해집합·단위·검증 규칙을 분리해 정규화를 이해한다Understand regularization through solution sets,units and validation rules

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

학부Undergraduate

1. 같은 직선인데 계수는 왜 다른가1. Why can different coefficients give the same line?

설명용 훈련 표는 두 행입니다. 첫 행의 (X₁,X₂,Y)는 (−1,−1,−1), 둘째 행은 (1,1,1)입니다. 절편 a를 포함한 예측 a+b₁X₁+b₂X₂를 씁니다. 두 설명변수가 같으므로 a=0, b₁+b₂=1이면 훈련 손실은 모두 0입니다. (1,0), (0,1), (1/2,1/2)는 서로 다른 계수이지만 같은 두 예측을 만듭니다.

새 입력 (1,0)에서는 세 예측이 각각 1, 0, 1/2입니다. 훈련 예측의 유일성과 계수 또는 새 예측의 유일성을 구별해야 합니다. 계산기가 한 답을 반환했다는 사실만으로 자료가 그 답을 식별했다고 결론 내리지 않습니다.

이 장은 선형 예측의 목적함수를 먼저 고정하고, 해집합·선택 규칙·훈련 밖 평가를 차례로 정의합니다. 벌점의 종류와 크기, 단위 변환, 선택에 사용한 정보는 학습 규칙의 일부입니다.

Use an assumed two-row training table: (X₁,X₂,Y) is (−1,−1,−1) and (1,1,1). Predict a+b₁X₁+b₂X₂ with an intercept. Because the input columns coincide, every a=0 and b₁+b₂=1 gives zero training loss. Coefficients (1,0), (0,1) and (1/2,1/2) produce identical fitted values.

At a new input (1,0), their predictions are 1, 0 and 1/2. Unique fitted values do not imply unique coefficients or off-support predictions. A program returning one answer does not establish that the observations identify it.

We first specify a linear prediction objective, then its entire solution set, a selection rule and evaluation beyond training. Penalty type, magnitude, coordinate units and information used in selection belong to the learning rule.

학부Undergraduate

2. 같은 가용 행과 양의 가중치 합2. One shared available frame and positive total weight

n은 유한한 양의 정수이고 xᵢ는 p차원 유한 벡터, yᵢ는 유한 수치라고 합시다. 기록에 결측이 있으면 모든 비교 방법에 같은 완전행 규칙을 적용합니다. 가중치는 유한한 비음수 값이며, 그 규칙을 통과한 행의 가중치 합 W는 양수여야 합니다. 0 가중치 행은 원자료에 남지만 목적함수에는 기여하지 않습니다.

이 장의 실습은 p=1 또는 2를 정확 분수로 계산합니다. 이것은 정리의 일반 차원과 계산 도구의 유한 범위를 구별하기 위한 제한입니다. 개인 자료에서는 원임금이 미관측인 행을 원행 틀에 남기고 적합 분모에서는 제외합니다.

가용 행이 없거나 양의 가중치 합이 0이면 정규화 손실은 미정의입니다. 이때 계수 0과 손실 0을 만들어 넣지 않습니다. 시험자료의 가용 분모도 별도로 보고해야 합니다.

Let n be a finite positive integer, each xᵢ a finite p-vector and yᵢ a finite numerical outcome. With missing records, use the same complete-row rule for every compared method. Weights are finite and nonnegative, with a positive sum W over the retained complete rows. Zero-weight records remain in the source frame but do not contribute to the objective.

The labs compute p=1 or 2 using exact fractions. The tool has a finite scope distinct from the general-dimensional theorems. In the person case, unavailable raw wages remain in the original row frame and are excluded from the fitting denominator.

With no available positive-weight observations, normalized loss is undefined. Do not invent zero coefficients and zero loss. Evaluation frames need their own available denominators.

학부Undergraduate

3. 손실의 1/2는 λ의 뜻을 바꾼다3. The factor 1/2 changes the meaning of lambda

예측 오차를 eᵢ=yᵢ−a−xᵢᵀb로 둡니다. 기본 자료 손실은 가중 제곱오차 합을 2W로 나눈 것입니다. 평균제곱오차 MSE는 이 값의 두 배입니다. 목적함수의 항을 임의로 두 배로 바꾸면 같은 숫자 λ라도 다른 규칙을 만들 수 있습니다.

Ridge는 λΣpⱼbⱼ²/2, Lasso는 λΣpⱼ|bⱼ|를 더합니다. λ≥0이며 각 기울기 벌점 가중치 pⱼ는 양수입니다. 절편 a는 벌점에 넣지 않습니다. 부호가 있는 bⱼ와 양의 pⱼ를 혼동하지 마세요.

숫자 λ를 보고 강한 정규화라고 판단하기 전에 결과의 단위, 입력의 척도, 손실 정규화와 pⱼ를 함께 확인해야 합니다.

J0(a,b)=12W∑iwi(yi−a−xi⊤b)2JR=J0+λ2∑jpjbj2JL=J0+λ∑jpj∣bj∣\begin{gathered}J_0(a,b)=\frac{1}{2W}\sum_iw_i(y_i-a-x_i^\top b)^2\\J_R=J_0+\frac{\lambda}{2}\sum_jp_jb_j^2\\J_L=J_0+\lambda\sum_jp_j|b_j|\end{gathered}

Write eᵢ=yᵢ−a−xᵢᵀb. Our data loss divides weighted squared error by 2W. MSE is twice this data loss. Multiplying only one part of an objective changes the learning rule even when the displayed lambda stays fixed.

Ridge adds λΣpⱼbⱼ²/2; Lasso adds λΣpⱼ|bⱼ|. Require λ≥0 and strictly positive slope penalty weights pⱼ. Leave the intercept unpenalized. Signed slopes and positive penalty weights have different roles.

Before interpreting a numerical lambda, inspect outcome units, input scales, loss normalization and penalty weights.

J0(a,b)=12W∑iwi(yi−a−xi⊤b)2JR=J0+λ2∑jpjbj2JL=J0+λ∑jpj∣bj∣\begin{gathered}J_0(a,b)=\frac{1}{2W}\sum_iw_i(y_i-a-x_i^\top b)^2\\J_R=J_0+\frac{\lambda}{2}\sum_jp_jb_j^2\\J_L=J_0+\lambda\sum_jp_j|b_j|\end{gathered}
학부Undergraduate

4. 절편을 먼저 최소화하는 이유4. Why minimize over the intercept first?

기울기 b를 고정하고 a에 대해 미분하면 가중 잔차 합이 0이어야 합니다. W>0이므로 a=ȳ_w−x̄_wᵀb가 유일합니다. 따라서 기울기만 결정하면 절편이 따라옵니다. 이 결론은 절편이 벌점에서 제외된 경우입니다.

각 입력과 결과에서 같은 훈련 가중 평균을 빼면, 기울기 문제는 중심화된 입력과 결과의 회귀가 됩니다. 중심화는 단위를 바꾸지 않습니다. 범위나 표준편차로 나누는 척도 변환과는 별도 단계입니다.

가중 평균을 시험 결과까지 사용해 계산하면 다른 규칙입니다. 실습의 실제 자료 변환은 같은 가용 훈련 행에서만 평균을 계산합니다. 절편을 제외하는 선택을 하면 평균을 빼는 공식도 자동 적용되지 않습니다.

a(b)=yˉw−xˉw⊤bx~i=xi−xˉw,y~i=yi−yˉw\begin{gathered}a(b)=\bar y_w-\bar x_w^\top b\\\widetilde x_i=x_i-\bar x_w,\quad\widetilde y_i=y_i-\bar y_w\end{gathered}

For fixed slopes b, differentiation in a requires a zero weighted residual sum. With W>0, the unique intercept is a=ȳ_w−x̄_wᵀb. Slopes determine the intercept because the intercept is unpenalized.

Subtract the same training weighted means from inputs and outcomes to reduce the problem to centered slopes. Centering preserves units; dividing by a range or standard deviation is a separate transformation.

Using test outcomes to compute means defines a different rule. Actual-data transformations use only the common available training frame. If an intercept is excluded, this centering formula does not automatically apply.

a(b)=yˉw−xˉw⊤bx~i=xi−xˉw,y~i=yi−yˉw\begin{gathered}a(b)=\bar y_w-\bar x_w^\top b\\\widetilde x_i=x_i-\bar x_w,\quad\widetilde y_i=y_i-\bar y_w\end{gathered}
학부Undergraduate

5. 핵심은 Gram 행렬과 교차곱5. The Gram matrix and input-outcome cross-product

중심화한 입력으로 G=W⁻¹Σwᵢx̃ᵢx̃ᵢᵀ, c=W⁻¹Σwᵢx̃ᵢỹᵢ를 정의합니다. 이 식의 v_y=W⁻¹Σwᵢỹᵢ²는 같은 훈련 결과의 가중 중심 제곱평균으로, 분모 W를 쓰는 가중 분산입니다. G는 대칭 양의 준정부호입니다. 임의의 v에 대해 vᵀGv는 가중 제곱합이므로 음수가 될 수 없습니다.

정규방정식은 Gb=c입니다. 두 열이 중복되면 G는 특이하지만 c는 여전히 G의 열공간에 속합니다. 원자료에서 만든 최소제곱 문제는 해를 가지며, 역행렬을 쓸 수 없는 것과 해가 없는 것은 다릅니다.

분모를 W로 둔 정규화는 벌점과의 상대 크기를 정합니다. 같은 행을 같은 가중치로 복제하면 G와 c는 그대로입니다. 벌점을 제외한 단순 합 제곱오차 규약에서는 복제가 상대 벌점 크기를 바꿉니다.

G=1W∑iwix~ix~i⊤,c=1W∑iwix~iy~iJ0(b)=12(vy−2c⊤b+b⊤Gb)\begin{gathered}G=\frac1W\sum_iw_i\widetilde x_i\widetilde x_i^\top,\quad c=\frac1W\sum_iw_i\widetilde x_i\widetilde y_i\\J_0(b)=\frac12(v_y-2c^\top b+b^\top Gb)\end{gathered}

Define G=W⁻¹Σwᵢx̃ᵢx̃ᵢᵀ and c=W⁻¹Σwᵢx̃ᵢỹᵢ. In the displayed objective, v_y=W⁻¹Σwᵢỹᵢ² is the same training outcome’s weighted centered mean square, using denominator W. The symmetric Gram matrix is positive semidefinite: vᵀGv is a normalized weighted sum of squares.

The normal equations are Gb=c. Duplicate columns make G singular, but a cross-product formed from the same observations remains in its column space. A least-squares minimizer exists; failure of an inverse is different from failure of a solution.

Normalization by W fixes the relative penalty size. Replicating every row with equal replication leaves G and c unchanged. An unnormalized squared-error sum would instead change the relative penalty under replication.

G=1W∑iwix~ix~i⊤,c=1W∑iwix~iy~iJ0(b)=12(vy−2c⊤b+b⊤Gb)\begin{gathered}G=\frac1W\sum_iw_i\widetilde x_i\widetilde x_i^\top,\quad c=\frac1W\sum_iw_i\widetilde x_i\widetilde y_i\\J_0(b)=\frac12(v_y-2c^\top b+b^\top Gb)\end{gathered}
학부Undergraduate

6. 최소제곱의 전체 계수 가족6. The complete least-squares coefficient family

Gb=c의 한 해를 b₀라고 하면 모든 해는 b₀+v, v∈ker(G)입니다. 실제로 두 해의 차는 G의 영공간에 있고, 영공간 방향을 한 해에 더해도 방정식이 유지됩니다. 절편도 a(b)로 함께 변합니다. 아래 식에서 V의 열은 영공간 기저이고 k는 그 기저 벡터 수입니다. 기울기 변수의 수 p와 k는 같을 필요가 없습니다.

0 가중치 행을 제외한 중심화 설계의 열이 독립이면 G는 양의 정부호이고 해가 유일합니다. 열 독립은 설명변수들의 확률적 독립을 뜻하지 않습니다. 유한 표의 선형 대수 조건입니다.

실습은 기저 벡터와 자유 모수 전체를 반환합니다. 자유 모수를 0으로 두는 임의의 해와 최소 기울기 노름의 해가 같을 필요는 없습니다. 계산 결과를 해집합으로 먼저 읽은 뒤 선택 규칙을 읽으세요.

B0={b0+Vt:t∈Rk}\mathcal B_0=\{b_0+Vt:t\in\mathbb R^k\}

If b₀ solves Gb=c, every solution is b₀+v with v∈ker(G). Differences between solutions lie in the kernel; adding a kernel vector preserves the equations. The unpenalized intercept changes through a(b). In the displayed set, the columns of V form a kernel basis and k counts those basis vectors; k need not equal the predictor dimension p.

G is positive definite exactly when the centered design columns restricted to positive-weight rows are independent. This is finite-dimensional linear independence, not stochastic independence of predictors.

The lab returns a basis and all free parameter values. Setting free parameters to zero need not give the minimum-slope-norm member. Read the solution set before the declared selection rule.

B0={b0+Vt:t∈Rk}\mathcal B_0=\{b_0+Vt:t\in\mathbb R^k\}
학부Undergraduate

7. 훈련 예측은 언제 유일한가7. When are fitted predictions unique?

두 최소제곱 해의 차 v는 vᵀGv=0을 만족합니다. 이 값은 양수 가중치 좌표의 (x̃ᵢᵀv)² 합이므로 그 좌표마다 차이가 0입니다. 절편까지 복구하면 두 해의 모든 양수 가중치 훈련 예측이 같습니다.

새 입력 x의 예측은 ȳ_w+(x−x̄_w)ᵀb입니다. 모든 영공간 방향 v에 대해 (x−x̄_w)ᵀv=0이어야 전체 해에서 같은 예측이 나옵니다. 이 조건이 깨지면 비제약 OLS 해집합은 새 예측을 모든 실수로 보냅니다.

입력의 각 좌표가 훈련 최솟값과 최댓값 사이에 있다는 조건만으로 충분하지 않습니다. 중복 열의 예처럼 좌표별 범위 안에서도 관측 행공간을 벗어날 수 있습니다. 0 가중치 원행에도 예측 유일성이 자동 확장되지 않습니다.

For the difference v of two least-squares solutions, vᵀGv=0. This is a sum of positive-weight squared centered prediction differences, so each such difference vanishes. Restoring the intercept gives unique predictions on positive-weight training rows.

At a new input x, prediction is ȳ_w+(x−x̄_w)ᵀb. It is common to every minimizer exactly when (x−x̄_w)ᵀv=0 for every kernel direction v. Otherwise the unrestricted OLS family gives every real prediction at that input.

Being inside each coordinate’s training range is insufficient. Duplicate columns allow coordinate-wise interpolation outside the observed row space. Prediction uniqueness also need not extend to zero-weight source rows.

학부Undergraduate

8. 답 하나를 정하는 것도 학습 규칙8. Selecting one answer is part of the learning rule

계수 가족 중 Σbⱼ²가 가장 작은 기울기를 고르는 규칙을 선언합니다. 비어 있지 않은 닫힌 볼록 최소해집합에서 이 엄격 볼록 노름은 유일한 기울기를 선택합니다. 절편은 a(b)로 정하며, 절편까지 포함한 전체 계수 노름을 최소화하는 다른 규칙과 구별합니다.

중복 열의 b₁+b₂=1에서는 b₁=b₂=1/2가 선택됩니다. 이는 합이 1인 모든 계수가 자료와 양립한다는 사실을 없애지 않습니다. (1,0)에서 선택 예측 1/2는 명시한 규칙의 출력이지 관측만으로 식별한 값이 아닙니다.

검증 결과를 보고 계수 가족 중 유리한 멤버를 고르면 검증 단계에서 또 하나의 최적화를 한 것입니다. 이 장은 먼저 선택 규칙을 고정하고, 그 규칙이 만든 하나의 예측으로 후보들을 비교합니다.

Declare the rule that selects slopes minimizing Σbⱼ² over the minimizer set. On a nonempty closed convex minimizer set, this strictly convex norm selects unique slopes. The intercept follows a(b); this differs from minimizing the norm of the entire intercept-and-slope vector.

For duplicate columns with b₁+b₂=1, it selects b₁=b₂=1/2. Every other coefficient pair with the same sum remains compatible with the observations. The selected prediction 1/2 at (1,0) comes from the declared rule, not observational identification alone.

Choosing a favorable family member after inspecting validation outcomes is another validation optimization. Here the coefficient selector is fixed first, and its single predictor is used to compare candidate models.

학부Undergraduate

9. Ridge는 특이 Gram에 양의 곡률을 더한다9. Ridge adds positive curvature to a singular Gram matrix

P=diag(pⱼ), pⱼ>0이고 λ>0이라고 합시다. Ridge의 일계 조건은 (G+λP)b=c입니다. 임의의 0 아닌 v에 대해 vᵀGv≥0이고 λvᵀPv>0이므로 G+λP는 양의 정부호입니다. 따라서 모든 기울기가 유일하며 W>0이면 절편도 유일합니다.

입력 열이 중복되어도 이 증명은 같습니다. 다만 벌점이 0인 기울기를 허용하면 엄격한 양의 곡률 주장은 다시 검토해야 합니다. 실습에서는 모든 기울기 벌점 가중치를 양수로 제한합니다.

λ=0은 OLS의 전체 해집합으로 돌아갑니다. 이 경계에 양수 λ의 역행렬 공식을 무작정 대입해서 특이 행렬 오류를 통계적 결론으로 읽지 않습니다.

(G+λP)bR=c(G+\lambda P)b_R=c

Let P=diag(pⱼ) with every pⱼ>0 and λ>0. Ridge satisfies (G+λP)b=c. For nonzero v, vᵀGv≥0 and λvᵀPv>0, making G+λP positive definite. Slopes are unique, and W>0 also determines a unique intercept.

Duplicate columns do not change this proof. Allowing an unpenalized slope would require revisiting the strict-curvature argument. The labs require positive penalty weights on every slope.

At λ=0, return the complete OLS solution set. Do not substitute zero into a positive-lambda inverse formula and treat a singular-matrix error as a statistical conclusion.

(G+λP)bR=c(G+\lambda P)b_R=c
학부Undergraduate

10. 한 설명변수의 축소를 직접 계산한다10. Compute scalar ridge shrinkage directly

가정 훈련 행은 (X,Y)=(−1,−2),(1,2)이고 가중치는 각각 1입니다. 평균이 모두 0이므로 G=1, c=2입니다. OLS는 b=2, Ridge의 단위 벌점은 b=2/(1+λ)를 줍니다. λ=1이면 b=1이고 두 훈련 잔차는 −1과 1입니다.

자료 손실은 1/2, 벌점도 1/2라 총목적함수는 1입니다. 반면 OLS 계수 2를 같은 Ridge 목적함수에 넣으면 자료 손실 0, 벌점 2로 총 2입니다. Ridge는 훈련 MSE 자체를 최소화하는 방법이 아닙니다.

절편은 여기서 우연히 0입니다. 결과 전체에 5를 더하면 새 절편은 5가 되고 중심화 교차곱과 기울기는 그대로입니다. 절편을 벌점에 넣지 않은 규약이 이 이동 성질을 만듭니다.

Use assumed rows (X,Y)=(−1,−2),(1,2), each with weight one. Both means vanish, so G=1 and c=2. OLS gives b=2; unit-weight ridge gives b=2/(1+λ). At λ=1, b=1 and the training residuals are −1 and 1.

Data loss is 1/2 and the penalty is 1/2, totaling one. Putting the OLS slope two into that same ridge objective gives zero data loss plus penalty two. Ridge does not minimize training MSE alone.

The intercept happens to be zero. Adding five to every outcome moves it to five while preserving centered cross-products and slopes. This translation property follows from leaving the intercept unpenalized.

학부Undergraduate

11. 직교 설계의 두 기울기11. Two slopes in an orthogonal design

다음 네 행은 설명용 가정 표입니다. 동일 가중치로 중심화 Gram은 단위행렬이고 교차곱은 (1,1)입니다. 따라서 두 OLS 기울기는 (1,1), 단위 벌점 Ridge λ=1의 기울기는 (1/2,1/2)입니다.

두 Ridge 훈련 예측은 극단 행에서 −1과 1이며 가운데 두 행은 0입니다. 잔차는 −1, 0, 0, 1이므로 MSE=1/2, 자료 손실=1/4, 벌점=1/4, 총 1/2입니다. 예측 오차와 벌점의 분모를 분리해서 계산하세요.

직교일 때 좌표별 공식이 분리되는 것은 특별한 구조입니다. 일반 상관 설계에 같은 좌표별 나눗셈을 적용하지 않습니다.

단위 가중치의 가정 직교 표
X₁X₂Y
-1-1-2
-110
1-10
112

The following assumed four-row table has equal weights, centered Gram I and cross-product (1,1). OLS slopes are (1,1); ridge with λ=1 and unit penalties gives (1/2,1/2).

Ridge predicts −1 and 1 at the extreme rows and zero at the middle rows. Residuals are −1, 0, 0, 1. MSE is 1/2, data loss 1/4, penalty 1/4 and total objective 1/2. Keep the data-loss and penalty denominators separate.

Coordinate-wise division works because the design is orthogonal. It is not a formula for arbitrary correlated inputs.

Assumed orthogonal table with unit weights
X₁X₂Y
-1-1-2
-110
1-10
112
학부Undergraduate

12. 축소는 어느 방향에서 일어나는가12. In which directions does shrinkage occur?

모든 pⱼ=1이고 대칭 G를 직교 고유벡터로 분해한다고 합시다. 양의 고유값 d 방향에서 Ridge 계수는 OLS 성분의 d/(d+λ)배입니다. 고유값이 작을수록 상대 축소가 크며, 자료에서 약하게 구별하는 방향에 더 큰 영향을 줍니다.

이는 원래 각 변수의 계수 절댓값이 반드시 줄어든다는 정리가 아닙니다. 고유방향은 원래 좌표들의 조합이기 때문입니다. 훈련 예측의 길이와 각 기울기 좌표도 구별해야 합니다.

영공간에서 λ>0 Ridge는 0 성분을 선택합니다. λ가 0으로 내려갈 때 단위 벌점 Ridge는 OLS의 최소 기울기 노름 멤버로 수렴합니다. 다른 양의 대각 벌점이면 그 벌점 노름의 최소 멤버가 경계 선택이 됩니다.

dd+λ(d>0)\frac{d}{d+\lambda}\quad(d>0)

With all pⱼ=1, diagonalize symmetric G in orthonormal eigenvectors. In an eigen-direction of positive eigenvalue d, ridge equals d/(d+λ) times the OLS component. Small-eigenvalue directions undergo stronger relative shrinkage.

This does not say that every original coefficient magnitude decreases. Eigen-directions combine the original coordinates. Distinguish fitted-vector length from individual slope coordinates.

Positive ridge selects zero in the kernel. As λ decreases to zero, unit-penalty ridge approaches the minimum-slope-norm OLS member. A different positive diagonal penalty approaches the member minimizing that penalty norm.

dd+λ(d>0)\frac{d}{d+\lambda}\quad(d>0)
학부Undergraduate

13. 0이던 좌표가 Ridge에서 양수가 될 수 있다13. An originally zero coefficient can become positive under ridge

네 가정 행에서 X₁=(−1,−1,1,1), X₂=(−1,0,0,1), Y=X₂이고 동일 가중치를 씁니다. G의 첫 행은 (1,1/2), 둘째 행은 (1/2,1/2)이며 c=(1/2,1/2)입니다. 유일한 OLS 기울기는 (0,1)입니다.

Ridge λ=1, 단위 벌점은 (2/11,3/11)을 줍니다. 첫 좌표의 절댓값은 0에서 2/11로 커졌습니다. 그래도 고유방향 축소 정리와 모순되지 않습니다. 상관된 두 좌표의 기여가 함께 재배분된 결과입니다.

변수별 계수 변화만 보고 해당 요인의 중요성이나 인과효과가 커졌다고 해석하지 않습니다. 정규화 규약과 함께 전체 예측을 비교해야 합니다.

Take four assumed equal-weight rows with X₁=(−1,−1,1,1), X₂=(−1,0,0,1) and Y=X₂. The Gram rows are (1,1/2) and (1/2,1/2), and c=(1/2,1/2). The unique OLS slopes are (0,1).

Ridge with λ=1 and unit penalties gives (2/11,3/11). The first coefficient magnitude grows from zero to 2/11 without contradicting eigen-direction shrinkage. Contributions are redistributed between correlated coordinates.

A larger coefficient does not establish greater causal importance. Compare the complete predictor together with the regularization convention.

학부Undergraduate

14. 편향을 더해서 평균 오차가 줄어드는 가정 실험14. An assumed experiment where added bias reduces mean error

고정한 두 입력 X=(−1,1)에서 Yᵢ=Xᵢβ*+εᵢ, β*=1을 가정합니다. 오차 평균은 0이고 서로 비상관이며 분산은 각각 1입니다. 절편을 포함한 중심화 회귀에서 OLS 기울기의 평균은 1, 분산은 1/2입니다.

단위 기울기 벌점의 Ridge λ=1은 OLS 기울기의 절반입니다. 평균 1/2이므로 편향은 −1/2, 분산은 1/8입니다. 참 기울기에 대한 평균제곱오차는 1/4+1/8=3/8로 OLS의 1/2보다 작습니다. 이 비교는 선언한 오차 법칙과 참 계수에 조건부인 계산입니다.

더 큰 λ가 항상 낫지는 않습니다. 참 계수의 크기가 충분히 크면 축소 편향이 더 큰 비용을 만듭니다. 이 가정 계수 위험의 개선을 실제 시험 위험의 보편 개선이나 인과 식별로 바꾸지 않습니다.

Assume fixed inputs X=(−1,1) and outcomes Yᵢ=Xᵢβ*+εᵢ with β*=1. Errors have mean zero, unit variances and zero cross-covariance. Centered OLS with an intercept has slope mean one and variance 1/2.

At λ=1 with a unit slope penalty, ridge is half the OLS slope. Its mean is 1/2, bias −1/2 and variance 1/8. Squared-error risk for the true slope is 1/4+1/8=3/8, below the OLS risk 1/2. This calculation conditions on the declared design, truth and error law.

Larger lambda need not help. A sufficiently large true slope raises shrinkage bias. Do not turn an improvement in this assumed coefficient risk into a universal improvement in actual test risk or causal identification.

학부Undergraduate

15. 유효 자유도와 계수 개수15. Effective degrees of freedom versus coefficient count

단위 가중치, 고정 중심화 설계와 단위 벌점을 생각합시다. Ridge의 훈련 적합값은 결과에 선형인 smoother입니다. 양의 고유값 dⱼ를 가진 기울기 방향의 유효 자유도 기여는 dⱼ/(dⱼ+λ)입니다. 절편을 별도로 적합하면 그 기여 1을 더합니다.

직교 두 열에서 λ=1이면 기울기 유효 자유도는 1이고 절편을 포함하면 2입니다. 저장한 계수는 절편과 두 기울기, 총 3개지만 적합값의 민감도를 나타내는 trace는 2입니다.

이 trace를 곧바로 임의 자료의 표준오차 분모에 넣지 않습니다. 오차 법칙·선택 과정·추론 표적이 별도입니다. 특히 검증으로 λ를 고른 전체 규칙은 고정 λ의 선형 smoother와 다릅니다.

df⁡R, slopes=∑dj>0djdj+λ\operatorname{df}_{R,\,\mathrm{slopes}}=\sum_{d_j>0}\frac{d_j}{d_j+\lambda}

For a fixed centered design with unit observation and penalty weights, ridge fitted values are a linear smoother of outcomes. A positive-eigenvalue slope direction contributes dⱼ/(dⱼ+λ) to its trace. Add one when a separate unpenalized intercept is fitted.

With two orthogonal columns and λ=1, slope effective degrees of freedom total one; including the intercept gives two. Three coefficients are stored, but the fitted-value sensitivity trace is two.

This trace is not an automatic standard-error denominator for arbitrary data. Error laws, selection and inferential targets require separate premises. Selecting lambda by validation defines a different rule from a fixed-lambda linear smoother.

df⁡R, slopes=∑dj>0djdj+λ\operatorname{df}_{R,\,\mathrm{slopes}}=\sum_{d_j>0}\frac{d_j}{d_j+\lambda}
학부Undergraduate

16. λ가 크다는 말의 경계16. What happens as lambda becomes large?

고정된 유한 훈련 표와 모든 양의 pⱼ에서 λ→∞이면 Ridge 기울기는 0으로 갑니다. 절편을 포함하면 예측은 훈련 가중 평균으로 수렴합니다. 절편을 제외한 모형에서는 예측이 0으로 가므로 두 규칙을 혼동하지 않습니다.

이는 유한 λ에서 기울기가 모두 정확 0이라는 말이 아닙니다. c가 0이 아닌 경우 양수 Ridge의 역행렬은 기울기 벡터를 비영으로 보냅니다. 어떤 좌표 하나는 상쇄 때문에 0일 수 있지만, Lasso의 임계값에 의한 전체 영해와는 원리가 다릅니다.

정확한 양수가 화면에서 0으로 반올림될 수도 있습니다. 실습은 정확 분수와 표시 underflow를 함께 내며, 그래프에 보이는 0을 수학적 영으로 대신하지 않습니다.

For a fixed finite training table and positive penalty weights, ridge slopes tend to zero as λ→∞. With an intercept, prediction approaches the training weighted mean; without an intercept, prediction approaches zero. These are different learning rules.

This is not a claim of exact zero slopes at finite lambda. If c is nonzero, the positive-ridge inverse gives a nonzero coefficient vector. Individual coordinates can vanish through cancellation, but that differs from Lasso thresholding the whole vector to zero.

A nonzero exact number may round to zero on screen. The lab retains exact fractions and display-underflow metadata; a plotted zero does not replace the mathematical value.

학부Undergraduate

17. 절댓값의 꺾임을 미분 대신 읽는다17. Read the corner of an absolute value

Lasso의 |b|는 b=0에서 보통 미분이 없습니다. 그러나 볼록 함수의 부분기울기는 정의됩니다. 양수 b에서는 1, 음수 b에서는 −1, 0에서는 닫힌 구간 [−1,1]입니다. 0의 한쪽 기울기만 고르면 정확한 영해 조건을 놓칩니다.

자료 손실의 기울기 g=Gb−c를 쓰면, bⱼ≠0인 좌표는 gⱼ+λpⱼsign(bⱼ)=0이어야 합니다. bⱼ=0인 좌표는 |gⱼ|≤λpⱼ이면 됩니다. 등호도 영해 조건에 포함됩니다.

이 조건은 볼록 목적함수에서 필요충분합니다. 단순한 근 찾기 규칙이 아니라 전체 전역 최소해를 판별하는 기준입니다. 정확 분수 실습은 작은 수를 임의 허용오차로 0으로 바꾸지 않습니다.

bj≠0:(Gb−c)j+λpjsign⁡(bj)=0bj=0:∣(Gb−c)j∣≤λpj\begin{gathered}b_j\ne0:\quad (Gb-c)_j+\lambda p_j\operatorname{sign}(b_j)=0\\b_j=0:\quad |(Gb-c)_j|\le\lambda p_j\end{gathered}

The ordinary derivative of |b| does not exist at zero. Its convex subgradient is one for positive b, minus one for negative b, and the closed interval [−1,1] at zero. Keeping only one one-sided derivative would lose exact zero-solution cases.

Let g=Gb−c be the data-loss gradient. A nonzero slope must satisfy gⱼ+λpⱼsign(bⱼ)=0. A zero slope requires |gⱼ|≤λpⱼ, including equality.

These conditions are necessary and sufficient for a global minimum of this convex objective. The exact-fraction lab does not replace small coefficients by zero through an arbitrary tolerance.

bj≠0:(Gb−c)j+λpjsign⁡(bj)=0bj=0:∣(Gb−c)j∣≤λpj\begin{gathered}b_j\ne0:\quad (Gb-c)_j+\lambda p_j\operatorname{sign}(b_j)=0\\b_j=0:\quad |(Gb-c)_j|\le\lambda p_j\end{gathered}
학부Undergraduate

18. 한 변수의 soft threshold를 유도한다18. Derive the scalar soft threshold

한 중심화 변수에서 G=d>0, c를 고정합니다. 양의 해라면 db−c+λp=0이므로 b=(c−λp)/d이고 c>λp가 필요합니다. 음의 해도 같은 방식으로 c<−λp에서 (c+λp)/d입니다. 그 사이에서는 b=0이 KKT 조건을 만족합니다.

이를 S(c,t)=sign(c)max(|c|−t,0)로 쓰면 b=S(c,λp)/d입니다. 양의 신호에서 임계값을 빼고, 임계값 이하이면 정확 0으로 둡니다. Ridge의 c/(d+λp)와 다른 형태입니다.

d=0인 실제 중심화 단일 열은 양수 가중치 좌표에서 상수이고 c=0입니다. λp>0이면 유일한 Lasso 기울기는 0입니다. 이 경우 0으로 나누는 soft-threshold 식을 쓰지 않습니다.

bL=sign⁡(c)(∣c∣−λp)+d(d>0)b_L=\frac{\operatorname{sign}(c)(|c|-\lambda p)_+}{d}\quad(d>0)

For one centered predictor with G=d>0, a positive slope requires db−c+λp=0, hence b=(c−λp)/d and c>λp. A negative slope similarly gives (c+λp)/d when c<−λp. Between these thresholds, zero satisfies KKT.

Define S(c,t)=sign(c)max(|c|−t,0). Then b=S(c,λp)/d: subtract the threshold from signal magnitude, or set the coefficient exactly to zero below it. Ridge instead divides c by d+λp.

If d=0 in a centered observed column, that column is constant on positive-weight rows and c=0. A positive Lasso penalty uniquely selects zero. Do not divide by d in this boundary case.

bL=sign⁡(c)(∣c∣−λp)+d(d>0)b_L=\frac{\operatorname{sign}(c)(|c|-\lambda p)_+}{d}\quad(d>0)
학부Undergraduate

19. 직교 Lasso의 정확한 019. Exact zeros in orthogonal Lasso

앞의 네 가정 행 X₁=(−1,−1,1,1), X₂=(−1,1,−1,1), Y=(−2,0,0,2)에서는 G=I, c=(1,1)입니다. 단위 벌점 Lasso λ=1/2는 기울기 (1/2,1/2), λ=1은 (0,0)을 줍니다. λ=1은 임계값의 등호이므로 0이 포함됩니다.

λ=1/2에서 자료 손실은 1/4, Lasso 벌점은 1/2, 총목적함수는 3/4입니다. 같은 계수 (1/2,1/2)가 Ridge λ=1에서 나왔다고 두 총목적함수가 같은 척도라고 읽지 않습니다. 서로 다른 벌점을 더했기 때문입니다.

모든 기울기가 0인 예측은 이 표에서 절편도 0입니다. 일반 표에서는 훈련 가중 평균을 예측하는 절편이 남습니다. Lasso가 모든 변수를 제거해도 결과를 항상 0으로 예측한다는 말은 아닙니다.

For assumed X₁=(−1,−1,1,1), X₂=(−1,1,−1,1) and Y=(−2,0,0,2), G=I and c=(1,1). Unit-penalty Lasso gives (1/2,1/2) at λ=1/2 and (0,0) at λ=1. Threshold equality is included in the zero case.

At λ=1/2, data loss is 1/4, the Lasso penalty 1/2 and total objective 3/4. The same slopes arise from ridge at λ=1, but their penalized objectives are not the same quantity. Different penalties were added.

The all-zero-slope model also has zero intercept in this centered example. In general it retains the training weighted mean intercept. Removing all slopes does not mean always predicting outcome zero.

학부Undergraduate

20. 전체 영해의 임계값20. The threshold for an all-zero slope vector

b=0을 KKT에 넣으면 모든 j에서 |cⱼ|≤λpⱼ이어야 합니다. 따라서 λ_max=maxⱼ|cⱼ|/pⱼ이면 λ≥λ_max에서 b=0이 최소해입니다. 양의 pⱼ가 있어야 이 비율이 정의됩니다.

λ>0일 때 다른 비영 기울기도 같은 최소값을 갖는지 살펴봅시다. b=0과 다른 최소해는 양수 가중치 훈련 예측이 같아야 하므로 Gb=0입니다. 이때 cᵀb=0이고 자료 손실은 같지만 비영 기울기의 양의 L1 벌점은 더 큽니다. 따라서 전체 영해는 유일합니다.

이 λ_max는 관측 훈련 교차곱의 값입니다. 참 관련 변수가 없음을 판정한 과학적 경계가 아닙니다. 실제 계산에서는 단위와 훈련 변환에 따라 숫자가 달라집니다.

λmax⁡=max⁡j∣cj∣pj\lambda_{\max}=\max_j\frac{|c_j|}{p_j}

At b=0, KKT requires |cⱼ|≤λpⱼ for every j. Thus b=0 minimizes the objective for λ≥λ_max=maxⱼ|cⱼ|/pⱼ. Strictly positive penalty weights make these ratios defined.

Could another nonzero slope vector tie when λ>0? All minimizers share positive-weight fitted values, so such a difference would satisfy Gb=0 and cᵀb=0. Data loss would be unchanged but its positive L1 penalty would be larger. Consequently the all-zero solution is unique.

This threshold describes observed training cross-products, not a scientific test that no variable matters. Its numerical value depends on units and fitted training transformations.

λmax⁡=max⁡j∣cj∣pj\lambda_{\max}=\max_j\frac{|c_j|}{p_j}
학부Undergraduate

21. 동일 열에서 Lasso는 선분 전체를 남긴다21. Duplicate columns can leave a whole Lasso segment

처음의 두 행 X₁=X₂=Y=(−1,1)로 돌아갑니다. 단위 벌점 λ=1/2에서는 전체 최소해가 b₁≥0, b₂≥0, b₁+b₂=1/2입니다. 두 끝점 (1/2,0),(0,1/2)뿐 아니라 모든 내부 점이 포함됩니다.

두 열에 대한 계수 합 s가 예측을 결정합니다. 삼각부등식 |b₁|+|b₂|≥|s|는 같은 부호에서 등호가 됩니다. 따라서 먼저 스칼라 soft threshold로 s=1/2를 구하고, 그 합을 비음수 두 좌표에 나누는 선분이 남습니다.

모든 점의 훈련 MSE는 1/4이고 총 Lasso 목적함수는 3/8입니다. 최소 기울기 노름 규칙은 (1/4,1/4)를 선택하지만 전체 최소해를 한 점으로 축약하지 않습니다. 새 입력 (1,0)의 전체 예측 구간은 닫힌 [0,1/2]입니다.

BL={(t,1/2−t):0≤t≤1/2}\mathcal B_L=\{(t,1/2-t):0\le t\le1/2\}

Return to X₁=X₂=Y=(−1,1). With unit penalties and λ=1/2, all minimizers satisfy b₁≥0, b₂≥0 and b₁+b₂=1/2. Both endpoints and every interior point belong.

The coefficient sum s determines predictions. The triangle inequality gives |b₁|+|b₂|≥|s|, with equality for matching signs. Scalar soft thresholding first selects s=1/2; distributing that sum across nonnegative coordinates leaves a segment.

Every member has training MSE 1/4 and total Lasso objective 3/8. Minimum slope norm selects (1/4,1/4) without erasing the full set. At new input (1,0), the complete prediction interval is closed [0,1/2].

BL={(t,1/2−t):0≤t≤1/2}\mathcal B_L=\{(t,1/2-t):0\le t\le1/2\}
학부Undergraduate

22. Lasso 계수가 여러 개여도 훈련 예측은 유일하다22. Nonunique Lasso coefficients still give unique fitted values

제곱손실은 양수 가중치 훈련 적합값에 대해 엄격 볼록이고 L1 벌점은 볼록입니다. 두 최소해가 다른 훈련 적합값을 낸다고 가정하면 중간 계수의 자료 손실은 엄격히 작아지고 벌점은 두 벌점 평균보다 크지 않습니다. 이는 최소값과 모순입니다.

따라서 모든 Lasso 최소해는 양수 가중치가 있는 가용 훈련 행에서 같은 예측을 내고 같은 자료 손실을 가집니다. 가중치 0인 원행의 예측까지 같아야 하는 것은 아닙니다. λ>0이면 같은 총목적함수에서 같은 자료 손실을 빼어 L1 벌점도 같습니다. 계수 자체는 선분처럼 여러 개일 수 있습니다.

양수 가중치 행으로 제한한 중심화 입력 열의 선형 독립은 계수 유일성의 충분조건입니다. 열이 종속이라고 반드시 비유일한 것은 아닙니다. λ가 충분히 크면 영해가 유일한 예가 이미 있습니다. 유일성 조건의 충분·필요 방향을 뒤집지 않습니다.

Squared loss is strictly convex in positive-weight fitted values, and the L1 penalty is convex. If two minimizers had different fitted vectors, their midpoint would have strictly smaller data loss and no greater than average penalty, contradicting minimality.

Every Lasso minimizer therefore shares fitted values on positive-weight available training rows, and shares data loss. Predictions on zero-weight source rows need not agree. At λ>0, subtracting that shared data loss from the common total objective also gives equal L1 penalties. Coefficients can still form a segment.

Linearly independent centered input columns, restricted to positive-weight rows, are sufficient for coefficient uniqueness. Dependent columns do not force nonuniqueness: sufficiently large lambda gives the unique zero solution. Keep sufficient and necessary directions distinct.

학부Undergraduate

23. 전체 해를 부호 지지집합으로 나눈다23. Partition the solution set by sign supports

각 기울기 상태를 음수·0·양수로 나누면 p개 변수에 3ᵖ개 부호 패턴이 있습니다. 부호가 0이 아닌 좌표에는 KKT 등식을, 0인 좌표에는 닫힌 부등식을 적용합니다. 비영 좌표의 부호 제약은 엄격합니다.

두 변수의 종속 열에서는 한 부호 패턴 안에 열린 선분이 남을 수 있습니다. 끝점에서 한 좌표가 0이 되면 그 끝점은 다른 부호 패턴의 점 해에 속합니다. 내부와 끝점을 중복 없이 합쳐야 전체 닫힌 최소해집합을 얻습니다.

실습은 p≤2의 모든 패턴을 정확히 계산합니다. 큰 차원의 실용 알고리즘을 모사한 계산 속도 주장은 하지 않습니다. 이 작은 도구의 목적은 0·동률·비유일 경계를 눈으로 확인하는 것입니다.

Classify each slope as negative, zero or positive, giving 3ᵖ sign patterns. Impose KKT equalities on active coordinates and closed inequalities on zero coordinates. Sign restrictions on active coordinates are strict.

Dependent columns can leave an open segment within one sign pattern. Where a coordinate becomes zero, its endpoint belongs to another pattern’s point solution. Combining disjoint interiors and endpoints recovers the complete closed minimizer set.

The lab enumerates all patterns for p≤2 exactly. It makes no speed claim about high-dimensional practical algorithms. Its purpose is to expose zeros, ties and nonunique boundaries.

학부Undergraduate

24. 희소한 계수와 과학적 변수 선택을 구별한다24. Separate sparse coefficients from scientific variable selection

Lasso가 어떤 기울기를 0으로 만들었다는 것은 정한 좌표·벌점·훈련 표에서 그 예측 규칙을 선택했다는 뜻입니다. 그 요인이 현실에서 영향이 없다거나 다른 변수의 개입 효과를 식별했다는 뜻은 아닙니다. 중복 열의 양 끝점은 같은 예측으로 서로 다른 변수를 0으로 만듭니다.

참 희소 계수를 회복하는 정리는 자료 생성 모형·설계 조건·잡음·λ의 크기와 표본 크기에 관한 추가 가정을 둡니다. 이 장의 보관 실제 자료에 그러한 조건이 자동으로 성립한다고 선언하지 않습니다.

계수가 정확 0인지, 표시상 0인지, 입력 자체가 미관측인지도 구별해야 합니다. 결측을 0으로 대체해 별도의 학습 규칙을 만들었다면 그 변환을 훈련자료에서 정하고 공개해야 합니다.

A zero Lasso slope says what a prediction rule selected for declared coordinates, penalty and training table. It does not show that a real factor has no effect or identify an intervention effect. Duplicate-column endpoints set different variables to zero while predicting identically.

Recovery of a true sparse coefficient vector requires additional assumptions about a data-generating model, design, noise, lambda and sample size. We do not automatically assign such conditions to the retained actual records.

Also distinguish an exact zero, display rounding to zero and an unavailable input. Replacing missing values by zero defines another learning rule whose training-fitted transformation must be disclosed.

학부Undergraduate

25. 입력 단위 변환은 계수 좌표를 바꾼다25. Input units change coefficient coordinates

각 sⱼ>0에 대해 zⱼ=(xⱼ−oⱼ)/sⱼ로 입력을 바꿉니다. 변환 좌표의 예측 ã+Σγⱼzⱼ를 원래 단위로 쓰면 bⱼ=γⱼ/sⱼ, a=ã−Σoⱼγⱼ/sⱼ입니다. 동일한 입력값에 대한 예측 함수는 이 대응으로 정확히 같습니다.

양의 척도와 절편을 포함하면 변환 전후 OLS의 전체 예측 함수 집합이 대응합니다. 그러나 새 좌표에서 기울기 노름을 최소화하는 선택은 원래 좌표의 노름 최소화와 다른 문제입니다. 전체 해집합 대응과 선택된 한 계수의 동일성을 구별합니다.

단위를 바꾸고 같은 숫자 벌점을 그대로 적용하면 Ridge와 Lasso의 목적함수는 일반적으로 달라집니다. 원래 변수에서 큰 계수와 새 단위에서 큰 계수는 같은 의미가 아닙니다.

bj=γj/sja=a~−∑jojγj/sj\begin{gathered}b_j=\gamma_j/s_j\\a=\widetilde a-\sum_jo_j\gamma_j/s_j\end{gathered}

Transform each input by zⱼ=(xⱼ−oⱼ)/sⱼ with sⱼ>0. Writing ã+Σγⱼzⱼ in original units gives bⱼ=γⱼ/sⱼ and a=ã−Σoⱼγⱼ/sⱼ. These mapped coefficients give exactly the same prediction function.

With an intercept and positive scales, complete OLS prediction-function sets correspond. A minimum-slope-norm selector in new coordinates can nevertheless differ from the original-coordinate selector. Full-set equivalence and equality of selected members are separate statements.

Keeping the same numerical penalty after changing units generally changes ridge and Lasso objectives. A large coefficient in one coordinate system has a different meaning in another.

bj=γj/sja=a~−∑jojγj/sj\begin{gathered}b_j=\gamma_j/s_j\\a=\widetilde a-\sum_jo_j\gamma_j/s_j\end{gathered}
학부Undergraduate

26. 같은 벌점을 유지하려면 가중치를 옮긴다26. Transform penalty weights to preserve the objective

원래 Ridge 벌점 λΣpⱼbⱼ²/2에 bⱼ=γⱼ/sⱼ를 대입하면 새 좌표의 가중치는 pⱼ/sⱼ²입니다. Lasso에서는 pⱼ/sⱼ입니다. 자료 손실은 예측 함수를 같게 옮겼으므로 변하지 않습니다.

예를 들어 z₂=x₂/10이면 원래 단위 벌점의 Ridge 새 가중치는 1/100, Lasso는 1/10입니다. 이 보정을 하지 않고 γ₂에 단위 벌점을 주면 원래 b₂에 각각 100배 또는 10배의 벌점을 준 것과 같습니다.

이것은 단위 변경 불변성을 확인하는 대수 관계입니다. 모든 실제 문제에서 원래 단위 벌점이 더 낫다고 권고하는 규칙은 아닙니다. 어떤 단위의 크기를 사전 선호하는지 모형 선택으로 설명해야 합니다.

pj,newR=pj/sj2pj,newL=pj/sj\begin{gathered}p_{j,\mathrm{new}}^{R}=p_j/s_j^2\\p_{j,\mathrm{new}}^{L}=p_j/s_j\end{gathered}

Substituting bⱼ=γⱼ/sⱼ into the original ridge penalty gives new weight pⱼ/sⱼ². For Lasso it gives pⱼ/sⱼ. Data loss is unchanged because the prediction functions map exactly.

If z₂=x₂/10, an original unit penalty becomes 1/100 for ridge or 1/10 for Lasso. Leaving a unit penalty on γ₂ instead penalizes original b₂ by factors 100 or 10.

These are algebraic objective-preservation identities, not a recommendation that original-unit penalties always work better. Which coordinate magnitudes receive comparable penalties is a modeling choice.

pj,newR=pj/sj2pj,newL=pj/sj\begin{gathered}p_{j,\mathrm{new}}^{R}=p_j/s_j^2\\p_{j,\mathrm{new}}^{L}=p_j/s_j\end{gathered}
학부Undergraduate

27. 같은 전체 해집합이어도 선택 멤버는 달라진다27. The same full set can have a different selected member

중복 열 Lasso λ=1/2의 원래 전체 해는 b₁+b₂=1/2, b₁,b₂≥0입니다. 원래 기울기 노름은 (1/4,1/4)를 선택합니다. 이제 z₁=x₁, z₂=x₂/10과 보정 Lasso 가중치 (1,1/10)을 사용합니다.

원래 단위로 옮긴 전체 해집합은 그대로입니다. 그러나 변환 기울기 노름 γ₁²+γ₂²=b₁²+100b₂²를 최소화하면 b₁=50/101, b₂=1/202가 선택됩니다. 두 합은 1/2이며 모든 훈련 적합값은 같습니다.

새 입력 (1,0)의 선택 예측은 1/4에서 50/101로 달라집니다. 실습은 전체 집합 대응은 참이라고 표시하되, 비유일 문제의 선택 예측까지 같다고 보장하지 않습니다. 선택 규칙을 어떤 좌표에서 정의했는지 기록하세요.

The duplicate-column Lasso set at λ=1/2 is b₁+b₂=1/2 with nonnegative slopes. Original-coordinate minimum norm selects (1/4,1/4). Now use z₁=x₁, z₂=x₂/10 and corrected Lasso weights (1,1/10).

The full set mapped back to original units is unchanged. But minimizing transformed norm γ₁²+γ₂²=b₁²+100b₂² selects b₁=50/101 and b₂=1/202. Their sum is 1/2 and all training fitted values agree.

At new input (1,0), the selected prediction changes from 1/4 to 50/101. The lab affirms full-set correspondence without guaranteeing equality of selected off-support predictions. Record the coordinates in which a selector is defined.

학부Undergraduate

28. 척도도 훈련자료에서 적합한다28. Fit scaling on training data as well

실제 자료 실습의 trainRange는 같은 가용 훈련 행의 입력 평균을 빼고 최댓값−최솟값으로 나눕니다. 이 범위는 표준편차가 아니므로 표준편차 표준화라고 부르지 않습니다. 모든 훈련 값이 같으면 범위가 0이어서 명시적 대체 척도 1을 씁니다.

검증과 시험 입력에는 이미 정한 훈련 평균과 범위를 적용합니다. 각 집단에서 따로 다시 평균과 범위를 적합하면 좌표와 학습 규칙이 달라집니다. 시험 입력이 훈련 범위를 벗어나도 같은 변환을 적용하며 자동으로 잘라내지 않습니다.

시험 입력을 함께 사용해 척도를 정하는 절차가 어떤 배포 상황에서 허용될 수도 있습니다. 그렇다면 전이적 입력 접근을 가진 다른 규칙으로 이름 붙여야 합니다. 이 장의 순수 훈련 적합 규칙과 섞어 개선이라고 비교하지 않습니다.

Actual-data trainRange subtracts input means and divides by max-minus-min on the same complete training frame. This range is not a standard deviation. A constant training column has zero range and uses an explicit fallback scale one.

Apply those fitted training means and ranges to validation and test inputs. Refitting transformations separately changes coordinates and the rule. Inputs beyond the training range receive the same transformation without automatic clipping.

Using test inputs to fit scaling may be permitted in some deployment settings. It then defines another rule with transductive input access, which must be named separately rather than mixed with a training-only comparison.

학부Undergraduate

29. 결과 단위도 λ의 해석에 들어간다29. Outcome units also affect lambda

결과와 모든 예측을 k>0배로 바꾼다고 합시다. 기울기와 절편도 k배이고 자료 제곱손실은 k²배입니다. Ridge 제곱벌점도 k²배이므로 같은 λ로 전체 최적해가 대응합니다. Lasso 절댓값 벌점은 k배뿐이므로 같은 목적함수를 k²배로 맞추려면 λ도 k배로 바꿉니다.

이 관계는 입력 좌표를 고정하고 결과 단위만 바꾼 경우입니다. 결과에서 상수를 더하는 것은 벌점 없는 절편이 흡수합니다. 절편이 없는 모형에는 같은 이동 불변성을 적용하지 않습니다.

실제 개인 자료의 원임금 센트를 달러로 바꿀 때 k=1/100입니다. 같은 예측 규칙을 단위만 바꿔 옮기려면 Lasso λ도 1/100배입니다. 서로 다른 단위의 MSE 숫자를 그대로 비교하지 않습니다.

Multiply outcomes and predictions by k>0. Intercepts and slopes also multiply by k, while squared data loss multiplies by k². Ridge’s squared penalty scales the same way, so the same lambda preserves mapped solutions. Lasso’s absolute penalty scales only by k; multiply its lambda by k to preserve the objective up to k².

This comparison holds input coordinates fixed. Adding a constant to outcomes is absorbed by an unpenalized intercept. A no-intercept model does not share that translation invariance.

Converting the actual raw wage from cents to dollars uses k=1/100. Merely translating the same Lasso rule between these units also scales lambda by 1/100. MSE numbers expressed in different units cannot be compared directly.

학부Undergraduate

30. 라이브러리의 alpha와 교재 λ를 맞춘다30. Match a library alpha to the declared lambda

공식 scikit-learn 선형모형 문서의 Ridge 식은 SSE+αΣbⱼ², Lasso 식은 SSE/(2n)+αΣ|bⱼ|입니다. 단위 관측 가중치 n행과 단위 기울기 벌점에서 이 장의 Ridge λ는 α/n, Lasso λ는 α입니다. 즉 같은 숫자 alpha를 두 방법에 주는 것이 같은 규약을 뜻하지 않습니다.

이 대조는 문서에 적힌 목적함수와 같은 가용 행·절편·단위를 전제로 한 대수 비교입니다. 가중치를 라이브러리가 재정규화하는 경우와 다른 solver의 정지 규약은 별도로 확인해야 합니다. 문서의 식을 읽은 것과 실제 라이브러리 실행 결과를 검증한 것은 구별합니다.

다운로드 Python/R 예제는 이 장의 작은 정확 공식을 별도로 재현합니다. 사용하지 않은 패키지의 버전·수렴 성공을 만들어 기록하지 않습니다.

The official scikit-learn linear-model guide writes ridge as SSE+αΣbⱼ² and Lasso as SSE/(2n)+αΣ|bⱼ|. For n unit-weight rows and unit slope penalties, our ridge lambda is α/n, whereas our Lasso lambda is α. Giving both methods the same numerical alpha does not equate conventions.

This is an algebraic comparison of documented objectives with matching rows, intercept treatment and units. Library weight rescaling and solver stopping rules need separate checks. Reading an objective is different from verifying a package execution.

Downloadable Python/R examples independently reproduce our small formulas. They do not invent versions or convergence claims for a package they do not use.

학부Undergraduate

31. 유한 격자는 연속 정규화 경로의 전부가 아니다31. A finite path grid is not the whole continuous path

고정 λ에서 전역 최소해집합을 구하는 것과 유한 후보 λ 중 규칙을 선택하는 것은 다른 작업입니다. 실습은 선언한 유한 λ 격자의 정확한 답을 비교합니다. 그 격자 사이의 모든 λ를 최적화했다고 말하지 않습니다.

일반 상관 설계에서 변수의 진입·이탈이 각 좌표의 단순 단조성을 따르지 않을 수 있습니다. 두 직교 변수의 soft threshold 그림은 특수 예제로 읽어야 합니다. 선분 형태의 계수 해집합도 유한 격자의 한 점으로 없애지 않습니다.

그래프에서 조회점들을 연결할 때는 가이드선임을 설명합니다. λ=0의 OLS 전체 해와 양수 λ의 벌점 최소해를 같은 단일 계수 곡선으로 보이게 하지 않습니다. 표시 범위 밖의 정확한 해는 표와 집합 설명에서 읽습니다.

Computing the global minimizer set at a fixed lambda and selecting a rule from a finite lambda menu are different tasks. The lab compares exact answers on a declared finite grid, not every value between grid points.

In correlated designs, entry and exit need not follow simple coordinate-wise monotonicity. An orthogonal soft-threshold plot is a special example. A coefficient segment cannot be discarded merely because the lambda grid is finite.

Connected query points are guides when the whole path is not constructed. Do not display the complete OLS set at zero and positive-lambda penalized sets as if they were always a single coefficient curve. Exact values outside the plot range remain in tables and set descriptions.

학부Undergraduate

32. 목적함수 최소화와 위험 최소화는 다르다32. Objective minimization differs from risk minimization

훈련 목적함수를 정확히 풀었다는 사실은 계산 최적화의 결론입니다. 그 예측이 어떤 미지의 새 결과 법칙에서 최소 위험을 갖는다는 결론은 아닙니다. 벌점은 학습 규칙을 바꾸지만 실제 법칙을 알려 주지 않습니다.

훈련 MSE는 OLS보다 Ridge나 Lasso에서 작아질 수 없습니다. 이 장에서 정의한 가중 MSE를 같은 가용 행·같은 관측 가중치·같은 선형 예측 공간에서 비교한다면 OLS가 그 손실을 최소화하기 때문입니다. 그러나 별도의 검증·시험 MSE 순서는 어느 쪽이든 될 수 있습니다.

계수 노름이 줄거나 0이 많아지는 것을 성공의 유일한 기준으로 삼지 마세요. 정보 시점에 맞는 기준 모형·평가 표적·가용 분모를 함께 제시해야 합니다. 다음 묶음에서 이 절차를 명시적으로 구성합니다.

An exact minimizer proves that a declared optimization problem was solved. It does not prove minimum risk under an unknown fresh-outcome law. A penalty changes a learning rule without revealing that law.

For our weighted MSE on the same available training frame, observation weights and linear prediction space, ridge or Lasso cannot have smaller training MSE than OLS, which minimizes that loss. Separate validation and test MSE rankings can go either way.

Smaller norms or more zeros are not sufficient success criteria. Present a baseline, evaluation target and available denominators consistent with information timing. The next group constructs that procedure explicitly.

학부Undergraduate

33. 적합·선택·시험의 순서를 고정한다33. Fix the order of fitting, selection and testing

먼저 원행의 역할을 훈련·검증·시험으로 정하고 후보 목록을 기록합니다. 각 후보는 훈련자료에서만 변환과 계수를 적합합니다. 비유일 계수에서는 정한 최소 기울기 노름 규칙으로 한 예측을 선택한 뒤 검증합니다.

다음으로 모든 후보를 같은 가용 검증 행에서 비교하여 최소 MSE의 후보 집합을 구합니다. 동률 후보가 여러 개면 전부 공개하고 미리 정한 첫 후보 규칙으로 하나를 고릅니다. 시험자료는 이 순서를 바꾸는 데 사용하지 않습니다.

마지막으로 선택된 규칙의 시험 손실을 한 번 계산합니다. 이 보관 표의 점수와 실제 새 모집단 위험은 다른 개념입니다. 독립 시험이라는 해석에는 표집 법칙과 정보 시점이 추가로 필요합니다.

First assign training, validation and test roles and record a candidate menu. Every candidate fits transformations and coefficients using training only. For nonunique coefficients, apply the declared minimum-slope-norm selector before validation.

Compare all candidates on the same available validation rows. Report every minimum-MSE candidate and choose one using a predeclared first-candidate tie rule. Test data do not alter this sequence.

Finally compute the selected rule’s test loss. A retained-table score differs from population risk. An independent-test interpretation requires additional sampling and information-time premises.

학부Undergraduate

34. 검증 동률과 시험 순서가 뒤집히는 작은 표34. A small table with validation ties and reversed test ranking

훈련 표는 (X,Y)=(−1,−1),(1,1)입니다. 절편을 포함한 OLS 기울기는 1이고, 단위 벌점 Ridge λ=1과 Lasso λ=1/2는 모두 1/2입니다. 훈련 평균 기준 모형은 0을 예측합니다.

검증 한 행은 (2,1)입니다. 네 후보의 검증 손실은 아래와 같아 Ridge와 Lasso가 동률 최소입니다. 먼저 선언한 후보 순서가 기준 모형, OLS, Ridge, Lasso라면 Ridge를 고릅니다.

시험 한 행 (2,2)에서는 OLS 손실이 0이고 선택한 Ridge 손실은 1입니다. 검증 최소 규칙이 이 시험 행에서도 최소여야 할 이유는 없습니다. 시험 결과를 보고 OLS로 바꾸면 시험을 선택자료로 재사용한 것입니다.

가정 검증 한 행 (2,1)의 후보 비교
후보검증 예측검증 제곱손실
훈련 평균01
OLS21
Ridge λ=110
Lasso λ=1/210

Train on (X,Y)=(−1,−1),(1,1). OLS with an intercept has slope one; unit-penalty ridge at λ=1 and Lasso at λ=1/2 both have slope 1/2. The training-mean baseline predicts zero.

The single validation row is (2,1). The table gives all scores: ridge and Lasso tie. If the declared order is baseline, OLS, ridge, Lasso, choose ridge.

On test row (2,2), OLS has zero loss while selected ridge has loss one. A validation minimizer need not minimize this test score. Switching to OLS after seeing the test outcome would reuse test data for selection.

Assumed single validation row (2,1)
CandidateValidation predictionSquared loss
Training mean01
OLS21
Ridge λ=110
Lasso λ=1/210
학부Undergraduate

35. 기준 모형도 같은 분모로 비교한다35. Compare a baseline on the same denominator

가중 제곱손실을 최소화하는 상수는 가용 훈련 결과의 가중 평균입니다. 이를 모든 검증·시험 입력에 같은 값으로 적용합니다. 시험 평균을 기준 모형의 상수로 쓰면 시험 정답으로 적합한 oracle이 됩니다.

선형 후보들과 공정하게 비교하려면 같은 평가 행을 사용합니다. 상수 기준 모형 자체는 입력이 없어도 예측할 수 있지만, 그 장점을 이용해 더 많은 행에서 계산한 MSE를 선형 후보의 더 작은 가용 표 점수와 직접 비교하면 분모와 표적이 달라집니다.

이 장은 모든 후보에 두 입력과 결과가 가용한 공통 행을 사용하고, 원행 수와 제외된 행 수도 함께 냅니다. 예측값을 낼 수 있는 행과 평가 정답까지 있는 행도 구별합니다.

The weighted mean of available training outcomes minimizes constant squared loss. Apply that same number to every validation and test input. A test-mean baseline would be an oracle fitted using test answers.

Use the same evaluation rows for comparison with linear candidates. A constant rule can predict without inputs, but comparing its MSE on more rows with a linear rule’s smaller available frame changes both denominator and target.

Here every candidate uses a shared complete frame requiring both inputs and outcome. Report original and excluded row counts. Distinguish rows with predictions from rows also having evaluation outcomes.

학부Undergraduate

36. 동률 집합과 선택된 후보를 모두 남긴다36. Retain both the tie set and chosen candidate

검증 MSE가 같은 후보가 여러 개면 argmin은 집합입니다. λ=0인 Ridge와 Lasso가 같은 OLS 규칙을 나타내는 중복 후보일 수도 있습니다. 전체 후보 인덱스와 첫 인덱스 선택을 나란히 보여야 재현 가능합니다.

검증 정답을 이용해 선택 규칙을 정해 놓고 미리 정한 규칙이라고 부르지 않습니다. 벌점 종류, λ 격자, 척도 선택, 비유일 계수 멤버 선택도 후보 검색의 일부가 될 수 있습니다.

가용 검증 결과가 하나도 없으면 후보 선택은 미정의입니다. 기준 모형이나 첫 후보를 검증 최적이라고 표시하지 않습니다. 별도 사전 기본값을 사용하려면 그것이 검증 선택이 아님을 명시해야 합니다.

If several candidates share minimum validation MSE, argmin is a set. Ridge and Lasso at zero may be duplicate representations of the same OLS rule. Report all candidate indices alongside first-index selection for reproducibility.

A rule chosen using validation answers is not predeclared. Penalty type, lambda grid, scaling and nonunique-member selection can all enlarge a candidate search.

With no available validation outcomes, validation selection is undefined. Do not label the baseline or first candidate as validation-optimal. An explicit prior default would be another rule.

학부Undergraduate

37. 선택 뒤 재적합하면 다른 절차가 된다37. Refitting after selection defines another procedure

훈련과 검증에서 λ를 고른 뒤 그 λ로 훈련+검증을 다시 적합할 수 있습니다. 이때 평균·범위·계수도 새 적합 표에서 다시 정합니다. 원래 훈련에서 적합한 후보를 그대로 시험하는 절차와 구별해야 합니다.

재적합 표에 시험 결과를 넣지 않더라도 학습 크기가 달라집니다. 검증 때 계산한 후보 손실은 더 작은 훈련 크기의 규칙을 평가했습니다. 그것을 재적합 규칙의 관측 시험 점수로 바꿔 쓸 수 없습니다.

이 장의 실제 실습은 선택 뒤 원래 훈련 적합을 유지하여 정보 흐름을 단순하게 고정합니다. 재적합을 구현하지 않은 도구가 재적합 성능까지 검증했다고 말하지 않습니다.

After selecting lambda using training and validation, one may refit at that lambda on their union. Means, ranges and coefficients are then fitted again on the enlarged table. This differs from testing the original training fit unchanged.

Even without adding test outcomes, training size changes. Candidate validation scores evaluated smaller-training-size rules; they are not observed test scores for the refitted procedure.

Actual labs here keep the original training fit after selection, making information flow explicit. A tool that does not implement refitting does not claim to validate refitted performance.

학부Undergraduate

38. 교차검증에서는 변환도 fold마다 다시 적합한다38. Cross-validation refits transformations within each fold

교차검증을 사용한다면 각 검증 fold를 뺀 훈련 부분에서 평균·범위·λ별 계수를 적합합니다. 전체 표의 척도를 먼저 계산한 뒤 fold만 나누면 입력 접근 규칙이 달라집니다. 결과를 사용하지 않는 변환도 어떤 정보를 허용하는지 따져야 합니다.

fold가 전체 (X,Y) 표본과 독립인 사전 배치이고 iid 표본이라는 가정이 있어야 훈련 크기에 따른 위험 항등식을 사용할 수 있습니다. X를 보고 만든 그룹 분할은 배포 표적에 유용할 수 있지만 그 iid 크기 항등식이 자동 성립하지 않습니다.

fold 점수는 훈련 행을 공유하므로 일반적으로 독립이 아닙니다. fold 표준편차를 √K로 나눈 값에 추가 근거 없이 표준오차라는 이름을 붙이지 않습니다. ML03의 학습 크기·겹침 구분을 그대로 적용합니다.

In cross-validation, fit means, ranges and each lambda’s coefficients on the training complement of every fold. Computing a whole-table scale first changes the information-access rule. Even an outcome-free transformation needs an explicit input-access policy.

Training-size risk identities require iid sampling and a fold allocation fixed independently of the entire (X,Y) sample. Input-informed group splits may target useful deployment questions without satisfying those iid-size identities.

Fold scores generally share training records and are dependent. Their sample standard deviation divided by √K is not automatically a justified standard error. Retain the training-size and overlap distinctions from ML03.

학부Undergraduate

39. 가중치 재척도와 행 복제39. Rescaling weights and replicating rows

모든 관측 가중치를 k>0배로 바꾸면 분자 제곱합과 W가 함께 k배가 됩니다. 정규화 손실·가중 평균·G·c는 같으므로 같은 λ의 Ridge와 Lasso 전체 해도 같습니다. 가중치의 상대 비중은 바꾸지 않은 변환입니다.

정수 가중치는 그만큼 동일 행을 복제한 정규화 제곱손실과 대응합니다. 하지만 복제 행이 독립적인 새 정보가 된 것은 아닙니다. 학습 표의 수치 목적함수 등가성과 통계적 표본 크기를 구별해야 합니다.

가중치 일부를 바꾸거나 제외 규칙을 바꾸면 표적과 목적함수가 달라집니다. 0 가중치 행의 결과를 크게 바꿔도 적합이 변하지 않는 반면 그 행을 양수로 만들면 변할 수 있습니다.

Multiplying every observation weight by k>0 scales both weighted SSE and W by k. Normalized loss, weighted means, G and c are unchanged, hence so are full ridge and Lasso sets at the same lambda. Relative weights have not changed.

Integer weights correspond to replicating each row in a normalized squared-loss objective. Replication does not create independent information. Numerical objective equivalence differs from statistical sample size.

Changing relative weights or exclusion rules changes the objective and target. Altering an outcome with zero weight leaves the fit unchanged, whereas giving that row positive weight can change it.

학부Undergraduate

40. 보관 표 점수에 불확실성이 자동으로 붙지 않는다40. An archive score does not carry automatic uncertainty

보관된 시험 행의 MSE는 그 행들과 적합 규칙이 주어지면 계산되는 수치입니다. 신뢰구간이나 새로운 모집단 위험으로 해석하려면 관측 단위, 선택, 의존 구조와 정보 시점에 대한 가정이 필요합니다. 원행 번호는 그 가정을 증명하지 않습니다.

λ를 고른 검증 최솟값은 선택에 사용한 값입니다. 최소를 취한 낙관성이 없다고 선언하거나, 같은 표를 여러 번 보고 수정한 절차를 단일 독립 시험처럼 서술하지 않습니다.

실제 사례는 각 역할의 기술적 점수와 선택 이력을 공개합니다. 정규화가 국가 정책 효과, 교육 개입 효과 또는 와인 성분 조정 효과를 식별한다는 주장은 하지 않습니다.

A retained test MSE is computable from its rows and the fitted rule. Confidence intervals or population-risk interpretations need assumptions about units, selection, dependence and timing. Assigned source-row numbers do not prove these assumptions.

The minimum validation score was used for selection. Do not declare that it has no selection optimism, or describe a repeatedly inspected and revised procedure as a single independent test.

Actual cases disclose descriptive role scores and selection history. Regularization does not identify national policy, schooling-intervention or wine-composition effects.

학부Undergraduate

41. 국가: 같은 2024년 지표로 무엇을 예측하는가41. Country: what is predicted from contemporaneous 2024 indicators?

새 목적의 선택은 보관 World Bank 원 JSON에서 2024년의 16개 국가를 다시 읽어 만듭니다. 결과는 2015년 불변 USD의 1인당 GDP이고 두 입력은 출생 시 기대수명(년), ILO 모형 실업률(%)입니다. 국가·연도·지표별 원행 위치와 원 소수 토큰을 함께 보존합니다.

보관 국가 순서의 처음 10개를 훈련, 다음 3개를 검증, 마지막 3개를 시험으로 정한 사후 학습용 분할입니다. 각 역할의 세 변수는 모두 가용합니다. 이는 전 세계 국가의 확률표본도, 사전에 등록한 새 국가 평가 설계도 아닙니다.

동년 입력으로 동년 결과를 설명하는 보관 예측 비교입니다. 입력이 실제 예측 시점에 이미 공표돼 있었다고 확인한 미래 예측 과제로 부르지 않습니다. 기대수명·실업률 계수를 정책의 인과 효과로 해석하지 않습니다.

For this new purpose, reread the retained World Bank JSON and select 16 countries in 2024. Outcome is GDP per person in constant 2015 USD; inputs are life expectancy at birth in years and ILO-modeled unemployment in percent. Retain each country-year-indicator position and original decimal token.

Use the first ten retained countries for training, the next three for validation and the final three for testing. All selected values are available. This retrospective teaching split is neither a world-country probability sample nor a preregistered new-country design.

It compares contemporaneous archived predictors and outcomes. It is not certified forecasting with inputs already published at a deployment date, and the slopes do not identify policy effects.

학부Undergraduate

42. 개인: 원임금과 교육·나이의 공통 가용 행42. Person: a shared available frame for raw wages, education and age

원 Card 보관 ZIP의 nls.dat 3,613행에서 교육 연수 ed76, 나이 age76, 원시급 wage76을 새로 읽습니다. wage76은 1976년 센트/시간이므로 100으로 나누어 1976 USD/시간으로 씁니다. 절단된 로그임금 3,010개의 분석과 이번 원임금 3,017개의 분석은 다릅니다.

원행 위치를 0부터 세어 7로 나눈 나머지 0–3은 훈련, 4는 검증, 5–6은 시험입니다. 원행 수는 2,065/516/1,032이고 원임금 가용 분모는 1,690/443/884입니다. 전체 원임금 미관측 596행을 원행 틀에 남기며, 가용 분모가 3,613이라고 표시하지 않습니다.

교육·나이와 임금의 예측 관계를 계산하지만 추가 교육이나 나이 증가의 개입 효과를 추정한 것은 아닙니다. 원 개인 코드와 원행 위치를 구별하고, 이 행 분할만으로 새 개인에 대한 독립 일반화를 입증하지 않습니다.

Reread all 3,613 nls.dat rows in the retained Card ZIP, selecting ed76 education, age76 and raw wage76. Raw wages are cents per hour in 1976, divided by 100 to obtain 1976 USD/hour. This 3,017-available-raw-wage analysis differs from a 3,010-available trimmed-log analysis.

Using zero-based source position modulo seven, residues 0–3 train, four validate and 5–6 test. Source counts are 2,065/516/1,032, with available wage denominators 1,690/443/884. Preserve all 596 unavailable raw-wage rows in the frame.

The calculation describes wage prediction from education and age, not schooling or aging intervention effects. Distinguish original person codes from source positions; this row split does not prove independent generalization to new people.

학부Undergraduate

43. 제품 기록: 품질 점수의 수치 간격은 선택이다43. Product records: numerical score spacing is a choice

기업 사례의 자료 단위는 확인된 기업이 아니라 포르투갈 Vinho Verde 적포도주 제품·실험실 기록입니다. 원 UCI 파일의 1,599행과 12개 열을 다시 읽으며 두 예측 입력은 alcohol과 volatile acidity입니다. 생산자·판매 가격·브랜드 코드는 자료에 주어지지 않았습니다.

quality는 적어도 세 평가자의 중앙값으로 정한 순서 점수입니다. 원 점수를 바꾸지 않고 수치 제곱손실을 적용하지만 5→6과 6→7의 차이가 같은 효용 차이라는 사실이 입증된 것은 아닙니다. 선택한 수치 간격 아래의 예측 비교입니다.

원 DOI 10.24432/C56S3T와 UCI의 CC BY 4.0 귀속을 보존합니다. 두 화학 입력의 계수를 성분을 조작했을 때 품질이 얼마나 변하는지에 대한 인과 효과로 읽지 않습니다.

The company-oriented case uses Portuguese Vinho Verde red-wine product/laboratory records, not identified firms. Reread 1,599 rows and all 12 original columns; the two prediction inputs are alcohol and volatile acidity. Producer, selling price and brand identifiers are not supplied.

Quality is an ordered score formed as the median of at least three expert evaluations. We preserve it numerically and choose squared loss. This does not prove that a 5-to-6 change equals a 6-to-7 utility change.

Preserve DOI 10.24432/C56S3T and UCI CC BY 4.0 attribution. Chemical-input slopes do not identify effects of manipulating composition.

학부Undergraduate

44. 결과를 빼고 입력 패턴만으로 분할한다44. Group by input patterns without using quality labels

와인 분할은 선택한 두 열만이 아니라 원래 11개 입력의 정확한 값 튜플을 씁니다. 결과 quality는 패턴 키에 넣지 않습니다. 처음 나타난 입력 패턴부터 번호를 매기고 5로 나눈 나머지 0–2를 훈련, 3을 검증, 4를 시험으로 둡니다.

전체 1,359개 입력 패턴에서 실제 역할별 행은 969/325/305개이며 모두 가용합니다. 같은 전체 입력 패턴은 역할을 가로지르지 않습니다. 그러나 두 선택 입력만 같은 서로 다른 전체 패턴은 다른 역할에 있을 수 있습니다.

이 키는 파생 값의 일치 코드이며 같은 생산자나 같은 개체의 증거가 아닙니다. 입력을 보고 만든 분할이므로 iid 표본 크기 위험 항등식을 자동 적용하지 않습니다. 보관 입력 패턴을 나눈 평가 표적이라고 직접 이름 붙입니다.

Wine splitting uses the exact tuple of all eleven original inputs, not merely the two fitted columns. Outcome quality is excluded from the key. Number patterns by first appearance; modulo-five ranks 0–2 train, three validate and four test.

The 1,359 input patterns produce 969/325/305 available rows. Identical full-input patterns cannot cross roles. Distinct full patterns sharing only the two selected predictors can still occur across roles.

This derived equality key is not proof of a shared producer or entity. Because splitting uses inputs, iid training-size risk identities do not follow automatically. Call it an archived input-pattern holdout target.

학부Undergraduate

45. 실제 유한 격자의 표적과 한계45. Targets and limits of the actual finite grid

실제 비교의 Ridge λ 격자는 0, 1/1000, 1/10, 10이고 Lasso는 0, 1/100, 1, 100입니다. 훈련 평균 기준 모형을 먼저 둡니다. raw와 trainRange는 다른 입력 좌표와 다른 단위 벌점을 쓰는 별도 학습 절차입니다.

같은 역할 행·결과 단위에서만 검증 MSE를 비교합니다. 후보 λ 숫자가 다르고 벌점 종류도 다르므로 총 벌점 목적함수의 크기로 두 방법의 예측 성능 순위를 정하지 않습니다. 각 후보의 자료 손실과 벌점을 분리해서 보여줍니다.

격자는 보관 자료를 사용한 교육 목적의 유한 선택입니다. 모든 λ를 검색했다거나 사전에 등록된 연구 설계라고 주장하지 않습니다. 검증 최솟값과 최종 선택된 후보의 별도 시험 점수를 함께 읽습니다.

Actual ridge lambdas are 0, 1/1000, 1/10 and 10; Lasso uses 0, 1/100, 1 and 100. Place the training-mean baseline first. Raw and trainRange use different coordinates with unit penalties, defining different learning procedures.

Compare validation MSE only on matching role rows and outcome units. Numerical lambdas and penalty types differ; penalized objective magnitudes cannot rank predictive performance across methods. Report data loss and penalty separately.

This is a retrospective educational finite menu, not every lambda or a preregistered study. Read the minimum validation score together with the selected candidate’s separate test score.

학부Undergraduate

46. 축·단위·집합을 유지하며 그래프를 읽는다46. Read plots while retaining units and solution sets

국가 · 같은 2024년 지표에서 벌점·척도를 비교한다

보관 World Bank 원 JSON에서 2024년 16국의 세 지표를 이번 목적에 맞게 다시 읽습니다. 결과는 NY.GDP.PCAP.KD(2015년 불변 USD의 1인당 GDP), 입력은 SP.DYN.LE00.IN(출생 시 기대수명·년)과 SL.UEM.TOTL.ZS(ILO 모형 실업률·%)입니다. 아래 다운로드는 각 지표의 원행 위치·국가 ISO·연도·원 소수 토큰을 보존합니다.

보관 국가 순서 처음 10/다음 3/마지막 3국을 훈련/검증/시험으로 나눈 사후 학습용 설계입니다. 세계 국가의 확률표본이나 미리 등록한 새 국가 평가라고 부르지 않습니다. 동년 입력을 쓰므로 공표 시점이 확인된 미래 예측이나 정책 인과 효과도 아닙니다.

원행 틀과 같은 두 입력·결과 가용 분모
역할원행공통 가용미관측
훈련10100
검증330
시험330

raw는 원래 단위, trainRange는 같은 가용 훈련 행의 평균과 범위(max−min)로 변환합니다. 범위 0인 열은 척도 1을 쓰며 표준편차 변환이라고 부르지 않습니다. 각 좌표에서 기울기 벌점은 단위이고 절편은 벌점에서 제외합니다. 따라서 두 척도는 같은 벌점의 단위 표기만 바꾼 것이 아니라 서로 다른 후보 규칙입니다.

후보 순서는 훈련 평균, Ridge λ=0, 1/1000, 1/10, 10, Lasso λ=0, 1/100, 1, 100입니다. OLS 경계의 중복 후보도 동률 집합에 남깁니다. 정확 검증 MSE의 최소 인덱스를 모두 보존하고, 미리 정한 첫 인덱스 규칙으로 한 후보를 고른 뒤 원래 훈련 적합을 그대로 시험합니다.

JR=12n∑iei2+λ2∑jbj2JL=12n∑iei2+λ∑j∣bj∣\begin{gathered}J_R=\frac{1}{2n}\sum_ie_i^2+\frac{\lambda}{2}\sum_jb_j^2\\J_L=\frac{1}{2n}\sum_ie_i^2+\lambda\sum_j|b_j|\end{gathered}
모든 표시는 소수 근사 · 선택과 동률은 정확 분수로 판정
척도번호규칙λ훈련 MSE검증 MSE검증 최소
원래 단위0훈련 평균—401284352.780413621633448.476118
원래 단위1Ridge076319122.683633189641355.905527
원래 단위2Ridge1/100076319124.604352189643931.672451
원래 단위3Ridge1/1076337414.372563189939621.109036
원래 단위4Ridge10117785777.813704270761011.786394
원래 단위5Lasso076319122.683633189641355.905527
원래 단위6Lasso1/10076319122.683683189641351.350092
원래 단위7Lasso176319123.189676189640901.333527
원래 단위8Lasso10076324183.112513189605614.139463예
훈련 평균·범위0훈련 평균—401284352.780413621633448.476118
훈련 평균·범위1Ridge076319122.683633189641355.905527예
훈련 평균·범위2Ridge1/100076343879.672560190399825.248637
훈련 평균·범위3Ridge1/10146824155.776781309503137.135549
훈련 평균·범위4Ridge10393887960.802963613218131.828589
훈련 평균·범위5Lasso076319122.683633189641355.905527예
훈련 평균·범위6Lasso1/10076319122.685697189641425.550419
훈련 평균·범위7Lasso176319143.328405189648359.047991
훈련 평균·범위8Lasso10076525570.400824190728203.193047

원래 단위의 정확 검증 최소 집합은 후보 {8}입니다. 첫 인덱스 규칙은 8번(Lasso, λ=100)을 선택합니다. 검증 MSE는 약 189605614.139463, 선택된 원래 훈련 적합의 시험 MSE는 약 1952665088.572887입니다.

훈련 평균·범위의 정확 검증 최소 집합은 후보 {1,5}입니다. 첫 인덱스 규칙은 1번(Ridge, λ=0)을 선택합니다. 검증 MSE는 약 189641355.905527, 선택된 원래 훈련 적합의 시험 MSE는 약 2010520213.105617입니다.

그래프는 후보 0–8의 검증 MSE 조회점이며 연속 λ 경로가 아닙니다. y축은 결과의 제곱 단위입니다. 시험 결과를 보고 다른 후보를 고르면 절차가 바뀝니다. 공개 전체 프로필에 보관된 다른 후보의 시험 점수는 사후 재현 감사용이며 선택 입력이 아닙니다.

질문: λ=0인 Ridge와 Lasso가 동률이면 실제 자료가 어느 벌점을 지지했다고 결론 내릴 수 있나요? 풀이: 두 후보는 같은 OLS 예측을 내는 경계 규칙이므로 그 동률로 양수 벌점의 유용성을 식별하지 않습니다. 척도·가중치·가용 행·유한 검색 범위까지 고정해 해석해야 합니다.

원 선택 입력 CSV · 전체 정확 프로필 · 선택 규칙의 원행별 예측

개인 · 원임금의 가용 분모와 훈련 변환을 맞춘다

Card 원 보관 nls.dat 3,613행의 ed76(교육 연수), age76(나이), wage76(1976년 센트/시간 원임금)을 다시 읽습니다. 결과는 wage76/100인 1976 USD/시간입니다. 원임금 3,017가용·596미관측이며, 원자료 절단 로그임금의 3,010가용·603미관측과 바꾸어 쓰지 않습니다. 원점(.)은 공개 CSV의 원 토큰 열에 그대로 남고 모형 결과값에서는 null로 표시됩니다.

0부터 센 원행 위치를 7로 나눈 나머지 0–3은 훈련, 4는 검증, 5–6은 시험입니다. 두 입력은 모두 가용하고, 적합·변환에는 결과까지 가용한 같은 훈련 1,690행을 씁니다. 개인 코드와 원행 위치는 다르며 행 분할만으로 새 개인 독립 표집을 증명하지 않습니다. 교육·나이의 기울기는 개입 효과가 아닙니다.

원행 틀과 같은 두 입력·결과 가용 분모
역할원행공통 가용미관측
훈련20651690375
검증51644373
시험1032884148

raw는 원래 단위, trainRange는 같은 가용 훈련 행의 평균과 범위(max−min)로 변환합니다. 범위 0인 열은 척도 1을 쓰며 표준편차 변환이라고 부르지 않습니다. 각 좌표에서 기울기 벌점은 단위이고 절편은 벌점에서 제외합니다. 따라서 두 척도는 같은 벌점의 단위 표기만 바꾼 것이 아니라 서로 다른 후보 규칙입니다.

후보 순서는 훈련 평균, Ridge λ=0, 1/1000, 1/10, 10, Lasso λ=0, 1/100, 1, 100입니다. OLS 경계의 중복 후보도 동률 집합에 남깁니다. 정확 검증 MSE의 최소 인덱스를 모두 보존하고, 미리 정한 첫 인덱스 규칙으로 한 후보를 고른 뒤 원래 훈련 적합을 그대로 시험합니다.

JR=12n∑iei2+λ2∑jbj2JL=12n∑iei2+λ∑j∣bj∣\begin{gathered}J_R=\frac{1}{2n}\sum_ie_i^2+\frac{\lambda}{2}\sum_jb_j^2\\J_L=\frac{1}{2n}\sum_ie_i^2+\lambda\sum_j|b_j|\end{gathered}
모든 표시는 소수 근사 · 선택과 동률은 정확 분수로 판정
척도번호규칙λ훈련 MSE검증 MSE검증 최소
원래 단위0훈련 평균—6.7680007.046645
원래 단위1Ridge05.5074345.786353예
원래 단위2Ridge1/10005.5074345.786360
원래 단위3Ridge1/105.5076275.787245
원래 단위4Ridge105.8881396.182799
원래 단위5Lasso05.5074345.786353예
원래 단위6Lasso1/1005.5074595.786510
원래 단위7Lasso15.7542196.047236
원래 단위8Lasso1006.7680007.046645
훈련 평균·범위0훈련 평균—6.7680007.046645
훈련 평균·범위1Ridge05.5074345.786353예
훈련 평균·범위2Ridge1/10005.5079775.789789
훈련 평균·범위3Ridge1/106.0121076.333970
훈련 평균·범위4Ridge106.7512827.031113
훈련 평균·범위5Lasso05.5074345.786353예
훈련 평균·범위6Lasso1/1005.5112945.794712
훈련 평균·범위7Lasso16.7680007.046645
훈련 평균·범위8Lasso1006.7680007.046645

원래 단위의 정확 검증 최소 집합은 후보 {1,5}입니다. 첫 인덱스 규칙은 1번(Ridge, λ=0)을 선택합니다. 검증 MSE는 약 5.786353, 선택된 원래 훈련 적합의 시험 MSE는 약 6.068116입니다.

훈련 평균·범위의 정확 검증 최소 집합은 후보 {1,5}입니다. 첫 인덱스 규칙은 1번(Ridge, λ=0)을 선택합니다. 검증 MSE는 약 5.786353, 선택된 원래 훈련 적합의 시험 MSE는 약 6.068116입니다.

그래프는 후보 0–8의 검증 MSE 조회점이며 연속 λ 경로가 아닙니다. y축은 결과의 제곱 단위입니다. 시험 결과를 보고 다른 후보를 고르면 절차가 바뀝니다. 공개 전체 프로필에 보관된 다른 후보의 시험 점수는 사후 재현 감사용이며 선택 입력이 아닙니다.

질문: λ=0인 Ridge와 Lasso가 동률이면 실제 자료가 어느 벌점을 지지했다고 결론 내릴 수 있나요? 풀이: 두 후보는 같은 OLS 예측을 내는 경계 규칙이므로 그 동률로 양수 벌점의 유용성을 식별하지 않습니다. 척도·가중치·가용 행·유한 검색 범위까지 고정해 해석해야 합니다.

원 선택 입력 CSV · 전체 정확 프로필 · 선택 규칙의 원행별 예측

제품 기록 · 입력 패턴을 나누고 순서 점수를 수치로 예측한다

UCI Wine Quality 원 ZIP의 적포도주 파일 1,599×12셀을 다시 읽습니다. 분석 단위는 포르투갈 Vinho Verde 제품·실험실 기록이며 확인된 기업이 아닙니다. 두 입력은 alcohol과 volatile acidity, 결과는 적어도 세 전문가 평가의 중앙값인 quality입니다. 원 사전은 점수가 순서형이고 판매 가격·브랜드·생산자 정보가 없다고 설명합니다. 제곱손실은 원 수치 점수의 간격을 사용하는 명시적 모형 선택입니다.

원래 11개 입력의 정확 값 튜플만으로 1,359개 패턴을 정하며 quality는 키에서 제외합니다. 처음 나타난 패턴 순서의 0기반 번호를 5로 나누어 나머지 0–2를 훈련, 3을 검증, 4를 시험으로 둡니다. 행 수는 969/325/305이고 모두 가용합니다. 같은 전체 입력 패턴은 역할을 가로지르지 않지만, 두 선택 입력만 같은 서로 다른 패턴은 다른 역할에 있을 수 있습니다.

패턴 키는 값의 일치 표시이며 같은 생산자·개체 또는 독립 집단이라는 증거가 아닙니다. 입력을 사용한 사후 분할의 보관 평가이며 시간 외·새 생산자 일반화나 성분 조작 효과를 식별했다고 부르지 않습니다. Cortez 등(2009), DOI 10.24432/C56S3T와 UCI CC BY 4.0 귀속을 보존합니다.

원행 틀과 같은 두 입력·결과 가용 분모
역할원행공통 가용미관측
훈련9699690
검증3253250
시험3053050

raw는 원래 단위, trainRange는 같은 가용 훈련 행의 평균과 범위(max−min)로 변환합니다. 범위 0인 열은 척도 1을 쓰며 표준편차 변환이라고 부르지 않습니다. 각 좌표에서 기울기 벌점은 단위이고 절편은 벌점에서 제외합니다. 따라서 두 척도는 같은 벌점의 단위 표기만 바꾼 것이 아니라 서로 다른 후보 규칙입니다.

후보 순서는 훈련 평균, Ridge λ=0, 1/1000, 1/10, 10, Lasso λ=0, 1/100, 1, 100입니다. OLS 경계의 중복 후보도 동률 집합에 남깁니다. 정확 검증 MSE의 최소 인덱스를 모두 보존하고, 미리 정한 첫 인덱스 규칙으로 한 후보를 고른 뒤 원래 훈련 적합을 그대로 시험합니다.

JR=12n∑iei2+λ2∑jbj2JL=12n∑iei2+λ∑j∣bj∣\begin{gathered}J_R=\frac{1}{2n}\sum_ie_i^2+\frac{\lambda}{2}\sum_jb_j^2\\J_L=\frac{1}{2n}\sum_ie_i^2+\lambda\sum_j|b_j|\end{gathered}
모든 표시는 소수 근사 · 선택과 동률은 정확 분수로 판정
척도번호규칙λ훈련 MSE검증 MSE검증 최소
원래 단위0훈련 평균—0.6853790.561035
원래 단위1Ridge00.4440460.427098
원래 단위2Ridge1/10000.4441090.426348
원래 단위3Ridge1/100.4840000.437286
원래 단위4Ridge100.6495470.535325
원래 단위5Lasso00.4440460.427098
원래 단위6Lasso1/1000.4470680.423366예
원래 단위7Lasso10.6853790.561035
원래 단위8Lasso1000.6853790.561035
훈련 평균·범위0훈련 평균—0.6853790.561035
훈련 평균·범위1Ridge00.4440460.427098
훈련 평균·범위2Ridge1/10000.4443950.424761
훈련 평균·범위3Ridge1/100.5922840.497168
훈련 평균·범위4Ridge100.6840360.560089
훈련 평균·범위5Lasso00.4440460.427098
훈련 평균·범위6Lasso1/1000.4523790.421167예
훈련 평균·범위7Lasso10.6853790.561035
훈련 평균·범위8Lasso1000.6853790.561035

원래 단위의 정확 검증 최소 집합은 후보 {6}입니다. 첫 인덱스 규칙은 6번(Lasso, λ=1/100)을 선택합니다. 검증 MSE는 약 0.423366, 선택된 원래 훈련 적합의 시험 MSE는 약 0.470445입니다.

훈련 평균·범위의 정확 검증 최소 집합은 후보 {6}입니다. 첫 인덱스 규칙은 6번(Lasso, λ=1/100)을 선택합니다. 검증 MSE는 약 0.421167, 선택된 원래 훈련 적합의 시험 MSE는 약 0.470514입니다.

그래프는 후보 0–8의 검증 MSE 조회점이며 연속 λ 경로가 아닙니다. y축은 결과의 제곱 단위입니다. 시험 결과를 보고 다른 후보를 고르면 절차가 바뀝니다. 공개 전체 프로필에 보관된 다른 후보의 시험 점수는 사후 재현 감사용이며 선택 입력이 아닙니다.

질문: λ=0인 Ridge와 Lasso가 동률이면 실제 자료가 어느 벌점을 지지했다고 결론 내릴 수 있나요? 풀이: 두 후보는 같은 OLS 예측을 내는 경계 규칙이므로 그 동률로 양수 벌점의 유용성을 식별하지 않습니다. 척도·가중치·가용 행·유한 검색 범위까지 고정해 해석해야 합니다.

원 선택 입력 CSV · 전체 정확 프로필 · 선택 규칙의 원행별 예측

Country · Compare penalties and scales in contemporaneous 2024 indicators

Reread three indicators for 16 countries in 2024 from the retained original World Bank JSON. Outcome NY.GDP.PCAP.KD is GDP/person in constant 2015 USD; inputs SP.DYN.LE00.IN and SL.UEM.TOTL.ZS are life expectancy in years and ILO-modeled unemployment in percent. The download retains indicator-specific source positions, ISO codes, years and original decimal tokens.

The first ten/next three/final three countries in retained order form a retrospective training/validation/test exercise. This is not a world probability sample or preregistered new-country design. Contemporaneous inputs do not establish forecasting availability or policy causality.

Source frames and common two-input/outcome denominators
RoleSource rowsCommon availableUnavailable
train10100
validation330
test330

Raw uses original units. TrainRange subtracts means and divides by max-minus-min fitted on the same complete training rows. A zero range uses fallback scale one; this is not standard-deviation scaling. Every transformed slope receives a unit penalty, leaving the intercept unpenalized. Thus the two scales define different candidate rules rather than merely relabeling one fixed penalty.

Candidate order is training mean; ridge at 0, 1/1000, 1/10, 10; Lasso at 0, 1/100, 1, 100. Duplicate OLS-boundary candidates remain in tie sets. Retain every exact validation minimizer, select the first predeclared index and test its original training fit without refitting.

JR=12n∑iei2+λ2∑jbj2JL=12n∑iei2+λ∑j∣bj∣\begin{gathered}J_R=\frac{1}{2n}\sum_ie_i^2+\frac{\lambda}{2}\sum_jb_j^2\\J_L=\frac{1}{2n}\sum_ie_i^2+\lambda\sum_j|b_j|\end{gathered}
Decimal approximations · exact fractions determine selection and ties
ScaleIndexRuleλTraining MSEValidation MSEMinimizer
Original units0Training mean—401284352.780413621633448.476118
Original units1Ridge076319122.683633189641355.905527
Original units2Ridge1/100076319124.604352189643931.672451
Original units3Ridge1/1076337414.372563189939621.109036
Original units4Ridge10117785777.813704270761011.786394
Original units5Lasso076319122.683633189641355.905527
Original units6Lasso1/10076319122.683683189641351.350092
Original units7Lasso176319123.189676189640901.333527
Original units8Lasso10076324183.112513189605614.139463yes
Training mean/range0Training mean—401284352.780413621633448.476118
Training mean/range1Ridge076319122.683633189641355.905527yes
Training mean/range2Ridge1/100076343879.672560190399825.248637
Training mean/range3Ridge1/10146824155.776781309503137.135549
Training mean/range4Ridge10393887960.802963613218131.828589
Training mean/range5Lasso076319122.683633189641355.905527yes
Training mean/range6Lasso1/10076319122.685697189641425.550419
Training mean/range7Lasso176319143.328405189648359.047991
Training mean/range8Lasso10076525570.400824190728203.193047

For Original units, the exact validation-minimizer set is candidate indices {8}. The first-index rule selects 8 (Lasso, λ=100). Validation MSE is approximately 189605614.139463; the selected original training fit has test MSE approximately 1952665088.572887.

For Training mean/range, the exact validation-minimizer set is candidate indices {1, 5}. The first-index rule selects 1 (Ridge, λ=0). Validation MSE is approximately 189641355.905527; the selected original training fit has test MSE approximately 2010520213.105617.

The plot shows validation-MSE query points for candidates 0–8, not a continuous lambda path. Its y-axis has squared outcome units. Switching candidates after seeing test answers changes the procedure. Other candidate test scores in the full public profile are retained for retrospective reproduction, not used as selection inputs.

Question: if ridge and Lasso tie at λ=0, does that identify which penalty actual data support? Answer: both are boundary representations of the same OLS predictor. Their tie does not identify the usefulness of a positive penalty. Interpret results with fixed scales, weights, available rows and finite search scope.

Original selected input CSV · Complete exact profiles · Selected-rule row predictions

Person · Match raw-wage denominators and training transformations

Reread all 3,613 original Card nls.dat rows, selecting ed76 education, age76 age and wage76 raw wages in cents/hour in 1976. Outcome wage76/100 is 1976 USD/hour. Raw wages have 3,017 available and 596 unavailable values, distinct from 3,010 available and 603 unavailable source-trimmed logs. Original dot tokens remain in CSV token columns while model outcomes use null.

Zero-based source-position residues 0–3 modulo seven train, four validate and 5–6 test. Both inputs are available; fitting and transformations use the same 1,690 outcome-available training rows. Person codes differ from source positions, and row splitting alone does not prove independent new-person sampling. Slopes do not identify schooling or aging interventions.

Source frames and common two-input/outcome denominators
RoleSource rowsCommon availableUnavailable
train20651690375
validation51644373
test1032884148

Raw uses original units. TrainRange subtracts means and divides by max-minus-min fitted on the same complete training rows. A zero range uses fallback scale one; this is not standard-deviation scaling. Every transformed slope receives a unit penalty, leaving the intercept unpenalized. Thus the two scales define different candidate rules rather than merely relabeling one fixed penalty.

Candidate order is training mean; ridge at 0, 1/1000, 1/10, 10; Lasso at 0, 1/100, 1, 100. Duplicate OLS-boundary candidates remain in tie sets. Retain every exact validation minimizer, select the first predeclared index and test its original training fit without refitting.

JR=12n∑iei2+λ2∑jbj2JL=12n∑iei2+λ∑j∣bj∣\begin{gathered}J_R=\frac{1}{2n}\sum_ie_i^2+\frac{\lambda}{2}\sum_jb_j^2\\J_L=\frac{1}{2n}\sum_ie_i^2+\lambda\sum_j|b_j|\end{gathered}
Decimal approximations · exact fractions determine selection and ties
ScaleIndexRuleλTraining MSEValidation MSEMinimizer
Original units0Training mean—6.7680007.046645
Original units1Ridge05.5074345.786353yes
Original units2Ridge1/10005.5074345.786360
Original units3Ridge1/105.5076275.787245
Original units4Ridge105.8881396.182799
Original units5Lasso05.5074345.786353yes
Original units6Lasso1/1005.5074595.786510
Original units7Lasso15.7542196.047236
Original units8Lasso1006.7680007.046645
Training mean/range0Training mean—6.7680007.046645
Training mean/range1Ridge05.5074345.786353yes
Training mean/range2Ridge1/10005.5079775.789789
Training mean/range3Ridge1/106.0121076.333970
Training mean/range4Ridge106.7512827.031113
Training mean/range5Lasso05.5074345.786353yes
Training mean/range6Lasso1/1005.5112945.794712
Training mean/range7Lasso16.7680007.046645
Training mean/range8Lasso1006.7680007.046645

For Original units, the exact validation-minimizer set is candidate indices {1, 5}. The first-index rule selects 1 (Ridge, λ=0). Validation MSE is approximately 5.786353; the selected original training fit has test MSE approximately 6.068116.

For Training mean/range, the exact validation-minimizer set is candidate indices {1, 5}. The first-index rule selects 1 (Ridge, λ=0). Validation MSE is approximately 5.786353; the selected original training fit has test MSE approximately 6.068116.

The plot shows validation-MSE query points for candidates 0–8, not a continuous lambda path. Its y-axis has squared outcome units. Switching candidates after seeing test answers changes the procedure. Other candidate test scores in the full public profile are retained for retrospective reproduction, not used as selection inputs.

Question: if ridge and Lasso tie at λ=0, does that identify which penalty actual data support? Answer: both are boundary representations of the same OLS predictor. Their tie does not identify the usefulness of a positive penalty. Interpret results with fixed scales, weights, available rows and finite search scope.

Original selected input CSV · Complete exact profiles · Selected-rule row predictions

Product records · Hold out input patterns and predict an ordered score numerically

Reread the original UCI red-wine file, 1,599 rows by 12 columns. Units are Portuguese Vinho Verde product/laboratory records, not identified firms. Inputs are alcohol and volatile acidity; quality is the median of at least three expert evaluations. The source dictionary describes ordered scores and unavailable selling-price, brand and producer information. Squared loss explicitly chooses the original numerical score spacing.

Use exact tuples of all eleven original inputs, excluding quality, to form 1,359 patterns. Number them from zero by first appearance; modulo-five residues 0–2 train, three validate and four test. Role counts are 969/325/305, all available. Full input patterns never cross roles, although distinct full patterns sharing only the two selected inputs may.

Pattern equality does not prove a shared producer, entity or independent group. This input-informed retrospective archive evaluation does not certify temporal/new-producer generalization or composition effects. Preserve Cortez et al. (2009), DOI 10.24432/C56S3T and UCI CC BY 4.0 attribution.

Source frames and common two-input/outcome denominators
RoleSource rowsCommon availableUnavailable
train9699690
validation3253250
test3053050

Raw uses original units. TrainRange subtracts means and divides by max-minus-min fitted on the same complete training rows. A zero range uses fallback scale one; this is not standard-deviation scaling. Every transformed slope receives a unit penalty, leaving the intercept unpenalized. Thus the two scales define different candidate rules rather than merely relabeling one fixed penalty.

Candidate order is training mean; ridge at 0, 1/1000, 1/10, 10; Lasso at 0, 1/100, 1, 100. Duplicate OLS-boundary candidates remain in tie sets. Retain every exact validation minimizer, select the first predeclared index and test its original training fit without refitting.

JR=12n∑iei2+λ2∑jbj2JL=12n∑iei2+λ∑j∣bj∣\begin{gathered}J_R=\frac{1}{2n}\sum_ie_i^2+\frac{\lambda}{2}\sum_jb_j^2\\J_L=\frac{1}{2n}\sum_ie_i^2+\lambda\sum_j|b_j|\end{gathered}
Decimal approximations · exact fractions determine selection and ties
ScaleIndexRuleλTraining MSEValidation MSEMinimizer
Original units0Training mean—0.6853790.561035
Original units1Ridge00.4440460.427098
Original units2Ridge1/10000.4441090.426348
Original units3Ridge1/100.4840000.437286
Original units4Ridge100.6495470.535325
Original units5Lasso00.4440460.427098
Original units6Lasso1/1000.4470680.423366yes
Original units7Lasso10.6853790.561035
Original units8Lasso1000.6853790.561035
Training mean/range0Training mean—0.6853790.561035
Training mean/range1Ridge00.4440460.427098
Training mean/range2Ridge1/10000.4443950.424761
Training mean/range3Ridge1/100.5922840.497168
Training mean/range4Ridge100.6840360.560089
Training mean/range5Lasso00.4440460.427098
Training mean/range6Lasso1/1000.4523790.421167yes
Training mean/range7Lasso10.6853790.561035
Training mean/range8Lasso1000.6853790.561035

For Original units, the exact validation-minimizer set is candidate indices {6}. The first-index rule selects 6 (Lasso, λ=1/100). Validation MSE is approximately 0.423366; the selected original training fit has test MSE approximately 0.470445.

For Training mean/range, the exact validation-minimizer set is candidate indices {6}. The first-index rule selects 6 (Lasso, λ=1/100). Validation MSE is approximately 0.421167; the selected original training fit has test MSE approximately 0.470514.

The plot shows validation-MSE query points for candidates 0–8, not a continuous lambda path. Its y-axis has squared outcome units. Switching candidates after seeing test answers changes the procedure. Other candidate test scores in the full public profile are retained for retrospective reproduction, not used as selection inputs.

Question: if ridge and Lasso tie at λ=0, does that identify which penalty actual data support? Answer: both are boundary representations of the same OLS predictor. Their tie does not identify the usefulness of a positive penalty. Interpret results with fixed scales, weights, available rows and finite search scope.

Original selected input CSV · Complete exact profiles · Selected-rule row predictions

학부Undergraduate

47. 재현 코드는 계산 경로와 원행을 함께 남긴다47. Reproduction retains computation paths and source positions

다운로드 자료는 원행 위치·원 식별자·역할·원 수치 토큰을 포함합니다. 가공 표는 어떤 훈련 변환과 목적함수로 계수를 얻었는지 기록합니다. Python의 정확 분수와 R의 수치 계산은 정밀도 범위가 다르므로 같음의 기준도 구별합니다.

공개 선택 CSV만으로 실행하는 경로와 원 보관 ZIP을 감사하는 경로를 따로 기록합니다. 원 ZIP 없이 실행한 R 프로그램이 원 ZIP을 읽었다고 주장하지 않습니다. 새 프로세스에서 같은 공개 결과가 나오는지 확인합니다.

엔진 저자 검사, 다른 검토자의 독립 계산, 실제 브라우저·영상 재생은 서로 다른 증거입니다. 한 단계가 통과했다고 다른 단계까지 완료됐다고 쓰지 않습니다. 이 구분은 학습 내용과 구현 검증 모두에서 재현성을 지킵니다.

Downloads retain source positions, original identifiers, roles and numerical tokens. Derived tables record training transformations and objective conventions. Python exact fractions and numerical R calculations have different precision scopes and agreement criteria.

Separate public-selected-CSV execution from audits that read retained original ZIPs. An R program run without an original ZIP does not claim to read that ZIP. Check reproducibility in fresh processes.

Author engine tests, another reviewer’s independent calculations and actual browser/video checks are different evidence. Passing one does not complete the others. This distinction supports reproducibility of both the lesson and implementation.

학부Undergraduate

48. 원문에서 λ의 규약과 해의 뜻을 확인한다48. Check objective conventions and solution meanings in primary sources

MIT 6.036의 Ridge 회귀 강의에서는 자료 제곱오차와 기울기 벌점을 어느 항에 쓰는지 구별해 보세요. 영상의 기호를 이 장의 1/(2W) 규약으로 옮기는 것이 과제입니다. 시청할 때 절편의 처리와 입력 중심화 전제도 기록합니다.

Tibshirani의 2011년 회고 논문 첫 절은 L1 벌점과 제약 형태를 소개합니다. 공식 Stanford 소개는 연구자의 이력과 연구 분야를 확인하는 범위로 읽습니다. 논문에 나온 수학적 규칙과 특정 실제 자료의 인과 타당성을 혼동하지 않습니다.

공식 scikit-learn 문서의 Ridge와 Lasso 목적함수를 나란히 적고 단위 가중치 n행에서 alpha를 이 장의 λ로 변환하세요. 읽은 목적함수 정의를 넘어 사용하지 않은 solver의 수치 정확도나 특정 자료의 최적성을 보장하지 않습니다.

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

In MIT 6.036’s ridge lecture, distinguish squared data error from the coefficient penalty. Translate the notation to our 1/(2W) convention, recording intercept treatment and centering premises.

Section one of Tibshirani’s 2011 retrospective introduces the L1 penalty and its constraint form. Read the official Stanford profile for the researcher’s biography and interests. A mathematical procedure does not establish causal validity in a particular actual dataset.

Write the official scikit-learn ridge and Lasso objectives side by side and convert alpha to our lambda for n unit-weight observations. These objective definitions do not certify an unused solver’s numerical accuracy or a model’s optimality for actual data.

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

Ridge 목적함수의 자료 손실과 벌점을 구별한다Separate data loss and penalty in a ridge objective

MIT Open Learning Library · 6.036 · 2019 · Regression

Ridge 목적함수 도입에서 절편·기울기·λ의 위치를 적고 이 장의 SSE/(2n) 규약으로 옮겨 보세요.At the ridge-objective introduction, identify the intercept, slopes and lambda, then translate to this chapter’s SSE/(2n) convention.

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

보고 읽은 뒤 답하기Respond after watching/reading SSE+α||b||²와 이 장 Ridge λ의 관계는?How does alpha in SSE+α||b||² relate to our ridge lambda?

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

단위 가중치 n행이면 α=nλ입니다. 손실의 정규화를 함께 맞춰야 합니다.For n unit-weight rows, α=nλ. Match the loss normalization as well.

Robert Tibshirani와 축소·선택의 구별Robert Tibshirani and shrinkage versus selection

Stanford Profiles · Robert Tibshirani

공식 Bio와 Academic Appointments만 읽고 연구 분야와 선형 예측 규칙의 해석 범위를 구별하세요.Read Bio and Academic Appointments, distinguishing research interests from claims about a particular fitted rule.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 희소 계수는 과학적 무효과의 증거인가요?Does a sparse coefficient establish scientific absence of an effect?

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

아닙니다. 명시한 좌표·벌점 아래 예측 규칙의 선택이며 인과 개입 효과에는 다른 근거가 필요합니다.No. It is a rule chosen under declared coordinates and penalties; intervention effects require other evidence.

L1 벌점의 원 정의와 볼록성The original L1 penalty definition and convexity

Robert Tibshirani · JRSS B · 2011 · 73(3), 273–282

인쇄 273쪽 §1만 읽어 벌점형과 제약형을 비교하고 이 장 λ 규약과의 배율을 계산하세요.Read §1 on printed page273 to compare penalty and constraint forms, and compute the normalization factor for our lambda.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 논문의 SSE+λ_paper L1을 단위 가중치 n행의 교재 규약으로 바꾸려면?How does the paper’s SSE+λ_paper L1 map to our convention for n unit-weight rows?

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

λ_paper=2nλ입니다. 전체 목적함수를 2n으로 나누면 교재 식이 됩니다.λ_paper=2nλ. Divide the whole objective by 2n.

공식 Ridge·Lasso 문서의 서로 다른 정규화Different objective normalizations in official ridge and Lasso docs

scikit-learn official guide · Linear models · §§1.1.2.1, 1.1.3

두 절의 목적함수 정의만 읽고 alpha가 같은 숫자여도 같은 상대 벌점이 아닌 이유를 설명하세요.Read only the two objective definitions and explain why equal numerical alpha does not equate relative penalties.

공식 자료 읽기 ↗Read official resource ↗

보고 읽은 뒤 답하기Respond after watching/reading 단위 가중치에서 Ridge와 Lasso의 alpha 대응은?What are the alpha mappings under unit observation weights?

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

Ridge는 alpha=nλ, Lasso는 alpha=λ입니다. 가중치 재정규화나 solver 실행 정확도를 이 정의만으로 보장하지 않습니다.Ridge uses alpha=nλ; Lasso uses alpha=λ. These definitions do not certify weight rescaling or solver execution accuracy.

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

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

1. 중복 열의 정확 적합Exact fits with duplicate columns

두 행은 (X₁,X₂,Y)=(−1,−1,−1),(1,1,1)이고 가중치는 1입니다. 절편을 포함한 선형 예측 a+b₁X₁+b₂X₂의 훈련 MSE가 0인 전체 계수를 구하세요.

Two unit-weight rows are (X₁,X₂,Y)=(−1,−1,−1),(1,1,1). Find all coefficients of a+b₁X₁+b₂X₂ giving zero training MSE.

풀이와 확인할 이유Solution and explanation

두 잔차가 모두 0이어야 하므로 a−b₁−b₂=−1, a+b₁+b₂=1입니다. 더하면 a=0, 빼면 b₁+b₂=1입니다. 전체 해는 (a,b₁,b₂)=(0,t,1−t), t∈R입니다. 한 계수만 제시하면 비유일성을 놓칩니다.

Both residuals must vanish: a−b₁−b₂=−1 and a+b₁+b₂=1. Adding gives a=0; subtracting gives b₁+b₂=1. The full family is (0,t,1−t) for every real t. One coefficient vector would omit nonuniqueness.

2. 가중 손실의 두 분모Two denominators for weighted loss

오차는 1과 3이고 가중치는 각각 1과 3입니다. 가중 MSE와 이 장의 자료 손실 SSE/(2W)를 계산하세요.

Residuals are one and three, with weights one and three. Compute weighted MSE and our data loss SSE/(2W).

풀이와 확인할 이유Solution and explanation

W=4, SSE=1×1²+3×3²=28입니다. MSE=28/4=7이고 자료 손실은 28/8=7/2입니다. 1/2를 빠뜨리면 벌점 λ의 규약도 달라집니다.

W=4 and SSE=1×1²+3×3²=28. MSE is seven and data loss is 7/2. Omitting the factor 1/2 also changes the penalty convention.

3. 0 가중치 합Zero total weight

두 완전행의 관측 가중치가 모두 0입니다. SSE/(2W)를 최소화해 손실 0을 보고해도 될까요?

Both complete rows have zero observation weight. May one minimize SSE/(2W) and report zero loss?

풀이와 확인할 이유Solution and explanation

아닙니다. W=0이어서 정규화된 목적함수 자체가 미정의입니다. 단순 분자가 0이라는 사실로 0/0을 0으로 정하지 않습니다. 양의 가용 훈련 가중치가 필요하며, 별도 기본값을 쓰면 다른 규칙이라고 밝혀야 합니다.

No. W=0 makes the normalized objective undefined. A zero numerator does not turn 0/0 into zero. Require positive complete training weight; an explicit fallback would define a different rule.

4. 원행과 가용 분모Original rows and available denominators

훈련 표의 세 행은 X=(0,1,null), Y=(2,null,4), 관측 가중치는 모두 1입니다. 입력과 결과가 모두 가용한 공통 규칙에서 원행 수, 가용 행 수와 W를 구하세요.

Training has X=(0,1,null), Y=(2,null,4), all weights one. Under a shared complete-input-and-outcome rule, find source count, available count and W.

풀이와 확인할 이유Solution and explanation

원행은 3개, 가용 행은 첫 행 1개, W=1입니다. 다른 두 원행은 결측 표시를 유지합니다. 결과만 있는 셋째 행을 상수 기준 모형에만 더해 같은 분모 비교라고 부르면 안 됩니다.

There are three source rows, one available row and W=1. Preserve the other rows’ missingness. Adding the outcome-only third row solely to a constant baseline would change the shared denominator.

5. 절편의 가중 평균 공식Weighted intercept formula

훈련 가중 평균은 x̄=(2,3), ȳ=10입니다. 절편은 벌점이 없고 기울기 b=(1,−2)로 고정합니다. 최적 절편과 가중 잔차 평균을 구하세요.

Training weighted means are x̄=(2,3) and ȳ=10. The intercept is unpenalized and slopes are fixed at (1,−2). Find its optimum and the weighted residual mean.

풀이와 확인할 이유Solution and explanation

a=10−[2×1+3×(−2)]=14입니다. 가중 예측 평균은 14+2−6=10이므로 가중 잔차 평균은 0입니다. 이것은 기울기를 OLS로 정하지 않았더라도 성립합니다.

a=10−[2×1+3×(−2)]=14. Weighted mean prediction is 14+2−6=10, giving weighted residual mean zero even when slopes were not chosen by OLS.

6. 직교 Gram 계산Calculate an orthogonal Gram matrix

단위 가중치의 X₁=(−1,−1,1,1), X₂=(−1,1,−1,1), Y=(−2,0,0,2)에서 절편을 포함합니다. 중심화 G와 c, OLS 기울기를 구하세요.

With unit weights, X₁=(−1,−1,1,1), X₂=(−1,1,−1,1), Y=(−2,0,0,2), include an intercept. Find centered G, c and OLS slopes.

풀이와 확인할 이유Solution and explanation

모든 평균은 0이고 각 제곱합은 4, 두 입력 교차합은 0입니다. 결과와 각 입력의 교차합은 4입니다. W=4로 나누면 G=I, c=(1,1), 기울기는 (1,1), 절편은 0입니다.

Means vanish, each input squared sum is four and their cross-product sum is zero. Each input-outcome cross-product sum is four. Dividing by W=4 gives G=I, c=(1,1), slopes (1,1) and intercept zero.

7. 특이성은 해 없음이 아니다Singularity does not imply no solution

G의 두 행은 (1,1)이고 c=(1,1)입니다. Gb=c의 전체 해와 영공간 기저를 구하세요.

Both rows of G are (1,1), and c=(1,1). Find the complete solution to Gb=c and a kernel basis.

풀이와 확인할 이유Solution and explanation

방정식은 하나의 조건 b₁+b₂=1입니다. 한 해 (1,0)에 영공간 방향 (−1,1)을 임의 실수배로 더한 (1−t,t)가 전체 해입니다. rank=1이며 G 역행렬은 없지만 해는 무한히 많습니다.

Both equations reduce to b₁+b₂=1. Starting from (1,0), add any real multiple of kernel vector (−1,1), giving (1−t,t). Rank is one: an inverse fails, but solutions are infinite.

8. 새 예측의 전체 범위The complete range of a new prediction

두 단위 가중치 훈련 행은 (X₁,X₂,Y)=(−1,−1,−1),(1,1,1)입니다. 모든 OLS 최소해에서 새 입력 (1,0)의 예측 범위를 구하세요.

Two unit-weight training rows are (−1,−1,−1) and (1,1,1). Find the range of predictions at new input (1,0) over every OLS minimizer.

풀이와 확인할 이유Solution and explanation

전체 계수는 a=0, (b₁,b₂)=(t,1−t)입니다. 새 예측은 t이고 t는 모든 실수이므로 범위도 R입니다. 두 새 좌표가 각각 훈련 범위 [−1,1]에 있어도 관측 행공간 조건이 충족되지 않습니다.

All coefficients have a=0 and (b₁,b₂)=(t,1−t). The new prediction is t, ranging over all real numbers. Coordinate-wise membership in [−1,1] does not imply observed-row-space membership.

9. 최소 기울기 노름 멤버The minimum-slope-norm member

계수 해집합은 a=0, b₁+b₂=1입니다. b₁²+b₂²가 가장 작은 멤버와 그 노름 제곱을 구하세요.

The solution set is a=0 and b₁+b₂=1. Minimize b₁²+b₂² and give its squared norm.

풀이와 확인할 이유Solution and explanation

b₂=1−b₁을 넣으면 2(b₁−1/2)²+1/2입니다. 유일한 선택은 b₁=b₂=1/2, 기울기 노름 제곱은 1/2입니다. 이는 명시적 선택 규칙이며 나머지 최소제곱 해를 지우지 않습니다.

Substitution gives 2(b₁−1/2)²+1/2. The unique selected member is (1/2,1/2), with squared slope norm 1/2. This declared selection rule does not erase the other least-squares minimizers.

10. 0 가중치의 새 입력A zero-weight input outside the fitted frame

단위 가중치 행 (X₁,X₂,Y)=(−1,−1,−1),(1,1,1)에 가중치 0인 행 (1,0,100)을 더합니다. OLS 적합과 이 셋째 행의 전체 예측 범위는 어떻게 됩니까?

Add row (1,0,100) with weight zero to unit-weight rows (−1,−1,−1),(1,1,1). What changes in OLS fitting and in the third row’s full prediction range?

풀이와 확인할 이유Solution and explanation

목적함수와 전체 해 a=0, b₁+b₂=1은 변하지 않습니다. 셋째 행의 전체 예측은 b₁이므로 모든 실수입니다. 0 가중치 원행까지 훈련 예측 유일성이 확장되는 것은 아닙니다.

Neither the objective nor the family a=0, b₁+b₂=1 changes. The third-row prediction is b₁, hence all real numbers. Unique positive-weight fitted values need not extend to zero-weight source rows.

11. 스칼라 RidgeScalar ridge

중심화한 한 변수의 G=1, c=2, 단위 벌점, λ=1입니다. Ridge 기울기를 구하고 OLS와 비교하세요.

A centered scalar problem has G=1, c=2, unit penalty and λ=1. Find the ridge slope and compare it with OLS.

풀이와 확인할 이유Solution and explanation

(1+1)b=2이므로 Ridge는 b=1입니다. OLS는 b=2입니다. 두 값은 서로 다른 목적함수의 최소해이며 Ridge의 훈련 제곱손실이 더 작다는 뜻이 아닙니다.

(1+1)b=2 gives ridge slope one; OLS gives two. They minimize different objectives. Ridge does not thereby have lower training squared error.

12. λ=0의 경계The lambda-zero boundary

G의 두 행은 (1,1), c=(1,1)입니다. 단위 벌점 Ridge에 λ=0을 주었을 때 전체 해와 선택한 최소 기울기 노름 멤버는 무엇인가요?

Both Gram rows are (1,1), with c=(1,1). At ridge λ=0, give the full set and its minimum-slope-norm selected member.

풀이와 확인할 이유Solution and explanation

λ=0이면 OLS이므로 b₁+b₂=1의 실수 직선 전체가 해입니다. 선택한 멤버는 (1/2,1/2)입니다. λ=0에서 유일한 해라고 보고하거나 G 역행렬을 강제하지 않습니다.

At zero the problem is OLS: the entire real line b₁+b₂=1 minimizes. The selector returns (1/2,1/2), without making the full set unique or requiring an inverse of G.

13. 중복 열의 양수 RidgePositive ridge with duplicate columns

G의 두 행은 (1,1), c=(1,1), 단위 벌점 λ=1입니다. Ridge 기울기를 구하세요.

Both Gram rows are (1,1), c=(1,1), and λ=1 with unit penalties. Find ridge slopes.

풀이와 확인할 이유Solution and explanation

방정식은 2b₁+b₂=1, b₁+2b₂=1입니다. 빼면 b₁=b₂, 따라서 두 기울기는 1/3입니다. 원래 G가 특이해도 G+I는 양의 정부호여서 해가 유일합니다.

Solve 2b₁+b₂=1 and b₁+2b₂=1. Subtracting gives equality, so both slopes are 1/3. Although G is singular, G+I is positive definite.

14. 벌점과 자료 손실 분리Separate penalty and data loss

단위 가중치 훈련 행은 (X,Y)=(−1,−2),(1,2)입니다. Ridge λ=1, 단위 벌점의 해 a=0,b=1에서 MSE, 자료 손실, 벌점, 총목적함수를 구하세요.

Unit-weight rows are (−1,−2),(1,2). At ridge solution a=0,b=1 for λ=1 and unit penalty, find MSE, data loss, penalty and total objective.

풀이와 확인할 이유Solution and explanation

잔차는 −1과 1이라 SSE=2, W=2입니다. MSE=1, 자료 손실 SSE/(2W)=1/2, 벌점 λb²/2=1/2, 총 1입니다.

Residuals are −1 and one, so SSE=2 and W=2. MSE is one, data loss 1/2, penalty 1/2 and total one.

15. 양의 곡률 증명Prove positive curvature

G는 대칭 양의 준정부호, P=diag(pⱼ)이고 모든 pⱼ>0, λ>0입니다. G+λP가 가역인 이유를 설명하세요.

G is symmetric positive semidefinite, P=diag(pⱼ) with every pⱼ>0, and λ>0. Why is G+λP invertible?

풀이와 확인할 이유Solution and explanation

0 아닌 v에서 vᵀ(G+λP)v=vᵀGv+λΣpⱼvⱼ²>0입니다. 따라서 양의 정부호이고 영공간이 {0}이므로 가역입니다. 입력의 확률적 독립은 이 유한 행렬 증명의 전제가 아닙니다.

For nonzero v, vᵀ(G+λP)v=vᵀGv+λΣpⱼvⱼ²>0. The matrix is positive definite and has trivial kernel, hence is invertible. Stochastic independence of predictors is not required.

16. 개별 계수는 커질 수 있다An individual coefficient can increase

G=[[1,1/2],[1/2,1/2]], c=(1/2,1/2)입니다. OLS와 단위 벌점 Ridge λ=1을 구해 첫 계수가 항상 줄어든다는 명제를 평가하세요.

G=[[1,1/2],[1/2,1/2]] and c=(1/2,1/2). Solve OLS and unit-penalty ridge at λ=1, then assess coordinate-wise shrinkage.

풀이와 확인할 이유Solution and explanation

OLS는 (0,1)입니다. Ridge 방정식의 행렬은 [[2,1/2],[1/2,3/2]]이며 해는 (2/11,3/11)입니다. 첫 계수는 0에서 양수로 커집니다. 고유방향 축소와 원래 좌표별 절댓값 감소는 다른 명제입니다.

OLS gives (0,1). Ridge uses matrix [[2,1/2],[1/2,3/2]] and gives (2/11,3/11). The first coefficient grows from zero. Eigen-direction shrinkage does not imply decreasing magnitudes in every original coordinate.

17. 작은 편향·분산 위험A small bias-variance risk calculation

고정 X=(−1,1), Yᵢ=Xᵢβ*+εᵢ, β*=1입니다. 오차 평균 0, 분산 1, 교차공분산 0을 가정합니다. 절편 포함 OLS 기울기와 단위 기울기 벌점 Ridge λ=1의 참 기울기 MSE를 비교하세요.

Assume fixed X=(−1,1), Yᵢ=Xᵢβ*+εᵢ with β*=1. Errors have mean zero, unit variance and zero cross-covariance. Compare slope MSE for OLS with an intercept and ridge λ=1 with a unit slope penalty.

풀이와 확인할 이유Solution and explanation

OLS 기울기는 1+(ε₂−ε₁)/2라 비편향, 분산 1/2입니다. Ridge는 그 절반이므로 편향 −1/2, 분산 1/8, MSE=1/4+1/8=3/8입니다. 이 가정에서 3/8<1/2이지만 모든 참 계수·자료에 대한 보장은 아닙니다.

OLS is 1+(ε₂−ε₁)/2, unbiased with variance 1/2. Ridge halves it, giving bias −1/2, variance 1/8 and MSE 3/8. This improves on 1/2 under the declared assumptions, not for every truth or dataset.

18. 유효 자유도의 traceTrace effective degrees of freedom

단위 가중치, 절편 포함 고정 중심화 설계의 양의 Gram 고유값이 1,1입니다. 단위 벌점 Ridge λ=1에서 기울기 유효 자유도와 절편 포함 값을 구하세요.

A fixed centered design with unit weights and an intercept has positive Gram eigenvalues 1,1. At unit-penalty ridge λ=1, find slope effective degrees of freedom and the total including the intercept.

풀이와 확인할 이유Solution and explanation

각 기울기 방향은 1/(1+1)=1/2를 기여하므로 기울기 합은 1입니다. 벌점 없는 절편의 1을 더하면 총 2입니다. 저장된 계수 개수 3과 다르며, 이것만으로 추론 표준오차가 정해지는 것은 아닙니다.

Each slope direction contributes 1/2, totaling one. Add one for the unpenalized intercept to obtain two. This differs from three stored coefficients and does not itself determine an inferential standard error.

19. 큰 λ의 예측Predictions at large lambda

유한 훈련 표와 양의 기울기 벌점에서 Ridge λ→∞를 생각합니다. 절편 포함/제외의 예측 극한을 각각 말하세요.

For a fixed finite training table with positive slope penalties, consider ridge λ→∞. Give the prediction limits with and without an intercept.

풀이와 확인할 이유Solution and explanation

기울기는 0으로 갑니다. 절편을 포함하면 a→훈련 가중 평균 ȳ_w여서 상수 평균 예측으로 갑니다. 절편이 없으면 a=0이므로 예측은 0으로 갑니다. 유한 λ에서 모든 기울기가 정확 0이라는 주장은 아닙니다.

Slopes approach zero. With an intercept, a approaches training weighted mean ȳ_w, giving a constant-mean predictor. Without one, a=0 and predictions approach zero. This does not assert exact zero slopes at finite lambda.

20. 벌점 가중치의 역할Penalty-weight effects

한 중심화 변수에서 G=1,c=2,λ=1입니다. Ridge의 기울기 벌점 가중치 p를 1에서 3으로 바꾸면 해는 어떻게 달라지나요?

For one centered predictor, G=1,c=2,λ=1. How does the ridge slope change when penalty weight p increases from one to three?

풀이와 확인할 이유Solution and explanation

공식은 b=c/(G+λp)입니다. p=1에서는 1, p=3에서는 1/2입니다. λ만 같아도 벌점 가중치가 다르면 다른 학습 규칙입니다. p는 관측 행 가중치 wᵢ와도 구별합니다.

Use b=c/(G+λp): one at p=1, and 1/2 at p=3. Equal lambda does not equate rules with different slope penalties. Also distinguish p from observation weights wᵢ.

21. 0의 부분기울기The subgradient at zero

f(b)=|b|의 b=0에서 부분기울기 집합을 구하고, 보통 미분값 0이라고 쓰면 안 되는 이유를 설명하세요.

Find the subgradient set of f(b)=|b| at zero. Why is it incorrect to call zero its ordinary derivative?

풀이와 확인할 이유Solution and explanation

부분기울기는 닫힌 구간 [−1,1]입니다. 모든 u에서 |u|≥s u를 만족하는 s의 집합으로 확인할 수 있습니다. 좌우 미분은 −1과 1로 다르므로 보통 미분은 없습니다. 0은 부분기울기 집합의 한 멤버일 뿐입니다.

The subgradient is [−1,1], the set of s satisfying |u|≥su for every u. Left and right derivatives are −1 and one, so no ordinary derivative exists. Zero is only one member of the subgradient set.

22. 음의 soft thresholdNegative soft threshold

중심화 단일 변수 Lasso에서 G=2,c=−3,λ=1,p=1입니다. 기울기와 KKT를 구하세요.

A centered scalar Lasso problem has G=2,c=−3,λ=1,p=1. Find its slope and verify KKT.

풀이와 확인할 이유Solution and explanation

c<−λp이므로 b=(−3+1)/2=−1입니다. 자료 기울기 Gb−c=−2+3=1이고 음수 계수의 벌점 부분기울기는 −1입니다. 두 합은 0이라 KKT가 성립합니다.

Since c<−λp, b=(−3+1)/2=−1. The data gradient is Gb−c=1 and the negative coefficient’s penalty subgradient is −1, so their sum vanishes.

23. 임계값의 등호Equality at the threshold

G=1,c=1,λ=1,p=1인 중심화 단일 변수 Lasso의 전체 최소해를 구하세요.

Find every minimizer of centered scalar Lasso with G=1,c=1,λ=1,p=1.

풀이와 확인할 이유Solution and explanation

b=0에서 |−c|=λp=1이므로 KKT를 만족합니다. 자료 손실은 엄격 볼록이어서 전체 해는 유일한 0입니다. 등호일 때 비영 좌표를 강제로 만들지 않습니다.

At b=0, |−c|=λp=1, satisfying KKT. Strict data-loss convexity makes zero the unique minimizer. Threshold equality does not require a nonzero coordinate.

24. 전체 영해의 λLambda for all-zero slopes

두 변수의 중심화 교차곱은 c=(2,−3), 벌점 가중치는 p=(1,2)입니다. 어떤 λ≥0에서 Lasso 기울기 0이 최소해인가요? λ>0에서 그 영해는 유일한가요?

For centered c=(2,−3) and penalty weights p=(1,2), which λ≥0 make zero slopes a Lasso minimizer? Is the zero solution unique when λ>0?

풀이와 확인할 이유Solution and explanation

λ_max=max(2,3/2)=2이므로 λ≥2입니다. 영해와 다른 해가 같은 훈련 예측을 만들면 자료 손실은 같고 비영 L1 벌점은 더 커집니다. 따라서 양수 λ에서 영해가 최소이면 유일합니다.

λ_max=max(2,3/2)=2, so λ≥2. Any other minimizer must share the fitted values and data loss, but a nonzero vector would have a strictly positive L1 penalty. Thus a minimizing zero vector is unique for positive lambda.

25. Lasso 선분의 목적함수Objective along a Lasso segment

단위 가중치의 두 행에서 X₁=X₂=Y=(−1,1)입니다. 절편 포함 단위 벌점 Lasso λ=1/2의 전체 해와 공통 MSE·벌점·총목적함수를 구하세요.

Two unit-weight rows have X₁=X₂=Y=(−1,1). For Lasso with an intercept, unit penalties and λ=1/2, find the full set, common MSE, penalty and total objective.

풀이와 확인할 이유Solution and explanation

전체 해는 a=0, b₁,b₂≥0, b₁+b₂=1/2입니다. 예측은 ±1/2여서 MSE=1/4, 자료 손실=1/8입니다. L1 벌점은 (1/2)(1/2)=1/4, 총목적함수는 3/8입니다. 끝점만이 아니라 내부도 포함합니다.

All solutions have a=0, nonnegative slopes summing to 1/2. Predictions are ±1/2, giving MSE 1/4 and data loss 1/8. Penalty is 1/4, hence total 3/8. Include the interior, not just endpoints.

26. 선분의 최소 노름Minimum norm on a segment

전체 Lasso 기울기 해는 b₁,b₂≥0, b₁+b₂=1/2입니다. 최소 기울기 노름 멤버와 노름 제곱을 구하세요.

The complete Lasso slope set is b₁,b₂≥0 with sum 1/2. Find its minimum-slope-norm member and squared norm.

풀이와 확인할 이유Solution and explanation

b₂=1/2−b₁을 넣으면 b₁²+b₂²=2(b₁−1/4)²+1/8입니다. 선택은 (1/4,1/4), 노름 제곱은 1/8입니다. 선택 규칙이 내부 점을 고르므로 Lasso의 모든 해가 최대한 희소하다고도 말할 수 없습니다.

The squared norm is 2(b₁−1/4)²+1/8. It uniquely selects (1/4,1/4), with squared norm 1/8. This interior choice also shows that not every Lasso minimizer is maximally sparse.

27. 선분의 새 예측 구간Prediction range of a segment

전체 계수는 a=0, b₁,b₂≥0, b₁+b₂=1/2입니다. 새 입력 (2,−1)의 전체 예측 범위를 구하세요.

Coefficients satisfy a=0, b₁,b₂≥0 and b₁+b₂=1/2. Find all predictions at (2,−1).

풀이와 확인할 이유Solution and explanation

b₁=t, b₂=1/2−t, 0≤t≤1/2이면 예측은 3t−1/2입니다. 따라서 닫힌 구간 [−1/2,1]입니다. 끝점도 다른 지지집합의 유효한 해이므로 포함됩니다.

Writing b₁=t,b₂=1/2−t for 0≤t≤1/2 gives prediction 3t−1/2. The range is closed [−1/2,1], including both valid endpoint supports.

28. 유일한 훈련 적합값의 증명Prove unique fitted values

양의 가중치 훈련 표에서 Lasso의 서로 다른 두 최소해가 다른 훈련 적합값을 낸다고 가정합니다. 볼록성을 사용해 모순을 설명하세요.

Suppose two Lasso minimizers give different fitted vectors on positive-weight training rows. Explain the contradiction using convexity.

풀이와 확인할 이유Solution and explanation

두 계수의 중간값은 적합값의 중간값을 냅니다. 제곱손실은 다른 적합 벡터 사이에서 엄격 볼록이므로 자료 손실이 평균보다 작습니다. L1 벌점은 볼록이라 평균보다 크지 않습니다. 총목적함수가 최소값보다 작아져 모순입니다.

Midpoint coefficients produce midpoint fitted values. Strict convexity of squared loss makes data loss smaller than the average for distinct fitted vectors. Convexity prevents the penalty exceeding its average. Total objective would be below the minimum, a contradiction.

29. 열린 부호 셀과 끝점Open sign cells and endpoints

해집합은 b₁,b₂≥0, b₁+b₂=1/2입니다. 부호 패턴 (+,+),(+,0),(0,+)별 해를 중복 없이 나누세요.

Partition b₁,b₂≥0 with b₁+b₂=1/2 into disjoint sign patterns (+,+),(+,0),(0,+).

풀이와 확인할 이유Solution and explanation

(+,+)는 (t,1/2−t), 0<t<1/2의 열린 선분입니다. (+,0)는 (1/2,0), (0,+)는 (0,1/2) 한 점입니다. 세 집합의 합집합은 닫힌 전체 선분이고 서로 겹치지 않습니다.

The (+,+) cell is (t,1/2−t) with 0<t<1/2. The other cells are points (1/2,0) and (0,1/2). Their disjoint union is the complete closed segment.

30. λ=0에서 부호 제약을 제거한다Remove sign restrictions at lambda zero

두 행의 X₁=X₂=Y=(−1,1), 절편 포함 단위 벌점 Lasso에서 λ=0입니다. λ>0 때처럼 b₁,b₂≥0을 강제해도 되나요?

For two rows X₁=X₂=Y=(−1,1), use an intercept and unit Lasso penalties with λ=0. May one still require both slopes to be nonnegative?

풀이와 확인할 이유Solution and explanation

아닙니다. λ=0이면 목적함수는 OLS여서 전체 해는 a=0, b₁+b₂=1인 실수 직선입니다. (2,−1)도 유효합니다. 양수 λ에서 선택되던 최소 L1 부호 구조를 0 경계의 전체 해에 그대로 강제하지 않습니다.

No. The objective becomes OLS, with full family a=0,b₁+b₂=1 over real coefficients. For example (2,−1) is valid. Positive-lambda sign structure cannot be imposed on the whole zero-lambda set.

31. 계수를 원래 단위로 옮긴다Map coefficients to original units

z₁=(x₁−2)/2, z₂=(x₂+1)/5이고 변환 예측은 ã+γ₁z₁+γ₂z₂, (ã,γ₁,γ₂)=(3,4,10)입니다. 원래 (a,b₁,b₂)를 구하세요.

Let z₁=(x₁−2)/2,z₂=(x₂+1)/5 and transformed coefficients (ã,γ₁,γ₂)=(3,4,10). Find original-coordinate (a,b₁,b₂).

풀이와 확인할 이유Solution and explanation

b₁=4/2=2, b₂=10/5=2입니다. offset은 (2,−1)이므로 a=3−2×2−(−1)×2=1입니다. 원 예측은 1+2x₁+2x₂로 직접 전개해 확인할 수 있습니다.

Slopes are b₁=2,b₂=2. Offsets are (2,−1), so a=3−2×2−(−1)×2=1. Expanding gives the same predictor 1+2x₁+2x₂.

32. Ridge 단위 벌점 보정Correct ridge penalties for units

원 좌표에서 Ridge 벌점 가중치는 (1,1)입니다. z₁=x₁/2,z₂=x₂/10으로 바꾸면서 같은 목적함수를 유지하려면 변환 벌점 가중치는 무엇인가요?

Original ridge penalty weights are (1,1). Under z₁=x₁/2,z₂=x₂/10, which transformed weights preserve the objective?

풀이와 확인할 이유Solution and explanation

b₁=γ₁/2,b₂=γ₂/10이므로 가중치는 (1/4,1/100)입니다. 변환 계수에 그대로 (1,1)을 적용하면 원래 좌표에서 (4,100)의 가중치를 준 다른 벌점이 됩니다.

Since b₁=γ₁/2,b₂=γ₂/10, use (1/4,1/100). Keeping transformed weights (1,1) would instead impose original-coordinate weights (4,100).

33. Lasso 단위 벌점 보정Correct Lasso penalties for units

원 Lasso 벌점 가중치가 (2,3)이고 z₁=x₁/4,z₂=x₂/5입니다. 같은 목적함수를 위한 새 가중치를 구하세요.

Original Lasso weights are (2,3), with z₁=x₁/4,z₂=x₂/5. Find transformed weights preserving the objective.

풀이와 확인할 이유Solution and explanation

절댓값 벌점은 가중치를 척도의 제곱이 아니라 척도로 나눕니다. 따라서 (2/4,3/5)=(1/2,3/5)입니다. Ridge의 제곱 보정과 구별합니다.

Divide absolute-value penalty weights by scales, not squared scales. The result is (2/4,3/5)=(1/2,3/5), unlike the ridge correction.

34. 단위에 의존하는 최소 노름Coordinate-dependent minimum norm

원래 전체 Lasso 해는 b₁,b₂≥0, b₁+b₂=1/2입니다. z₁=x₁,z₂=x₂/10에 맞는 벌점 보정 후, 변환 기울기 노름을 최소화한 멤버를 원래 좌표로 구하세요.

Original Lasso minimizers are nonnegative slopes summing to 1/2. After the penalty correction for z₁=x₁,z₂=x₂/10, minimize transformed slope norm and map back.

풀이와 확인할 이유Solution and explanation

γ₁=b₁,γ₂=10b₂이므로 b₁²+100b₂²를 최소화합니다. b₁=1/2−b₂를 넣고 미분하면 202b₂−1=0입니다. 따라서 b₂=1/202,b₁=50/101입니다. 원래 노름 최소 (1/4,1/4)와 다르지만 전체 해집합과 훈련 예측은 같습니다.

Minimize b₁²+100b₂². Substituting b₁=1/2−b₂ gives derivative 202b₂−1, hence b₂=1/202,b₁=50/101. This differs from original-coordinate minimum norm (1/4,1/4), while preserving the full set and training predictions.

35. 센트에서 달러로 바꿀 때Changing cents to dollars

입력은 그대로 두고 결과·예측을 센트에서 달러로 바꾸어 k=1/100배 합니다. 목적함수를 상수배로 보존하는 Ridge와 Lasso의 λ 변환을 각각 구하세요.

Hold inputs fixed and convert outcomes and predictions from cents to dollars, multiplying by k=1/100. How must ridge and Lasso lambda change to preserve mapped minimizers?

풀이와 확인할 이유Solution and explanation

자료 손실은 k²배입니다. Ridge 벌점도 계수 제곱 때문에 k²배라 λ는 그대로입니다. Lasso 벌점은 계수 때문에 k배만 되므로 λ를 k배, 즉 원래의 1/100로 바꿉니다. 절편은 벌점이 없는 규약입니다.

Data loss scales by k². Ridge’s squared-coefficient penalty does too, so keep lambda unchanged. Lasso’s absolute penalty scales by k; multiply lambda by k=1/100. The intercept remains unpenalized.

36. 모든 가중치의 공통 배율A common multiplier of all weights

모든 관측 가중치를 5배 하고 같은 λ·기울기 벌점을 유지합니다. 정규화 SSE/(2W)에 기반한 Ridge/Lasso 해는 변하나요?

Multiply every observation weight by five while keeping lambda and slope penalties fixed. Do normalized SSE/(2W) ridge/Lasso solutions change?

풀이와 확인할 이유Solution and explanation

변하지 않습니다. SSE와 W가 함께 5배, 평균·G·c도 같아서 전체 목적함수가 같습니다. 독립된 새 표본이 5배 생겼다는 뜻은 아닙니다. 정규화하지 않은 SSE 규약은 다른 결론을 줄 수 있습니다.

No. SSE and W both scale by five, and means, G and c remain unchanged. The complete objective is identical. This does not create five times as much independent information; an unnormalized SSE convention behaves differently.

37. 훈련 범위 변환Training-range transformation

훈련 입력 한 열은 1,3,5입니다. 같은 가용 훈련 행의 평균과 범위를 써 z=(x−mean)/range로 바꿉니다. 훈련 변환값과 시험 입력 9의 변환값을 구하세요.

Training inputs are 1,3,5. Fit z=(x−mean)/range using the same available training rows. Find transformed training inputs and transformed test input nine.

풀이와 확인할 이유Solution and explanation

훈련 평균은 3, 범위는 4입니다. 훈련 z는 −1/2,0,1/2이고 시험 9는 3/2입니다. 시험을 포함해 평균이나 범위를 다시 정하지 않으며 범위 밖이라고 1/2로 잘라내지도 않습니다.

Training mean is three and range four. Training values become −1/2,0,1/2; test input nine becomes 3/2. Do not refit using test inputs or clip the result to the training range.

38. 상수 입력 열의 대체 척도Fallback scale for a constant column

가용 훈련 입력이 모두 7이고 trainRange는 0 범위에서 척도 1을 쓰기로 했습니다. 훈련 입력과 시험 입력 9는 어떻게 변환되나요? 이 열의 훈련 Lasso 양수 λ 기울기는?

Every available training input is seven. trainRange explicitly uses scale one for a zero range. Transform training inputs and test input nine. What is this scalar column’s positive-lambda Lasso slope?

풀이와 확인할 이유Solution and explanation

offset=7, scale=1이라 훈련은 모두 0, 시험 9는 2입니다. 훈련 중심화 G=c=0이므로 양수 Lasso 벌점은 기울기를 유일하게 0으로 만듭니다. 훈련 상수라는 사실이 모든 미래 입력도 7이라고 보장하지는 않습니다.

Offset seven and fallback scale one make training inputs zero and test input nine become two. Centered G=c=0, so a positive Lasso penalty uniquely selects zero slope. A constant training column does not prove future constancy.

39. 시험 입력으로 척도 선택Using test inputs to choose scaling

훈련은 X=(0,2), 시험 입력은 100입니다. 결과는 보지 않고 전체 입력 범위 100으로 Ridge 척도를 정했습니다. 이것을 훈련 범위 2만 쓴 같은 규칙이라고 할 수 있나요?

Training inputs are 0,2 and a test input is 100. Without seeing test outcomes, use whole-input range 100 for ridge scaling. Is this the same rule as training-only range two?

풀이와 확인할 이유Solution and explanation

아닙니다. 입력 접근과 벌점 좌표가 달라집니다. 결과 누수와 같다고 단정할 필요는 없지만 시험 입력에 접근하는 별도 전이적 규칙이라고 밝혀야 합니다. 그 접근을 허용한 배포 표적과 훈련 전용 규칙을 구별합니다.

No. Input access and penalty coordinates differ. It need not be called outcome leakage, but it is another transductive rule with test-input access. Distinguish its deployment target from training-only fitting.

40. 절편 없는 중심화Centering a no-intercept model

한 행 X=0,Y=3에서 절편 없는 예측 bX의 최소 훈련 MSE를 구하세요. 중심화 뒤 평균을 복구해 3을 예측하면 같은 모형인가요?

For one row X=0,Y=3, find minimum training MSE for no-intercept prediction bX. Is centering and restoring an outcome mean of three the same model?

풀이와 확인할 이유Solution and explanation

어떤 b도 예측이 0이므로 최소 MSE는 9입니다. 평균을 복구해 3을 예측하면 절편을 새로 넣은 것이어서 다른 가능 예측 공간입니다. 절편 없는 문제에 벌점 없는 절편의 중심화 공식을 적용하지 않습니다.

Every b predicts zero, so minimum MSE is nine. Restoring mean three adds an intercept and changes the feasible predictor space. The unpenalized-intercept centering formula cannot be applied to a no-intercept problem.

41. 검증 후보의 전체 동률All validation ties

훈련은 단위 가중치 (X,Y)=(−1,−1),(1,1)입니다. 후보 순서는 훈련 평균, OLS, Ridge λ=1, Lasso λ=1/2이고 기울기 벌점은 단위입니다. 검증 한 행 (2,1)에서 최소 MSE 후보 집합과 첫 후보 선택을 구하세요.

Train on unit-weight (−1,−1),(1,1). Candidate order is training mean, OLS, ridge λ=1, Lasso λ=1/2, all slope penalties one. Find validation minimizers and first-index selection on row (2,1).

풀이와 확인할 이유Solution and explanation

절편은 모두 0이고 기울기는 0,1,1/2,1/2입니다. 검증 예측은 0,2,1,1, 손실은 1,1,0,0입니다. 전체 동률 집합은 Ridge와 Lasso이고 첫 후보 규칙은 Ridge입니다.

Intercepts vanish and slopes are 0,1,1/2,1/2. Predictions are 0,2,1,1 and losses 1,1,0,0. Both ridge and Lasso minimize; the first-index rule selects ridge.

42. 시험 후 선택 변경Changing selection after testing

동일한 단위 관측 가중치와 벌점 없는 절편·단위 기울기 벌점을 쓰고, 훈련 두 행 (−1,−1),(1,1)과 검증 한 행 (2,1)으로 Ridge λ=1을 선택했습니다. 시험 한 행은 (2,2)입니다. 선택한 Ridge와 OLS의 시험 손실을 구하고, 시험 결과로 OLS를 고르면 무엇이 바뀌나요?

With unit observation weights, an unpenalized intercept and a unit slope penalty, training rows (−1,−1),(1,1) and validation row (2,1) selected ridge λ=1. Test on (2,2). Compare selected ridge and OLS test losses, and explain switching to OLS after testing.

풀이와 확인할 이유Solution and explanation

Ridge 예측 1의 손실은 1이고 OLS 예측 2의 손실은 0입니다. 시험 정답으로 OLS를 택하면 시험이 추가 선택자료가 됩니다. 그 최솟값 0을 원래 검증 선택 규칙의 시험 점수라고 보고할 수 없습니다.

Ridge predicts one and loses one; OLS predicts two and loses zero. Selecting OLS using that test answer makes test data another selection source. Zero is not the original validation-selected rule’s test score.

43. 검증 분모가 없을 때No available validation denominator

훈련자료는 가용하지만 검증 행의 결과가 전부 null입니다. 후보는 세 개입니다. 첫 후보를 검증 최소라고 보고해도 되나요?

Training is available, but every validation outcome is null. There are three candidates. May the first be reported as validation-optimal?

풀이와 확인할 이유Solution and explanation

아닙니다. 가용 검증 W=0이어서 각 MSE와 비교가 미정의입니다. 첫 후보 사전 기본값을 쓰려면 검증과 무관한 기본값으로 설명해야 합니다. 도구는 검증 선택 미정의와 선택 시험 점수 미정의를 유지합니다.

No. Available validation weight is zero, so MSE comparisons are undefined. A first-candidate default must be labeled as a prior fallback, not validation optimization. The tool retains undefined selection and selected-test score.

44. 시험 평균 oracleA test-mean oracle

가용 훈련 결과는 0,0이고 시험 결과는 2,4입니다. 훈련 평균 기준 모형의 시험 MSE와 시험 평균으로 적합한 상수의 MSE를 구하고 후자의 한계를 설명하세요.

Training outcomes are 0,0 and test outcomes 2,4. Compare test MSE of the training-mean baseline with a constant fitted to the test mean. Explain the latter’s limitation.

풀이와 확인할 이유Solution and explanation

훈련 평균은 0이라 시험 MSE=(4+16)/2=10입니다. 시험 평균 3을 쓰면 MSE=(1+1)/2=1입니다. 후자는 시험 정답으로 적합한 oracle 비교로서 원래 배포 가능한 훈련 평균 규칙의 성능이 아닙니다.

Training mean zero gives test MSE ten. Test mean three gives MSE one, but uses test answers for fitting. It is an oracle comparison, not performance of the original training-mean deployment rule.

45. 같은 가용 행의 공정 비교Comparison on a common available frame

평가 두 행은 (X,Y)=(0,1),(null,100)입니다. 기준 상수는 0이고 선형 예측도 가용 첫 행에서 0입니다. 공통 완전행 MSE와 기준 모형만 두 결과를 사용한 MSE를 비교하세요.

Evaluation rows are (X,Y)=(0,1),(null,100). A constant predicts zero, as does a linear rule on the first row. Compare shared-complete-frame MSE with using both outcomes only for the baseline.

풀이와 확인할 이유Solution and explanation

공통 완전행은 첫 행뿐이어서 두 방법 모두 MSE=1입니다. 기준 모형만 두 결과를 쓰면 (1+10000)/2=10001/2입니다. 이 차이는 동일 평가 표적의 예측 우열이 아니라 다른 분모·행 집합에서 생깁니다.

The shared complete frame contains only the first row; both MSEs are one. Using both outcomes solely for the baseline gives 10001/2. This difference comes from a changed frame and denominator, not predictive ranking on one target.

46. 같은 OLS를 나타내는 중복 후보Duplicate candidates representing OLS

훈련·검증 행은 가용하며 관측 가중치는 양수입니다. 벌점 없는 절편을 포함하고, 양수 가중치 훈련 행의 중심화 입력 열은 선형 독립입니다. 후보는 Ridge λ=0, Lasso λ=0, OLS 세 개뿐입니다. 이 장의 같은 선택 규칙에서 검증 점수와 동률 인덱스를 어떻게 보고하나요?

Training and validation rows are available with positive observation weights. Include an unpenalized intercept and assume the centered training input columns restricted to positive-weight rows are linearly independent. The only candidates are ridge λ=0, Lasso λ=0 and OLS. Under the same coefficient selector, report validation ties.

풀이와 확인할 이유Solution and explanation

세 후보는 같은 유일한 OLS 예측을 만드므로 검증 MSE가 같습니다. 인덱스 0,1,2 전부를 최소 집합으로 보고하고 첫 후보 0을 선택합니다. 중복 이름이 독립된 새 증거를 세 번 만든 것은 아닙니다.

All three produce the same unique OLS predictor, hence equal validation MSE. Report minimizer indices 0,1,2 and select zero by the first-index rule. Duplicate labels do not create independent evidence.

47. 선택 뒤 재적합 표적The target after selection and refitting

훈련 10행으로 후보들을 적합하고 검증 3행에서 λ를 골랐습니다. 이후 훈련+검증 13행으로 다시 적합했습니다. 원래 검증 점수를 13행 규칙의 독립 시험 점수라고 할 수 있나요?

Fit candidates on ten training rows, choose lambda using three validation rows, then refit on all thirteen. Is the original validation score an independent test score of the thirteen-row rule?

풀이와 확인할 이유Solution and explanation

아닙니다. 원래 검증 점수는 10행에서 적합한 후보를 평가했고 선택에도 쓰였습니다. 재적합은 학습 표와 변환을 바꾼 다른 단계입니다. 13행 규칙의 독립 시험 해석에는 별도의 적절한 시험 설계가 필요합니다.

No. That score evaluated ten-row fits and was used for selection. Refitting changes the training table and transformations. An independent-test interpretation for the thirteen-row rule needs a separate appropriate evaluation design.

48. fold 밖 변환 정보Transformation information outside a fold

전체 12행의 입력 범위로 척도를 먼저 정한 뒤 3-fold에서 Ridge를 적합했습니다. fold별 훈련 8행으로 척도를 다시 정하는 절차와 무엇이 다른가요?

Fit a scale using all twelve inputs, then run three-fold ridge. How does this differ from fitting scales on each eight-row training complement?

풀이와 확인할 이유Solution and explanation

각 검증 fold의 입력 정보가 미리 전체 척도에 들어갑니다. 결과를 보지 않았어도 훈련 전용 변환과는 다른 정보 접근 규칙입니다. 배포 상황에서 허용되는 전이적 절차인지 별도 명시해야 하며, 같은 규칙이라고 점수를 섞지 않습니다.

Validation-fold inputs influence the precomputed scale. Even without outcomes, this is a different information-access rule from training-only transformations. State whether such transductive access is permitted instead of mixing scores as one procedure.

49. 유한 λ 격자의 주장 범위Scope of a finite lambda grid

검증 점수가 λ∈{0,1,10}에서 각각 4,2,3입니다. 모든 λ≥0의 최적값을 찾았다고 결론 내릴 수 있나요?

Validation scores at λ∈{0,1,10} are 4,2,3. May one claim to have optimized every λ≥0?

풀이와 확인할 이유Solution and explanation

아닙니다. 선언한 세 후보 중 최소는 λ=1이며 점수 2입니다. 격자 밖 λ의 검증 점수는 주어지지 않았습니다. 연결한 그래프 가이드선이 그 사이 정확한 손실 함수라고 보장하지도 않습니다.

No. Lambda one minimizes the declared three-point menu with score two. Scores between or outside those points are unspecified. Connecting query points does not establish the exact intervening loss function.

50. OLS보다 작은 훈련 MSE?Can penalization beat OLS training MSE?

같은 완전행·가중치·절편 포함 선형 예측 공간에서 정확히 계산한 Ridge의 훈련 MSE가 정확한 OLS보다 작다고 보고했습니다. 가능한가요? 단, 계산 오차나 다른 분모는 없다고 합니다.

On identical complete rows, weights and an intercept-inclusive linear space, exact ridge training MSE is reported below exact OLS. There is no rounding error or denominator change. Is this possible?

풀이와 확인할 이유Solution and explanation

불가능합니다. OLS는 바로 그 예측 공간에서 자료 제곱손실을 최소화합니다. Ridge 해도 같은 공간의 멤버이므로 그 손실은 최소보다 작을 수 없습니다. 벌점 목적함수와 훈련 MSE를 혼동했는지 확인해야 합니다.

No. OLS minimizes that squared data loss over the same predictor space. A ridge fit belongs to the space and cannot beat its minimum. Check for confusion between penalized objective and training MSE.

51. 국가 역할과 결과 단위Country roles and outcome units

2024년 보관 16국에서 처음 10/다음 3/마지막 3국을 훈련/검증/시험으로 정했습니다. 결과는 2015년 불변 USD의 1인당 GDP입니다. 시험 MSE의 분모·단위와 일반화 범위를 말하세요. 모든 값은 가용합니다.

Assign the first ten/next three/final three of sixteen retained 2024 countries to training/validation/test. Outcome is GDP/person in constant 2015 USD, all available. State test MSE denominator, units and scope.

풀이와 확인할 이유Solution and explanation

시험 분모는 3이고 단위는 (2015 USD/명)²입니다. 해당 보관 세 국가의 예측 점수이며 전 세계 국가의 확률표본 위험이나 인과 정책 효과가 아닙니다. 원행 순서 분할만으로 새 국가 iid 표집을 증명하지 않습니다.

The denominator is three and units are (2015 USD/person)². It scores those retained countries, not a world-country probability-sample risk or causal policy effect. Row-order splitting does not establish iid new-country sampling.

52. 퍼센트에서 비율로Percent to proportion

실업률 x를 퍼센트 단위에서 z=x/100의 비율 단위로 바꿉니다. 원 기울기 b와 새 기울기 γ의 관계, 원 단위 벌점을 보존하는 Ridge/Lasso 새 가중치를 구하세요.

Change unemployment from percent x to proportion z=x/100. Relate original slope b to new slope γ, and give new weights preserving an original unit ridge or Lasso penalty.

풀이와 확인할 이유Solution and explanation

b=γ/100이므로 γ=100b입니다. 보존 가중치는 Ridge 1/10000, Lasso 1/100입니다. 같은 숫자 단위 벌점을 새 좌표에 그대로 쓰면 다른 학습 규칙입니다.

b=γ/100, hence γ=100b. Correct weights are 1/10000 for ridge and 1/100 for Lasso. Keeping a unit penalty in new coordinates defines another rule.

53. 원임금 분모와 로그 분모Raw-wage and log-wage denominators

원 개인 3,613행에서 원임금 가용 3,017개, 절단 로그임금 가용 3,010개입니다. 원임금을 목표로 쓰는 이번 분석의 미관측 수와 두 분모를 바꿔 쓰면 안 되는 이유를 말하세요.

Among 3,613 person rows, raw wages are available for 3,017 and trimmed logs for 3,010. Give the raw-wage missing count and explain why the two denominators are not interchangeable.

풀이와 확인할 이유Solution and explanation

원임금 미관측은 3,613−3,017=596개입니다. 로그 가용 수 3,010은 다른 원변수의 가용성·절단 규칙을 반영합니다. 원임금을 분석하면서 미관측 603개나 가용 3,010개라고 바꾸면 실제 목표변수의 행 틀이 달라집니다.

Raw-wage missingness is 596. The 3,010 trimmed-log count reflects availability and trimming of another source variable. Substituting 603 missing or 3,010 available changes the outcome’s actual frame.

54. 역할별 개인 분모Person denominators by role

개인 원행/가용 원임금 수가 훈련 2,065/1,690, 검증 516/443, 시험 1,032/884입니다. 각 미관측 수와 합을 구하세요. 두 입력은 모두 가용합니다.

Person source/available raw-wage counts are training 2,065/1,690, validation 516/443 and test 1,032/884. Both inputs are available. Find missing counts and their sum.

풀이와 확인할 이유Solution and explanation

각 차는 375,73,148이며 합은 596입니다. 가용 합은 3,017이고 원행 합은 3,613입니다. 훈련 변환 분모는 1,690이고 시험 손실 분모는 884로 서로 다릅니다.

Missing counts are 375,73,148, totaling 596. Available counts sum to 3,017; source counts to 3,613. Training transformations use 1,690 rows, while test loss uses 884.

55. 품질을 빼고 입력만 그룹화한다Group inputs without quality

와인의 두 원행은 11개 입력 값이 모두 같지만 quality가 5와 6으로 다릅니다. 결과를 제외한 전체 입력 패턴으로 역할을 정한다면 두 행을 어떻게 처리해야 하나요?

Two wine rows have identical eleven inputs but quality scores five and six. When assigning roles by full input patterns excluding outcomes, how should these rows be handled?

풀이와 확인할 이유Solution and explanation

같은 입력 패턴 키와 같은 역할을 받아야 합니다. 다른 결과라는 이유로 다른 그룹을 만들면 결과를 이용한 키가 됩니다. 두 결과를 평균하거나 한 행을 삭제할 필요는 없으며 원행과 원점수를 모두 보존합니다.

They receive the same input-pattern key and role. Splitting because outcomes differ would use labels in the key. Neither averaging outcomes nor deleting a row is required; preserve both original rows and scores.

56. 순서 점수와 제곱손실Ordered scores and squared loss

원 품질 점수 5,6,7을 순서를 보존해 0,1,10으로 재부호화했습니다. 원래의 5→6과 6→7 오차를 각각 예측 오차로 생각할 때 제곱손실은 어떻게 변하나요?

Recode ordered quality scores 5,6,7 to 0,1,10, preserving order. Compare squared losses for errors from five to six and six to seven before and after recoding.

풀이와 확인할 이유Solution and explanation

원래는 두 차이가 모두 1이라 제곱손실 1입니다. 재부호화 뒤 차이는 1과 9라 제곱손실 1과 81입니다. 순서를 보존하는 변환이 제곱손실을 보존하지 않으므로 원 수치 간격을 쓰는 것은 명시적 모형 선택입니다.

Originally both differences are one, giving squared loss one. Recoding makes differences one and nine, hence losses one and 81. Order preservation does not preserve squared loss; numerical score spacing is a declared modeling choice.

57. 정확 비영과 표시 0Exact nonzero versus displayed zero

단일 중심화 Lasso에서 G=1,p=1,λ=1이고 c=1+10⁻¹⁰⁰⁰입니다. 정확 기울기를 구하고 binary64 표시가 0이어도 영해라고 말할 수 있는지 설명하세요.

A centered scalar Lasso problem has G=1,p=1,λ=1,c=1+10⁻¹⁰⁰⁰. Find the exact slope. If binary64 displays zero, is it an exact zero solution?

풀이와 확인할 이유Solution and explanation

c>λp이므로 b=c−λp=10⁻¹⁰⁰⁰>0입니다. binary64의 표현 범위 아래라 표시가 0으로 underflow될 수 있지만 정확 영해는 아닙니다. 정확 분수와 표시 상태를 함께 남겨야 합니다.

Since c>λp, b=10⁻¹⁰⁰⁰>0. A binary64 display may underflow to zero, but the exact coefficient is nonzero. Retain the exact fraction and display-state metadata.

58. 공개 소수의 정확성Exactness of a public decimal

원 CSV의 값 문자열은 0.1입니다. 이것을 정확 분수 1/10으로 읽는 프로그램과 binary64로 읽는 프로그램을 비교할 때 어떤 구분을 기록해야 하나요?

A source CSV contains string 0.1. What distinction is needed when comparing a program parsing exact 1/10 with one using binary64?

풀이와 확인할 이유Solution and explanation

원 토큰과 정확 분수는 1/10을 지정하지만 binary64 내부 값은 가장 가까운 이진 유리수입니다. 정확 문자열 동등과 허용 오차 수치 대조는 다릅니다. 오차 기준·실행 환경을 기록하고 수치 근사를 원 토큰 수정이라고 서술하지 않습니다.

The token specifies exact 1/10, while binary64 stores the nearest binary rational. Exact-token equality and numerical agreement within tolerance are different checks. Record tolerances and runtime, without describing approximation as a change to the source token.

59. KKT는 국소 조건만인가Are these KKT checks merely local?

가중 제곱손실과 비음수 λ의 양의 가중 L1 벌점으로 이루어진 유한 Lasso 목적함수에서 어떤 계수가 모든 부분기울기 KKT 조건을 만족합니다. 전역 최소라고 결론 내릴 수 있나요?

For finite weighted squared loss plus a positive-weight L1 penalty with λ≥0, a coefficient vector satisfies every subgradient KKT condition. Does it minimize globally?

풀이와 확인할 이유Solution and explanation

예. 목적함수는 볼록이고 0이 부분기울기에 속하므로 모든 다른 계수에서 목적함수가 현재 값 이상이라는 부분기울기 부등식이 성립합니다. 유일성은 별개이며 종속 열에서는 여러 전역 최소가 있을 수 있습니다.

Yes. Convexity and inclusion of zero in the subgradient imply the objective at every other vector is at least its current value. Uniqueness is separate; dependent columns can yield multiple global minimizers.

60. 최종 주장 범위The scope of a final claim

한 보관 와인 분할에서 trainRange Lasso가 유한 후보 중 최소 검증 MSE를 얻었습니다. 연구자가 이를 모든 새 와인에서 최적이며 성분 개입 효과를 식별했다고 발표했습니다. 무엇이 계산 결과이고 무엇이 추가 주장인가요?

On one archived wine split, trainRange Lasso achieves minimum validation MSE among a finite menu. A researcher calls it optimal for every new wine and an identified composition-intervention effect. Separate the calculation from added claims.

풀이와 확인할 이유Solution and explanation

계산 결과는 선언한 역할·가용 행·수치 점수·유한 후보 아래의 검증 최소와 선택 규칙입니다. 모든 새 와인 위험의 최적성에는 새 자료 법칙·정보 조건·후보 범위를 정당화해야 하고, 성분 개입 효과에는 별도 인과 식별 가정이 필요합니다. 정규화나 원행 키만으로 둘 다 따르지 않습니다.

The calculation concerns validation minima and selection under declared roles, available rows, numerical score spacing and a finite menu. Universal fresh-wine optimality needs justified deployment laws and candidate scope; composition effects need causal identification assumptions. Regularization and source keys establish neither.

자료와 출처Data and sources

실제 자료 사례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