Bamboo is coming

Stanford CS231n 3강 (Loss Functions and Optimization) 본문

참고 도서

Stanford CS231n 3강 (Loss Functions and Optimization)

twenty 2023. 9. 13. 17:11

Multiclass Support Vector Machine (SVM) loss

흔히 사용되는 Multiclass Support Vector Machine (SVM) loss를 먼저 공부해보자. 
 
The SVM loss is set up so that the SVM “wants” the correct class for each image to a have a score higher than the incorrect classes by some fixed margin Δ.
margin Δ에 의해서 각각의 이미지가 잘못된 클래스가 올바른 클래스보다 더 높은 점수를 가지는 것을 SVM이 원하게 하도록 설정된다. 
 
지난 2강에 배운 score function을 loss function에 대입한 계산은 다음과 같다.
 
 

\[ L_i = \sum_{j \neq y_i} max(0,s_j-s_{y_i}+ 1) \]

  • \( s_j \) : 타겟 score 값 외에 다른 값
  • \( s_{y_i} \) : 타겟 score 값
  • \( +1 \) : 고정 마진 값 Δ. 
  • \(max(0,s_j-s_{y_i}+ 1) \) : score 값의 계산이 음수인 경우 예측율이 정답 score에 비해 낮은 경우이므로 0으로 무시.

 
 

최종 계산 losses들을 전체 데이터 셋의 loss의 평균으로 계산하면 
해당 모델의 loss는 5.27이 되는 것이다. 
"that our dataset is 5.3 bad on this data set."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

참고

CS231n Lecture note: Linear Classification (Support Vector Machine, softmax)

Comments