are you me?    id passwd

status  

 sleepy

picture

 

 thinking

calender

the simplest t-sne example - 컴퓨터

reference url: https://scipy-lectures.org/packages/scikit-learn/auto_examples/plot_tsne.html

from matplotlib import pyplot as plt
plt.figure(figsize=(6, 5))
from sklearn.manifold import TSNE
tsne = TSNE(n_components=2, random_state=0) # I can not really undearstand 3-D images..

#a=list
a=np.array(a)
a.shape #(N, n)
b = tsne.fit_transform(a)
b.shape #(N, 2)
for bb in b:
plt.scatter(bb[0], bb[1])
plt.show()

written time : 2020-06-26 21:52:42.0

그럴수만 있다면 얼마나 좋을까. - 일상

'엄마는 할머니되지마~나계속 이렇게 있을게~'- 큰딸

오늘은 일찍 퇴근해야겠다.

written time : 2020-05-20 13:52:04.0

Tensorflow 2 version of nn.CrossEntropyLoss and nn.NLLLoss - 컴퓨터

Cross Entropy

Torch 1.2
loss = nn.CrossEntropyLoss()
#y_pred: [batch, classes, length], logit, float
#y_true: [batch, length], index, int
loss(y_pred, y_true)

Tensorflow 2.1
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
#y_pred: [batch, length, classes], logit, float
#y_true: [batch, length], index, int
loss(y_true, y_pred)

Negative Log-Likelihood

Torch 1.2
loss = nn.NLLLoss()
#y_pred: [batch, classes, length], logit, float
#y_true: [batch, length], index, int
loss(y_pred, y_true)

Tensorflow 2.1
#y_pred: [batch, length, classes], logit, float
#y_true: [batch, length], index, int
mask=tf.one_hot(y_true,depth=tf.shape(y_pred)[-1])
-tf.reduce_sum(y_pred * mask) / tf.cast(tf.reduce_prod(tf.shape(y_true)), y_pred.dtype)

written time : 2020-05-03 15:49:25.0
...  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |  ...