AI
word2vec - CBOW 모델 구현
CBOW 모델의 신경망 구현 # CBOW 모델의 신경망 구현 import sys sys.path.append('..') import numpy as np from layers import MatMul, SoftmaxWithLoss class SimpleCBOW: def __init__(self, vocab_size, hidden_size): # 어휘 수, 은닉층의 뉴런 수 V, H = vocab_size, hidden_size # 가중치 초기화 W_in = 0.01 * np.random_randn(V, H).astype('f') W_out = 0.01 * np.random_randn(V, H).astype('f') # 계층 생성 self.in_layer0 = MatMul(W_in) self.in_laye..
2020. 12. 30. 23:48
최근댓글