• Mindscape 🔥
    • Playlist 🎧
  • Algorithm

    • 1018번: 체스판 다시 칠하기
    • 1966번: 프린터 큐
    • Python 시간 초과 방지를 위한 팁
    • C++ std::vector 사용법 정리
    • Vim 사용 매뉴얼
  • Ubuntu

    • 리눅스 우분투 GRUB 폰트 변경
    • 우분투 이미지 비디오 썸네일(미리보기) 안 보임 문제 해결
    • Wine 환경에서 카카오톡 실행 시 explorer.exe 뜨지 않게 하는 법
    • 우분투 Wine 카카오톡 사진 이미지 스크린샷 붙여넣기
    • Wine 카카오톡 이모지 깨짐 문제 해결
    • Ubuntu 윈도우 애니메이션 끄기
  • Wellness

    • 차전자피 (Psyllium Husk)
    • 엑스트라 버진 올리브유 (Extra Virgin Olive Oil)
    • 자가비강세척 (Nasal Irrigation)
    • QCY HT08 (MeloBuds Pro Plus)
    • 콘서타 (Concerta)
    • 인데놀 (Inderal)
    • 설트랄린 (Sertraline)
    • 멜라토닌 (Melatonin)
    • 치경부 마모증
    • 바벨 스쿼트 (Barbell Squat)
  • Humanities

    • Nordvik, Russia
    • North Sentinel Island
    • 롱고롱고(Rongorongo)
    • 바로크 음악 (Baroque Music)
  • Design

    • 구글의 아이콘 대개편 — 6년 만의 실수 인정
    • 제럴드 젠타 — 럭셔리 스포츠 워치의 창시자
    • 바우하우스 — 현대 디자인의 원점
  • Brands

    • NOMOS Glashütte
    • Frédérique Constant
    • KZ (Knowledge Zenith)
    • 에스트라 (AESTURA)
    • JINHAO (金豪)
    • Herman Miller
    • 데스커 (DESKER)
    • 무신사 스탠다드 (Musinsa Standard)
  • Finance

    • 현대카드 ZERO — Edition2 vs Edition3 비교
    • 신한카드 처음
    • S&P 500 ETF 투자 가이드
    • 파킹통장 vs CMA 통장
    • 버크셔 해서웨이 (Berkshire Hathaway)
    • 비트코인(Bitcoin)
  • Products

    • 오디오 인터페이스 (Audio Interface)
    • 쿠루토가 (KURUTOGA)
    • CX31993 DAC 동글
    • 클렌징 밀크 (Cleansing Milk)
    • 피젯 토이 (Fidget Toy)
    • ThinkPad
  • Programming Languages

    • 8.0. Statement Level Control Structures
    • 8. Subprogram
    • 9. Implementing Subprogram
    • 10.1. Abstract Data Types and Encapsulation Constructs
    • 10.2. Support for Object Oriented Programming
    • 11. Concurrency
    • 12. FPL (1)
    • 13. FPL (2)
    • 14. Exception Handling and Event Handling
    • Final Exam

12. Machine Learning (3)

작성 2026. 6. 12.·수정 2026. 6. 12.

Error Rate and Two Different Datasets (Recap)

  • Optimal fit은 Error Rate를 최소화하는 hypothesis
    • Error Rate: 예제 (x, y)(x,~y)(x, y)에 대해 h(x)≠yh(x) \neq yh(x)=y인 비율
    • 나중에 다른 Error에 다른 Cost를 부여하도록 확장 예정
  • Hypothesis의 Error Rate는 Test Set을 통해 추정
    • Hypothesis 생성에 사용되는 Training Set과 평가를 위한 Test Set으로 예제를 분할

From Error Rates to Loss Functions

  • Error Rate 최소화에 대한 문제 제기
    • Spam 분류 예시: Non-spam을 Spam으로 분류하는 것이 Spam을 Non-spam으로 분류하는 것보다 더 심각한 문제일 것
    • Error Rate가 낮더라도 Error의 종류에 따라 더 나쁜 classifier일 수 있음.
  • Loss function L(x, y, y^)L(x,~y,~ \hat{y})L(x, y, y^​) 정의
    • f(x)=yf(x)=yf(x)=y일 때 h(x)=y^h(x)=\hat{y}h(x)=y^​로 예측함으로써 잃게 되는 Utility의 양

L(x, y, y^)L(x,~y,~ \hat{y}) L(x, y, y^​)

=Utility result of using y given an input x= \text{Utility result of using } y \text{ given an input } x =Utility result of using y given an input x

−Utility result of using y^ given an input x- \text{Utility result of using } \hat{y} \text{ given an input } x −Utility result of using y^​ given an input x

  • 또는 간단히 L(y,y^)L(y, \hat{y})L(y,y^​)로 표현
  • 예시:
    • L(spam, nonspam)=1L(\text{spam},~ \text{nonspam}) = 1L(spam, nonspam)=1
    • L(nonspam, spam)=10L(\text{nonspam},~ \text{spam}) = 10L(nonspam, spam)=10
  • L(y, y)L(y,~y)L(y, y)는 항상 000

L1L_1L1​ and L2L_2L2​ Loss Functions

  • 일반적으로 작은 Error가 큰 Error보다 좋음.
  • L1L_1L1​ Loss (Absolute-value Loss)
    • L1(y, y^)=∣y−y^∣L_1 (y,~ \hat{y}) = |y - \hat{y}|L1​(y, y^​)=∣y−y^​∣
  • L2L_2L2​ Loss (Squared-error Loss)
    • L2(y, y^)=(y−y^)2L_2 (y,~ \hat{y}) = (y - \hat{y})^2L2​(y, y^​)=(y−y^​)2

Generalization Loss

  • 학습 Agent는 보게 될 모든 Input-output 쌍에 대한 Expected Loss를 최소화하는 Hypothesis를 선택하여 Expected Utility를 최대화
  • Expected Loss 계산을 위해 예제에 대한 Prior Probability Distribution P(X, Y)P(X,~Y)P(X, Y) 정의 필요
  • Hypothesis hhh의 Expected Generalization Loss (Loss function LLL에 대한)

    GenLossL(h)\text{GenLoss}_L (h) GenLossL​(h)

    =∑(x, y)∈EP(x, y)L(y, h(x))= \sum_{(x,~y) \in \mathcal{E}} P(x,~y) L(y,~ h(x)) =(x, y)∈E∑​P(x, y)L(y, h(x))

    • E\mathcal{E}E는 가능한 모든 Input-output 쌍의 집합
  • 최적의 Hypothesis h∗h^*h∗

    h∗=argminh∈HGenLoss(h)h^* = \text{argmin}_{h \in \mathcal{H}} \text{GenLoss} (h) h∗=argminh∈H​GenLoss(h)

Empirical Loss

  • 대부분의 경우 P(x, y)P(x,~y)P(x, y)는 알려져 있지 않으므로, 학습 Agent는 크기 NNN의 예제 집합 E\mathcal{E}E에 대한 Empirical Loss로 Generalization Loss를 추정
  • Empirical Loss

    EmpLossL, E(h)=∑(x, y)∈E1NL(y, h(x))\text{EmpLoss}_{L,~\mathcal{E}} (h) = \sum_{(x,~y) \in \mathcal{E}} \frac{1}{N} L(y,~ h(x)) EmpLossL, E​(h)=(x, y)∈E∑​N1​L(y, h(x))

  • 추정된 최적 Hypothesis h^∗\hat{h}^*h^∗

    h^∗=argminh∈HEmpLossL, E(h)\hat{h}^* = \text{argmin}_{h \in \mathcal{H}} \text{EmpLoss}_{L,~\mathcal{E}} (h) h^∗=argminh∈H​EmpLossL, E​(h)

Four Reasons Why h^∗\hat{h}^*h^∗ May Differ from fff

  1. Unrealizability
    • Hypothesis Space H\mathcal{H}H가 참 함수 fff를 포함하지 않는 경우
    • H\mathcal{H}H가 Linear Functions 집합이고 fff가 Quadratic Function이면, 아무리 많은 Data로도 참 fff를 복구할 수 없음.
  2. Variance
    • 학습 Algorithm이 다른 예제 집합에 대해 다른 Hypothesis를 반환하는 현상
    • 문제가 Realizable한 경우, Training 예제 수가 증가함에 따라 Variance는 000에 가까워짐.
  3. Noise
    • fff가 Nondeterministic 또는 Noisy하여 동일한 xxx에 대해 다른 f(x)f(x)f(x) 값을 반환할 수 있음.
    • Noise는 정의상 예측할 수 없음 (특성화만 가능)
  4. Computational Complexity
    • H\mathcal{H}H가 복잡한 함수이고 Hypothesis Space가 큰 경우, 모든 가능성을 체계적으로 탐색하는 것이 계산상 어려울 수 있음.
    • 탐색은 공간의 일부를 탐색하여 합리적으로 좋은 Hypothesis를 반환할 수 있지만, 항상 최적의 것을 보장할 수는 없음.

Regularization

  • Occam's Razor에 기반하여, 적절한 성능으로 문제를 해결하면서 가능한 한 Simple한 Hypothesis를 찾고자 함.
  • Total Cost를 최소화하는 Hypothesis를 탐색하는 접근 방식
    • Total Cost는 Empirical Loss와 Hypothesis의 Complexity의 가중 합

Cost(h)=EmpLoss(h)+λComplexity(h)\text{Cost}(h) = \text{EmpLoss}(h) + \lambda \text{Complexity}(h) Cost(h)=EmpLoss(h)+λComplexity(h)

−h^∗=argminh∈HCost(h)- \hat{h}^* = \text{argmin}_{h \in \mathcal{H}} \text{Cost}(h) −h^∗=argminh∈H​Cost(h)

  • λ\lambdaλ는 Hyperparameter
  • 복잡한 Hypothesis에 명시적으로 페널티를 부과하는 이 과정을 Regularization이라 함.
    • 더 Regular한 (규칙적인) 함수를 찾고자 함.
    • Loss function (L1L_1L1​ 또는 L2L_2L2​)과 Complexity Measure인 Regularization Function, 두 가지 선택을 하는 것

Hyperparameter Tuning

Hand-tuning

  • 과거 경험을 바탕으로 Parameter 값을 추측, Model 학습, Validation Data로 성능 측정, 분석 후 새로운 Parameter 값을 직관적으로 제안
  • 만족스러운 성능을 얻을 때까지 반복

Grid-search

  • Hyperparameter의 수가 적고 각각 가능한 값의 수가 적을 경우 적합
  • 모든 값의 조합을 시도하고 Validation Data에서 가장 잘 수행되는 것을 확인

Random search

  • 가능한 값의 조합이 너무 많은 경우, 모든 가능한 Hyperparameter 설정 집합에서 Uniform하게 Sampling하여 시간과 계산 자원을 할애할 수 있는 만큼 반복

Bayesian optimization

  • Hyperparameter 값을 선택하는 작업을 Machine Learning 문제 자체로 간주
  • Hyperparameter 값의 Vector x\mathbf{x}x를 Input으로, 해당 Hyperparameter로 구축된 Model의 Validation Set에 대한 Total Loss yyy를 Output으로 생각
  • Loss yyy를 최소화하는 함수 y=f(x)y = f(\mathbf{x})y=f(x)를 찾는 것을 목표로 함.

Population-based Training (PBT)

  • Random search를 사용하여 각각 다른 Hyperparameter 값을 가진 Model Population을 훈련하는 것으로 시작
  • 다음 세대의 Model은 이전 세대의 성공적인 값과 Genetic Algorithms에서처럼 Random Mutation을 통해 Hyperparameter를 선택하여 훈련
  • Random Search + Bayesian Optimization의 결합
최근 수정: 26. 6. 12. 오후 3:28
Contributors: kmbzn, Claude Sonnet 4.6

BUILT WITH

CloudflareNode.jsGitHubGitVue.jsJavaScriptVSCodenpm

All trademarks and logos are property of their respective owners.
© 2026 kmbzn · MIT License