소프트맥스(Softmax)

term_id: softmax

Category: basic_concepts

Definition

소프트맥스는 다중 클래스 분류 작업에서 신경망의 출력층에 널리 사용됩니다. 이는 원시 로짓(raw logits) 벡터를 입력받아 정규화하며, 각 요소가 특정 클래스에 속할 확률을 나타내도록 합니다…

Summary

임의의 실수 값 점수 벡터를 확률 분포로 변환하는 수학적 함수입니다.

Key Concepts

  • 확률 분포
  • 로짓(Logits)
  • 정규화(Normalization)
  • 다중 클래스 분류

Use Cases

  • 이미지 분류 출력층
  • 언어 모델 토큰 예측
  • 다중 레이블 범주화

Code Example

1
2
3
4
5
import torch
import torch.nn.functional as F
logits = torch.tensor([1.0, 2.0, 3.0])
probs = F.softmax(logits, dim=0)
print(probs)