예제 5-1 문장을 판별하는 LSTM


In [2]:
# %load /home/sjkim/.jupyter/head.py
%matplotlib inline
%load_ext autoreload 
%autoreload 2
from importlib import reload

import matplotlib.pyplot as plt
import numpy as np

import pandas as pd
import os
#os.environ["CUDA_VISIBLE_DEVICES"]="0"

# seaborn
#import seaborn as sns
#sns.set( style = 'white', font_scale = 1.7)
#sns.set_style('ticks')
#plt.rcParams['savefig.dpi'] = 200

# font for matplotlib
#import matplotlib
#import matplotlib.font_manager as fm
#fm.get_fontconfig_fonts()
#font_location = '/usr/share/fonts/truetype/nanum/NanumGothicBold.ttf'
#font_name = fm.FontProperties(fname=font_location).get_name()
#matplotlib.rc('font', family=font_name)


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [2]:
import ex5_1_lstm_imdb_cl as example


Using TensorFlow backend.

In [3]:
example.main()


Training stage
==============
Train on 25000 samples, validate on 25000 samples
Epoch 1/3
25000/25000 [==============================] - 128s - loss: 0.4615 - acc: 0.7788 - val_loss: 0.3706 - val_acc: 0.8362
Epoch 2/3
25000/25000 [==============================] - 122s - loss: 0.2973 - acc: 0.8786 - val_loss: 0.3970 - val_acc: 0.8280
Epoch 3/3
25000/25000 [==============================] - 123s - loss: 0.2152 - acc: 0.9166 - val_loss: 0.4073 - val_acc: 0.8258
24992/25000 [============================>.] - ETA: 0sTest performance: accuracy=0.82584, loss=0.4072775837993622

In [ ]: