Skip to Content
스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다
book

스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다

by 이창현, 앨릭스 토머스
August 2021
Beginner to intermediate content levelBeginner to intermediate
440 pages
10h 4m
Korean
Hanbit Media, Inc.
Content preview from 스파크를 이용한 자연어 처리 : 대규모 텍스트를 다루는 가장 효율적인 딥러닝을 만나다
296
2
빌딩 블록
X.append(np.concatenate((window[:w], window[w+1:])))
Y.append(window[w])
X = np.array(X)
Y = ku.to_categorical(Y, vocab_size)
return X, Y
이제 실제로 생성자를 만들어 내는 함수를 작성해보자. 파이썬 생성자를 사용하여 학습하므로
배치 생성자를 만드는 유틸리티 함수가 필요하다.
def generate_batch(windows, batch_size=100):
while True:
indices = np.arange(windows.shape[0])
indices = np.random.choice(indices, batch_size)
batch_windows = windows[indices, :]
yield windows_to_batch(batch_windows)
이제는 모델을 구현할 수 있다. 모델을 정의해보자. 우리는
50
차원 단어 벡터를 만들 것이다.
차원 수는 말뭉치 크기에 기반을 두어야 한다. 그러나 명확한 규칙은 없다.
from keras.models import Sequential
from keras.layers import *
import keras.backend as K
import keras.utils as ku
dim ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

클라우드 네이티브: 클라우드 네이티브 애플리케이션을 설계, 개발, 운영하는 핵심 가이드

클라우드 네이티브: 클라우드 네이티브 애플리케이션을 설계, 개발, 운영하는 핵심 가이드

정원천, 보리스 숄, 트렌트 스완슨, 피터 야우쇼베츠

Publisher Resources

ISBN: 9791162244654