Slide 60
Slide 60 text
˙εΫϦϓτϞʔυʢQZεΫϦϓτʣ
w USBJOʹ࡞ͨ͠εΫϦϓτΛهड़
def train(args):
X_train, X_valid, y_train, y_valid = train_test_split(X_train, y_train, test_size=0.3, random_state=0, stratify=y_train)
model = build_model(emb_matrix=embedding_matrix, input_length=X_train.shape[1])
model.compile(loss="binary_crossentropy",optimizer='adam',metrics=['accuracy'])
es_cb = EarlyStopping(monitor='val_loss', patience=3, verbose=2, mode='auto')
model.fit(
x=X_train,
y=y_train,
validation_data=(X_valid, y_valid),
batch_size=batch_size,
epochs=epochs,
verbose=2,
callbacks=[es_cb]
)
# Ϟσϧͷอଘ
save(model, args.model_dir)
FH