Softmax Function
class 의 경우에서 generalized linear model (reference)
- : 가 클래스 에 속할 확률을 모델링
- Bayes theorem 에 의해서 유도됨
B) Log-sum-exp Trick (lse function)
일반적으로
1 min read
class K>2 의 경우에서 generalized linear model (reference)
p(Ck∣x)=∑jp(x∣Cj)p(Cj)p(x∣Ck)p(Ck)=∑jexp(aj)exp(ak)일반적으로 m=maxcac
...put 을 생성할때 encoder 에서 건네준 hidden state 를 이용하는데, 계산하려는 output 이 각 hidden state 와 얼마나 관련이 있는지 score 를 계산한다 (softmax). 그리고 계산된 score 를 hidden state 에 적용하고 (vector dot), 이렇게 가중치가 적용된 state 들을 하나로 더하여 context vector 로 완성시킨다....
마지막으로, softmax function output 중 target word 의 확률을 높이는 방향으로 모델을 학습시킵니다.
dropout 은 왜 softmax 이후에 적용하는 걸까? GPT 모델에서 cheating 방지를 위해 masking 하는 방식은 아직도 이해를 잘 못하겠음.
Hierarchical Softmax Hierarchical Softmax 는 softmax function 를 전체로 계산하기 보다는 Tree 구조로 Hierarchical 하게 Softmax 를 계산하는 방법이다.
주로 logit 은 Normalization 을 위해 softmax function 의 입력값으로 사용된다.
D) Related hierarchical softmax E) References
위와 같은 확률들은 softmax function 으로 표현되며, loss function 은 아래와 같이 cross-entropy 형태로 계산된다.
... 토큰을 잘 설명할 수 있는 시퀀스 내 또 다른 토큰을 찾는다. 물론 자기 자신에 대한 내적값도 계산한다 (e.g. q^<3> · k^<3>). 이후 내적값 (정확히는 softmax 값) 에 토큰 별 value vector v 를 곱한 뒤 모두 더하면, 해당 벡터가 attention value 를 표현하는 vector 가 된다. 각 토큰의 attention vector...
Logit odds ratio 에 log 를 취한 값을 logit 이라고 부른다. logit 은 logistic regression 에 의해 유도될 수 있다. 다음과 같은 logistic regression 모델 h \theta(x) 가 있다고 가정하자.
Logistic Regression logistic regression model 은 classification 문제를 해결하는데 사용하는 모델이다.
Hinge Loss 분류기를 학습시키기 위해 사용되는 loss function Maximum-margin 분류 문제를 풀기 위해 주로 사용하며, 가장 유명한 것은 support vector machine.
Classification with SVM binary classification 의 핵심은 D 차원 공간에 존재하는 example 들을 레이블에 따라 두 파티션으로 나눈다는 것이다. 이때, 공간을 나누는 역할을 hyperplane 이 맡게된다.
Decision Boundary Decision boundary 는 label 값 y 가 0 인지 1 인지 결정하는 영역을 나누는 선이다.
Tanh Function Tanh function 은 입력을 [-1, 1] 범위로 압축하는 비선형 activation function 이다.
Negative Sampling Negative Sampling 은 skip-gram 모델의 softmax 함수 계산 비용을 절약하기 위해 고안된 Word Embedding 방식이다.
Link Function inverse of activation function 을 의미한다. 예를 들어 logit 은 sigmoid 함수의 inverse 이고, probit 은 가우시안 분포의 CDF 함수의 inverse 를 의미한다.
Sigmoid Function \displaystyle f(x)=\sigma(x)=\frac{1}{1+e^{-x}} A.1) 미분값 f^{\prime}(x)=f(x)(1-f(x)) A.2) Figure 약 -4.5 이하로는 무조건 0 을, 4.5 이상으로는 무조건 1 의 값을 가진다.
Logistic Loss logistic regression 에서 사용하는 loss function 을 의미한다.