2/21/23, 3:18 PM K15_RNN_sentiment_analysis.
ipynb - Colaboratory
1 !wget [Link]
--2022-05-25 12:56:11-- [Link]
Resolving [Link] ([Link])... [Link]
Connecting to [Link] ([Link])|[Link]|:443... co
HTTP request sent, awaiting response... 200 OK
Length: 84188 (82K) [application/x-httpd-php]
Saving to: ‘sentiment labelled [Link]’
sentiment labelled 100%[===================>] 82.21K --.-KB/s in 0.1s
2022-05-25 12:56:12 (630 KB/s) - ‘sentiment labelled [Link]’ saved [84188/
1 !unzip [Link]
Archive: [Link]
creating: sentiment labelled sentences/
inflating: sentiment labelled sentences/.DS_Store
creating: __MACOSX/
creating: __MACOSX/sentiment labelled sentences/
inflating: __MACOSX/sentiment labelled sentences/._.DS_Store
inflating: sentiment labelled sentences/amazon_cells_labelled.txt
inflating: sentiment labelled sentences/imdb_labelled.txt
inflating: __MACOSX/sentiment labelled sentences/._imdb_labelled.txt
inflating: sentiment labelled sentences/[Link]
inflating: __MACOSX/sentiment labelled sentences/._readme.txt
inflating: sentiment labelled sentences/yelp_labelled.txt
inflating: __MACOSX/._sentiment labelled sentences
1 X = [] # input text
2 y = [] # label
3
4 f = open(file='a/amazon_cells_labelled.txt', mode='r')
5 for line in [Link]():
6 line = [Link]()
7 line = [Link]("\t")
8 [Link](int(line[-1]))
9 [Link](line[0].strip())
10 [Link]()
11
12 f = open('a/yelp_labelled.txt', 'r')
13 for line in [Link]():
14 line = [Link]()
15 line = [Link]("\t")
16 [Link](int(line[-1]))
17 [Link](line[0].strip())
18 [Link]()
19
20 f = open('a/imdb_labelled.txt', 'r')
21 for line in [Link]():
22 line = [Link]()
23 line = [Link]("\t")
24 [Link](int(line[-1]))
25 [Link](line[0].strip())
[Link] 1/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
26 [Link]()
27
28
29 print(X[0])
30 print(len(X))
31 print(y[0])
32 print(len(y))
33
So there is no way for me to plug it in here in the US unless I go by a converter
3000
0
3000
1 from matplotlib import pyplot as plt
2 print(X[0])
3 print(len(X), len(y))
4 [Link](y, bins=20)
So there is no way for me to plug it in here in the US unless I go by a converter
3000 3000
(array([1500., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 1500.]),
array([0. , 0.05, 0.1 , 0.15, 0.2 , 0.25, 0.3 , 0.35, 0.4 , 0.45, 0.5 ,
0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.9 , 0.95, 1. ]),
<a list of 20 Patch objects>)
1 from sklearn.model_selection import train_test_split
2 X_train, X_test, y_train, y_test = train_test_split(X, y,
3 test_size=0.2,
4 random_state=0)
1 from [Link] import Tokenizer
2 import numpy as np
3
4 tokenizer = Tokenizer(num_words=2000)
5 tokenizer.fit_on_texts(X)
6
7 X_seq_train = tokenizer.texts_to_sequences(X_train)
8 X_seq_test = tokenizer.texts_to_sequences(X_test)
[Link] 2/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
1 print(X_seq_train[0])
2 print(tokenizer.sequences_to_texts([[432, 47]]))
3 print(X_train[0])
[1, 201, 43, 67, 634]
['meal really']
The jerky camera movements were also annoying.
1 for i in X_seq_train[0]:
2 print(f"{i} -----> {tokenizer.index_word[i]}")
1 -----> the
201 -----> camera
43 -----> were
67 -----> also
634 -----> annoying
1 from [Link] import pad_sequences
2
3 max_length = max([len(t) for t in X_seq_train] + [len(t) for t in X_seq_test])
4 print(max_length)
5 X_pad_train = pad_sequences(sequences=X_seq_train,
6 maxlen=max_length,
7 padding='post')
8
9 print(X_pad_train.shape)
10
11 X_pad_test = pad_sequences(sequences=X_seq_test,
12 maxlen=max_length,
13 padding='post')
14 print(X_pad_test.shape)
59
(2400, 59)
(600, 59)
1 X_pad_train[1]
array([ 1, 25, 217, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0], dtype=int32)
1 # ML: X_pad -> sentiment
2 from [Link] import Embedding, Input, Conv1D, Flatten, Dense, Dropo
3 from [Link] import Model
4 from [Link] import backend as K
5
6 vocab_size = 2000
7 p = 0.1
8
9 inp = Input(shape=(max_length))
10 x = Embedding(vocab_size, 128, input_length=max_length)(inp)
11 x = Dropout(p)(x)
[Link] 3/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
12 x = Conv1D(filters=32, kernel_size=3,
13 padding='same', activation='relu')(x)
14
15 x = Dropout(p)(x)
16 x = Conv1D(filters=16, kernel_size=3,
17 padding='same', activation='relu')(x)
18
19 # collect features: poolling??? -> inovations
20 # dãn ma trận 59 x 16 -> 944-vector
21 #x = Flatten()(x)
22
23 # Trung bình hoá các feature của chuỗi
24 x = [Link](x, keepdims=False, axis=1)
25
26 # Fully connected layer for classification
27 x = Dense(units=16, activation='relu')(x)
28 x = Dropout(p)(x)
29 x = Dense(units=1, activation='sigmoid')(x) # xác suất để x là positive
30
31 model = Model(inputs=inp, outputs=x)
32 [Link]()
33
34 # compile model -> optimizer, loss, evaluation metrics
35 [Link](loss="binary_crossentropy", optimizer='adam', metrics=['acc'])
Model: "model"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) [(None, 59)] 0
embedding (Embedding) (None, 59, 128) 256000
dropout (Dropout) (None, 59, 128) 0
conv1d (Conv1D) (None, 59, 32) 12320
dropout_1 (Dropout) (None, 59, 32) 0
conv1d_1 (Conv1D) (None, 59, 16) 1552
[Link].reduce_mean (TFOpLa (None, 16) 0
mbda)
dense (Dense) (None, 16) 272
dropout_2 (Dropout) (None, 16) 0
dense_1 (Dense) (None, 1) 17
=================================================================
Total params: 270,161
Trainable params: 270,161
Non-trainable params: 0
_________________________________________________________________
[Link] 4/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
1 y = [Link](y)
2 [Link](X_pad_train, [Link](y_train),
3 epochs=10, batch_size=64, validation_split=0.2)
Epoch 1/10
30/30 [==============================] - 2s 31ms/step - loss: 0.6935 - acc: 0.501
Epoch 2/10
30/30 [==============================] - 1s 24ms/step - loss: 0.6930 - acc: 0.504
Epoch 3/10
30/30 [==============================] - 1s 23ms/step - loss: 0.6896 - acc: 0.508
Epoch 4/10
30/30 [==============================] - 1s 24ms/step - loss: 0.6437 - acc: 0.580
Epoch 5/10
30/30 [==============================] - 1s 23ms/step - loss: 0.5290 - acc: 0.822
Epoch 6/10
30/30 [==============================] - 1s 24ms/step - loss: 0.3857 - acc: 0.905
Epoch 7/10
30/30 [==============================] - 1s 24ms/step - loss: 0.2378 - acc: 0.930
Epoch 8/10
30/30 [==============================] - 1s 24ms/step - loss: 0.1607 - acc: 0.948
Epoch 9/10
30/30 [==============================] - 1s 25ms/step - loss: 0.1112 - acc: 0.969
Epoch 10/10
30/30 [==============================] - 1s 24ms/step - loss: 0.0834 - acc: 0.972
<[Link] at 0x7f55eb465210>
1 y_pred = [Link](X_pad_test)
2 y_pred[y_pred>0.5] = 1
3 y_pred[y_pred<=0.5] = 0
4
5 from [Link] import classification_report
6 print(classification_report(y_test, y_pred))
precision recall f1-score support
0 0.82 0.77 0.79 304
1 0.78 0.82 0.80 296
accuracy 0.80 600
macro avg 0.80 0.80 0.80 600
weighted avg 0.80 0.80 0.80 600
1 def predict(seq, model):
2 test_text = [seq]
3 X_test = tokenizer.texts_to_sequences(test_text)
4 X_test_padd = pad_sequences(sequences=X_test, maxlen=max_length, padding='post')
5
6 p = [Link](X_test_padd)[0, 0]
7
8 if p > 0.5:
9 return "Positive", p
10 else:
11 return "Negatvie", p
12
13 seq = "it is terrible today"
[Link] 5/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
14
15 predict(seq, model)
('Negatvie', 0.00022283196)
1 y[-1]
1 import numpy as np
2
3 seq = [Link]([[0, 1, 0],
4 [1, 0, 0],
5 [0, 0, 1]])
6
7 Wh = [Link]([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) # 1 layer -> #row = #input, #col =
8 Wx = [Link]([[0.1, 0.2, 0.3], [.4, .5, .6], [.7, .8, .9]])
9
10 ho = [Link]([0, 0, 0])
11
12 g = lambda z: [Link](z)
13 for i in range(3):
14 h1 = g([Link](ho, Wh) + [Link](seq[i], Wx))
15 print(h1)
16
17 ho = h1
18
19
[0.37994896 0.46211716 0.53704957]
[0.99998969 0.99999946 0.99999997]
[1. 1. 1.]
1 # text -> RNN -> using final state as the features of text
2 # seq = "the phone was broken on shipping, terrible" -> RNN -> final state ->FC lay
3
4 from [Link] import LSTM
5
6 inp = Input(shape=(max_length))
7
8 x = Embedding(vocab_size, 128, input_length=200)(inp)
9 x, h, c = LSTM(units=128, return_state=True, return_sequences=True)(x)
10
11 x = Conv1D(filters=32, kernel_size=3,
12 padding='same', activation='relu')(x)
13
14 x = [Link](x, keepdims=False, axis=1)
15 y = Dense(units=64, activation='relu')(x)
16 y = Dense(units=1, activation='sigmoid')(y)
17
18 model = Model(inputs=inp, outputs=y)
19
20 [Link]()
21
22 # compile model -> optimizer, loss, evaluation metrics
23 [Link](loss="binary_crossentropy", optimizer='adam', metrics=['acc'])
[Link] 6/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
Model: "model_3"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_4 (InputLayer) [(None, 59)] 0
embedding_3 (Embedding) (None, 59, 128) 256000
lstm_2 (LSTM) [(None, 59, 128), 131584
(None, 128),
(None, 128)]
conv1d_2 (Conv1D) (None, 59, 32) 12320
[Link].reduce_mean_2 (TFOp (None, 32) 0
Lambda)
dense_6 (Dense) (None, 64) 2112
dense_7 (Dense) (None, 1) 65
=================================================================
Total params: 402,081
Trainable params: 402,081
Non-trainable params: 0
_________________________________________________________________
Double-click (or enter) to edit
1 [Link](X_pad_train, [Link](y_train),
2 epochs=20, batch_size=64, validation_split=0.2)
Epoch 1/20
30/30 [==============================] - 6s 148ms/step - loss: 0.6931 - acc: 0.54
Epoch 2/20
30/30 [==============================] - 4s 135ms/step - loss: 0.5563 - acc: 0.74
Epoch 3/20
30/30 [==============================] - 4s 134ms/step - loss: 0.3236 - acc: 0.87
Epoch 4/20
30/30 [==============================] - 4s 136ms/step - loss: 0.2264 - acc: 0.93
Epoch 5/20
30/30 [==============================] - 4s 135ms/step - loss: 0.1409 - acc: 0.95
Epoch 6/20
30/30 [==============================] - 4s 134ms/step - loss: 0.0945 - acc: 0.97
Epoch 7/20
30/30 [==============================] - 4s 144ms/step - loss: 0.1026 - acc: 0.96
Epoch 8/20
30/30 [==============================] - 4s 141ms/step - loss: 0.0764 - acc: 0.97
Epoch 9/20
30/30 [==============================] - 4s 144ms/step - loss: 0.0562 - acc: 0.98
Epoch 10/20
30/30 [==============================] - 4s 148ms/step - loss: 0.0522 - acc: 0.98
Epoch 11/20
30/30 [==============================] - 5s 151ms/step - loss: 0.0781 - acc: 0.97
Epoch 12/20
30/30 [==============================] - 5s 151ms/step - loss: 0.0656 - acc: 0.98
Epoch 13/20
30/30 [==============================] - 5s 151ms/step - loss: 0.0851 - acc: 0.97
Epoch 14/20
[Link] 7/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
30/30 [==============================] - 4s 151ms/step - loss: 0.0827 - acc: 0.97
Epoch 15/20
30/30 [==============================] - 5s 157ms/step - loss: 0.0508 - acc: 0.98
Epoch 16/20
30/30 [==============================] - 5s 152ms/step - loss: 0.0469 - acc: 0.98
Epoch 17/20
30/30 [==============================] - 5s 153ms/step - loss: 0.0429 - acc: 0.99
Epoch 18/20
30/30 [==============================] - 4s 146ms/step - loss: 0.0381 - acc: 0.99
Epoch 19/20
30/30 [==============================] - 4s 148ms/step - loss: 0.0250 - acc: 0.99
Epoch 20/20
30/30 [==============================] - 7s 237ms/step - loss: 0.0296 - acc: 0.99
<[Link] at 0x7f55e6f5be90>
1 def predict(seq, model):
2 test_text = [seq]
3 X_test = tokenizer.texts_to_sequences(test_text)
4 X_test_padd = pad_sequences(sequences=X_test, maxlen=max_length, padding='post')
5
6 p = [Link](X_test_padd)[0, 0]
7
8 if p > 0.5:
9 return "Positive", p
10 else:
11 return "Negatvie", p
12
13 seq = "the phone was broken on shipping"
14
15 predict(seq, model)
('Negatvie', 0.017159373)
1 y_pred = [Link](X_pad_test)
2 y_pred[y_pred>0.5] = 1
3 y_pred[y_pred<=0.5] = 0
4
5 from [Link] import classification_report
6 print(classification_report(y_test, y_pred))
precision recall f1-score support
0 0.77 0.78 0.78 304
1 0.77 0.76 0.77 296
accuracy 0.77 600
macro avg 0.77 0.77 0.77 600
weighted avg 0.77 0.77 0.77 600
1
2
3
(2400, 59)
[Link] 8/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
1 # Attention
2 # text -> RNN -> using final state as the features of text
3 # seq = "the phone was broken on shipping, terrible" -> RNN -> final state ->FC lay
4
5 from [Link] import LSTM, Softmax
6
7
8 inp = Input(shape=(max_length))
9
10 x = Embedding(vocab_size, 128, input_length=200)(inp)
11 x, h, c = LSTM(units=16, return_state=True, return_sequences=True)(x)
12 x = Conv1D(filters=32, kernel_size=5,
13 padding='same', activation='relu')(x)
14
15 # Attention part
16 att = Conv1D(filters=1, kernel_size=1,
17 padding='same', activation='relu')(x)
18 att = Softmax(axis=1)(att)
19
20 x = [Link](att * x, axis=1)
21 y = Dense(units=64, activation='relu')(x)
22 y = Dense(units=1, activation='sigmoid')(y)
23
24 model = Model(inputs=inp, outputs=y)
25
26 [Link]()
27
28 # compile model -> optimizer, loss, evaluation metrics
29 [Link](loss="binary_crossentropy", optimizer='adam', metrics=['acc'])
Model: "model_6"
_________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
=================================================================================
input_7 (InputLayer) [(None, 59)] 0 []
embedding_6 (Embedding) (None, 59, 128) 256000 ['input_7[0][0]
lstm_5 (LSTM) [(None, 59, 32), 20608 ['embedding_6[0
(None, 32),
(None, 32)]
conv1d_8 (Conv1D) (None, 59, 32) 1056 ['lstm_5[0][0]'
conv1d_9 (Conv1D) (None, 59, 1) 33 ['conv1d_8[0][0
softmax_5 (Softmax) (None, 59, 1) 0 ['conv1d_9[0][0
[Link].multiply_5 (TFOpLambda (None, 59, 32) 0 ['softmax_5[0][0
) 'conv1d_8[0][0
[Link].reduce_sum_3 (TFOpLamb (None, 32) 0 ['[Link]
da)
dense_12 (Dense) (None, 64) 2112 ['[Link]
dense_13 (Dense) (None, 1) 65 ['dense_12[0][0
=================================================================================
[Link] 9/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
Total params: 279,874
Trainable params: 279,874
Non-trainable params: 0
_________________________________________________________________________________
1 [Link](X_pad_train, [Link](y_train),
2 epochs=20, batch_size=64, validation_split=0.2)
Epoch 1/20
30/30 [==============================] - 4s 64ms/step - loss: 0.6935 - acc: 0.512
Epoch 2/20
30/30 [==============================] - 1s 45ms/step - loss: 0.6899 - acc: 0.526
Epoch 3/20
30/30 [==============================] - 1s 45ms/step - loss: 0.5635 - acc: 0.745
Epoch 4/20
30/30 [==============================] - 1s 46ms/step - loss: 0.3001 - acc: 0.900
Epoch 5/20
30/30 [==============================] - 1s 47ms/step - loss: 0.2739 - acc: 0.915
Epoch 6/20
30/30 [==============================] - 1s 45ms/step - loss: 0.2176 - acc: 0.935
Epoch 7/20
30/30 [==============================] - 1s 46ms/step - loss: 0.1960 - acc: 0.946
Epoch 8/20
30/30 [==============================] - 1s 46ms/step - loss: 0.1538 - acc: 0.958
Epoch 9/20
30/30 [==============================] - 1s 45ms/step - loss: 0.1266 - acc: 0.968
Epoch 10/20
30/30 [==============================] - 1s 45ms/step - loss: 0.1130 - acc: 0.967
Epoch 11/20
30/30 [==============================] - 1s 47ms/step - loss: 0.0983 - acc: 0.975
Epoch 12/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0864 - acc: 0.977
Epoch 13/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0673 - acc: 0.983
Epoch 14/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0615 - acc: 0.983
Epoch 15/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0399 - acc: 0.991
Epoch 16/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0478 - acc: 0.988
Epoch 17/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0415 - acc: 0.991
Epoch 18/20
30/30 [==============================] - 1s 45ms/step - loss: 0.0306 - acc: 0.994
Epoch 19/20
30/30 [==============================] - 1s 45ms/step - loss: 0.0233 - acc: 0.996
Epoch 20/20
30/30 [==============================] - 1s 46ms/step - loss: 0.0214 - acc: 0.996
<[Link] at 0x7f37e8d9dc50>
1 # Bidirectioal LSTM
2 # text -> RNN -> using final state as the features of text
3 # seq = "the phone was broken on shipping, terrible" -> RNN -> final state ->FC lay
4
5 from [Link] import LSTM, Softmax, Bidirectional
6
7
[Link] 10/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
8 inp = Input(shape=(max_length))
9
10 x = Embedding(vocab_size, 16)(inp)
11 x = Bidirectional(LSTM(units=16, return_sequences=True))(x)
12
13 x = Conv1D(filters=32, kernel_size=5,
14 padding='same', activation='relu')(x)
15
16 # Attention part
17 att = Conv1D(filters=1, kernel_size=1,
18 padding='same', activation='relu')(x)
19 att = Softmax(axis=1)(att)
20
21 x = [Link](att * x, axis=1)
22 y = Dense(units=64, activation='relu')(x)
23 y = Dense(units=1, activation='sigmoid')(y)
24
25 model = Model(inputs=inp, outputs=y)
26
27 [Link]()
28
29 # compile model -> optimizer, loss, evaluation metrics
30 [Link](loss="binary_crossentropy", optimizer='adam', metrics=['acc'])
Model: "model_11"
_________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
=================================================================================
input_16 (InputLayer) [(None, 59)] 0 []
embedding_15 (Embedding) (None, 59, 16) 32000 ['input_16[0][0
bidirectional_7 (Bidirectional (None, 59, 32) 4224 ['embedding_15[0
)
conv1d_20 (Conv1D) (None, 59, 32) 5152 ['bidirectional_
conv1d_21 (Conv1D) (None, 59, 1) 33 ['conv1d_20[0][0
softmax_10 (Softmax) (None, 59, 1) 0 ['conv1d_21[0][0
[Link].multiply_10 (TFOpLambd (None, 59, 32) 0 ['softmax_10[0]
a) 'conv1d_20[0][0
[Link].reduce_sum_8 (TFOpLamb (None, 32) 0 ['[Link]
da)
dense_22 (Dense) (None, 64) 2112 ['[Link]
dense_23 (Dense) (None, 1) 65 ['dense_22[0][0
=================================================================================
Total params: 43,586
Trainable params: 43,586
Non-trainable params: 0
_________________________________________________________________________________
[Link] 11/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
1 [Link](X_pad_train, [Link](y_train),
2 epochs=20, batch_size=64, validation_split=0.2)
Epoch 1/20
30/30 [==============================] - 6s 75ms/step - loss: 0.6932 - acc: 0.503
Epoch 2/20
30/30 [==============================] - 1s 42ms/step - loss: 0.6874 - acc: 0.597
Epoch 3/20
30/30 [==============================] - 1s 41ms/step - loss: 0.5137 - acc: 0.796
Epoch 4/20
30/30 [==============================] - 1s 40ms/step - loss: 0.2702 - acc: 0.896
Epoch 5/20
30/30 [==============================] - 1s 40ms/step - loss: 0.1846 - acc: 0.934
Epoch 6/20
30/30 [==============================] - 1s 40ms/step - loss: 0.1450 - acc: 0.954
Epoch 7/20
30/30 [==============================] - 1s 41ms/step - loss: 0.1013 - acc: 0.967
Epoch 8/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0719 - acc: 0.982
Epoch 9/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0544 - acc: 0.985
Epoch 10/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0426 - acc: 0.990
Epoch 11/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0460 - acc: 0.986
Epoch 12/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0305 - acc: 0.993
Epoch 13/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0262 - acc: 0.994
Epoch 14/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0316 - acc: 0.992
Epoch 15/20
30/30 [==============================] - 1s 43ms/step - loss: 0.0244 - acc: 0.994
Epoch 16/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0275 - acc: 0.994
Epoch 17/20
30/30 [==============================] - 1s 40ms/step - loss: 0.0331 - acc: 0.991
Epoch 18/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0284 - acc: 0.992
Epoch 19/20
30/30 [==============================] - 1s 42ms/step - loss: 0.0282 - acc: 0.992
Epoch 20/20
30/30 [==============================] - 1s 41ms/step - loss: 0.0156 - acc: 0.996
<[Link] at 0x7f37e1bfbc50>
[Link] 12/13
2/21/23, 3:18 PM K15_RNN_sentiment_analysis.ipynb - Colaboratory
[Link] 13/13