[손실함수] Loss Functions

Cosine Similarity (코사인 유사도)

Equation

$$similarity = cos(\theta) = \frac{A\cdot B}{||A||\cdot||B||} = \frac{\sum^{n}_{i=1}A_iB_i}{\sqrt{\sum^{n}_{i=1}A_i^2}\sqrt{\sum^{n}_{i=1}B_i^2}}$$

Keras

keras.losses.cosine_proximity(y_true, y_pred)

Pytorch

torch.nn.functional.cosine_similarity(x1, x2, dim=1, eps=1e-08)

Explanation

Cosine Similarity - 코사인 유사도란? [새 창]

'Theories > Loss' 카테고리의 다른 글

[손실함수] Loss Functions  (0) 2018.10.12

COMMENT WRITE