Keras入门——(4)长短期记忆网络LSTM(一)
参考:
https://blog.csdn.net/zwqjoy/article/details/80493341
https://blog.csdn.net/u012735708/article/details/82769711
执行代码:
# Naive LSTM to learn three-char window to one-char mapping import numpy from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.utils import np_utils # fix random seed for reproducibility numpy.random.seed(7) # define the raw dataset alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # create mapping of characters to integers (0-25) and the reverse char_to_int = dict((c, i) for i, c in enumerate(alphabet)) int_to_char = dict((i, c) for i, c in enumerate(alphabet)) # prepare the dataset of input to output pairs encoded as integers seq_length = 3 dataX = [] dataY = [] for i in range(0, len(alphabet) - seq_length, 1): seq_in = alphabet[i:i + seq_length] seq_out = alphabet[i + seq_length] dataX.append([char_to_int[char] for char in seq_in]) dataY.append(char_to_int[seq_out]) print(seq_in, '->', seq_out) # reshape X to be [samples, time steps, features] X = numpy.reshape(dataX, (len(dataX), 1, seq_length)) # normalize X = X / float(len(alphabet)) # one hot encode the output variable y = np_utils.to_categorical(dataY) # create and fit the model model = Sequential() model.add(LSTM(32, input_shape=(X.shape[1], X.shape[2]))) model.add(Dense(y.shape[1], activation='softmax')) model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) model.fit(X, y, epochs=500, batch_size=1, verbose=2) # summarize performance of the model scores = model.evaluate(X, y, verbose=0) print("Model Accuracy: %.2f%%" % (scores[1]*100)) # demonstrate some model predictions for pattern in dataX: x = numpy.reshape(pattern, (1, 1, len(pattern))) x = x / float(len(alphabet)) prediction = model.predict(x, verbose=0) index = numpy.argmax(prediction) result = int_to_char[index] seq_in = [int_to_char[value] for value in pattern] print(seq_in, "->", result)
返回信息:
Using TensorFlow backend. ABC -> D BCD -> E CDE -> F DEF -> G EFG -> H FGH -> I GHI -> J HIJ -> K IJK -> L JKL -> M KLM -> N LMN -> O MNO -> P NOP -> Q OPQ -> R PQR -> S QRS -> T RST -> U STU -> V TUV -> W UVW -> X VWX -> Y WXY -> Z WARNING:tensorflow:From D:\ProgramData\Anaconda2\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From D:\ProgramData\Anaconda2\lib\site-packages\tensorflow\python\ops\math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. Epoch 1/500 - 8s - loss: 3.2651 - acc: 0.0000e+00 Epoch 2/500 - 0s - loss: 3.2527 - acc: 0.0435 Epoch 3/500 - 0s - loss: 3.2462 - acc: 0.0435 Epoch 4/500 - 0s - loss: 3.2402 - acc: 0.0000e+00 Epoch 5/500 - 0s - loss: 3.2339 - acc: 0.0435 Epoch 6/500 - 0s - loss: 3.2274 - acc: 0.0435 Epoch 7/500 - 0s - loss: 3.2209 - acc: 0.0435 Epoch 8/500 - 0s - loss: 3.2142 - acc: 0.0000e+00 Epoch 9/500 - 0s - loss: 3.2067 - acc: 0.0435 Epoch 10/500 - 0s - loss: 3.1993 - acc: 0.0435 Epoch 11/500 - 0s - loss: 3.1918 - acc: 0.0435 Epoch 12/500 - 0s - loss: 3.1839 - acc: 0.0000e+00 Epoch 13/500 - 0s - loss: 3.1756 - acc: 0.0435 Epoch 14/500 - 0s - loss: 3.1674 - acc: 0.0435 Epoch 15/500 - 0s - loss: 3.1586 - acc: 0.0000e+00 Epoch 16/500 - 0s - loss: 3.1498 - acc: 0.0435 Epoch 17/500 - 0s - loss: 3.1418 - acc: 0.0000e+00 Epoch 18/500 - 0s - loss: 3.1340 - acc: 0.0000e+00 Epoch 19/500 - 0s - loss: 3.1245 - acc: 0.0435 Epoch 20/500 - 0s - loss: 3.1167 - acc: 0.0435 Epoch 21/500 - 0s - loss: 3.1096 - acc: 0.0435 Epoch 22/500 - 0s - loss: 3.1018 - acc: 0.0435 Epoch 23/500 - 0s - loss: 3.0935 - acc: 0.0435 Epoch 24/500 - 0s - loss: 3.0857 - acc: 0.0435 Epoch 25/500 - 0s - loss: 3.0788 - acc: 0.0435 Epoch 26/500 - 0s - loss: 3.0721 - acc: 0.0435 Epoch 27/500 - 0s - loss: 3.0647 - acc: 0.0435 Epoch 28/500 - 0s - loss: 3.0584 - acc: 0.0435 Epoch 29/500 - 0s - loss: 3.0530 - acc: 0.0435 Epoch 30/500 - 0s - loss: 3.0449 - acc: 0.0435 Epoch 31/500 - 0s - loss: 3.0398 - acc: 0.0435 Epoch 32/500 - 0s - loss: 3.0328 - acc: 0.0870 Epoch 33/500 - 0s - loss: 3.0257 - acc: 0.0870 Epoch 34/500 - 0s - loss: 3.0200 - acc: 0.0870 Epoch 35/500 - 0s - loss: 3.0132 - acc: 0.0870 Epoch 36/500 - 0s - loss: 3.0077 - acc: 0.0870 Epoch 37/500 - 0s - loss: 2.9992 - acc: 0.0870 Epoch 38/500 - 0s - loss: 2.9946 - acc: 0.0870 Epoch 39/500 - 0s - loss: 2.9855 - acc: 0.0870 Epoch 40/500 - 0s - loss: 2.9790 - acc: 0.0870 Epoch 41/500 - 0s - loss: 2.9725 - acc: 0.0870 Epoch 42/500 - 0s - loss: 2.9655 - acc: 0.0870 Epoch 43/500 - 0s - loss: 2.9576 - acc: 0.0870 Epoch 44/500 - 0s - loss: 2.9501 - acc: 0.0870 Epoch 45/500 - 0s - loss: 2.9420 - acc: 0.0870 Epoch 46/500 - 0s - loss: 2.9353 - acc: 0.0870 Epoch 47/500 - 0s - loss: 2.9271 - acc: 0.0870 Epoch 48/500 - 0s - loss: 2.9193 - acc: 0.0870 Epoch 49/500 - 0s - loss: 2.9104 - acc: 0.0870 Epoch 50/500 - 0s - loss: 2.9012 - acc: 0.0870 Epoch 51/500 - 0s - loss: 2.8931 - acc: 0.0870 Epoch 52/500 - 0s - loss: 2.8841 - acc: 0.0870 Epoch 53/500 - 0s - loss: 2.8759 - acc: 0.0870 Epoch 54/500 - 0s - loss: 2.8653 - acc: 0.0870 Epoch 55/500 - 0s - loss: 2.8574 - acc: 0.0870 Epoch 56/500 - 0s - loss: 2.8467 - acc: 0.0870 Epoch 57/500 - 0s - loss: 2.8372 - acc: 0.0870 Epoch 58/500 - 0s - loss: 2.8272 - acc: 0.0870 Epoch 59/500 - 0s - loss: 2.8180 - acc: 0.0870 Epoch 60/500 - 0s - loss: 2.8074 - acc: 0.0870 Epoch 61/500 - 0s - loss: 2.7979 - acc: 0.0870 Epoch 62/500 - 0s - loss: 2.7865 - acc: 0.1304 Epoch 63/500 - 0s - loss: 2.7778 - acc: 0.1304 Epoch 64/500 - 0s - loss: 2.7675 - acc: 0.1304 Epoch 65/500 - 0s - loss: 2.7577 - acc: 0.0870 Epoch 66/500 - 0s - loss: 2.7471 - acc: 0.0870 Epoch 67/500 - 0s - loss: 2.7384 - acc: 0.0870 Epoch 68/500 - 0s - loss: 2.7288 - acc: 0.0870 Epoch 69/500 - 0s - loss: 2.7165 - acc: 0.0870 Epoch 70/500 - 0s - loss: 2.7084 - acc: 0.0870 Epoch 71/500 - 0s - loss: 2.6975 - acc: 0.0870 Epoch 72/500 - 0s - loss: 2.6891 - acc: 0.0870 Epoch 73/500 - 0s - loss: 2.6801 - acc: 0.0870 Epoch 74/500 - 0s - loss: 2.6708 - acc: 0.0870 Epoch 75/500 - 0s - loss: 2.6624 - acc: 0.0870 Epoch 76/500 - 0s - loss: 2.6537 - acc: 0.0870 Epoch 77/500 - 0s - loss: 2.6471 - acc: 0.0870 Epoch 78/500 - 0s - loss: 2.6378 - acc: 0.1304 Epoch 79/500 - 0s - loss: 2.6304 - acc: 0.1304 Epoch 80/500 - 0s - loss: 2.6220 - acc: 0.1304 Epoch 81/500 - 0s - loss: 2.6150 - acc: 0.1304 Epoch 82/500 - 0s - loss: 2.6070 - acc: 0.1304 Epoch 83/500 - 0s - loss: 2.6006 - acc: 0.1304 Epoch 84/500 - 0s - loss: 2.5950 - acc: 0.1304 Epoch 85/500 - 0s - loss: 2.5855 - acc: 0.0870 Epoch 86/500 - 0s - loss: 2.5784 - acc: 0.0870 Epoch 87/500 - 0s - loss: 2.5741 - acc: 0.0870 Epoch 88/500 - 0s - loss: 2.5655 - acc: 0.1304 Epoch 89/500 - 0s - loss: 2.5596 - acc: 0.0870 Epoch 90/500 - 0s - loss: 2.5528 - acc: 0.0870 Epoch 91/500 - 0s - loss: 2.5470 - acc: 0.1304 Epoch 92/500 - 0s - loss: 2.5402 - acc: 0.1304 Epoch 93/500 - 0s - loss: 2.5350 - acc: 0.1304 Epoch 94/500 - 0s - loss: 2.5291 - acc: 0.1304 Epoch 95/500 - 0s - loss: 2.5234 - acc: 0.1304 Epoch 96/500 - 0s - loss: 2.5174 - acc: 0.1304 Epoch 97/500 - 0s - loss: 2.5107 - acc: 0.1304 Epoch 98/500 - 0s - loss: 2.5043 - acc: 0.1304 Epoch 99/500 - 0s - loss: 2.4984 - acc: 0.1304 Epoch 100/500 - 0s - loss: 2.4939 - acc: 0.1304 Epoch 101/500 - 0s - loss: 2.4886 - acc: 0.1304 Epoch 102/500 - 0s - loss: 2.4820 - acc: 0.1304 Epoch 103/500 - 0s - loss: 2.4761 - acc: 0.1739 Epoch 104/500 - 0s - loss: 2.4696 - acc: 0.1739 Epoch 105/500 - 0s - loss: 2.4660 - acc: 0.1304 Epoch 106/500 - 0s - loss: 2.4610 - acc: 0.1304 Epoch 107/500 - 0s - loss: 2.4551 - acc: 0.1304 Epoch 108/500 - 0s - loss: 2.4498 - acc: 0.1304 Epoch 109/500 - 0s - loss: 2.4431 - acc: 0.1304 Epoch 110/500 - 0s - loss: 2.4387 - acc: 0.1739 Epoch 111/500 - 0s - loss: 2.4333 - acc: 0.1304 Epoch 112/500 - 0s - loss: 2.4270 - acc: 0.1304 Epoch 113/500 - 0s - loss: 2.4243 - acc: 0.1739 Epoch 114/500 - 0s - loss: 2.4161 - acc: 0.1304 Epoch 115/500 - 0s - loss: 2.4130 - acc: 0.1304 Epoch 116/500 - 0s - loss: 2.4078 - acc: 0.1739 Epoch 117/500 - 0s - loss: 2.4023 - acc: 0.1739 Epoch 118/500 - 0s - loss: 2.3974 - acc: 0.1304 Epoch 119/500 - 0s - loss: 2.3921 - acc: 0.2174 Epoch 120/500 - 0s - loss: 2.3869 - acc: 0.1304 Epoch 121/500 - 0s - loss: 2.3831 - acc: 0.1304 Epoch 122/500 - 0s - loss: 2.3777 - acc: 0.1739 Epoch 123/500 - 0s - loss: 2.3728 - acc: 0.2174 Epoch 124/500 - 0s - loss: 2.3682 - acc: 0.1739 Epoch 125/500 - 0s - loss: 2.3634 - acc: 0.1739 Epoch 126/500 - 0s - loss: 2.3586 - acc: 0.1739 Epoch 127/500 - 0s - loss: 2.3532 - acc: 0.1739 Epoch 128/500 - 0s - loss: 2.3482 - acc: 0.1739 Epoch 129/500 - 0s - loss: 2.3463 - acc: 0.2174 Epoch 130/500 - 0s - loss: 2.3414 - acc: 0.2174 Epoch 131/500 - 0s - loss: 2.3363 - acc: 0.2174 Epoch 132/500 - 0s - loss: 2.3322 - acc: 0.1739 Epoch 133/500 - 0s - loss: 2.3270 - acc: 0.2174 Epoch 134/500 - 0s - loss: 2.3238 - acc: 0.2174 Epoch 135/500 - 0s - loss: 2.3194 - acc: 0.2174 Epoch 136/500 - 0s - loss: 2.3152 - acc: 0.2174 Epoch 137/500 - 0s - loss: 2.3090 - acc: 0.2174 Epoch 138/500 - 0s - loss: 2.3051 - acc: 0.2174 Epoch 139/500 - 0s - loss: 2.3028 - acc: 0.2174 Epoch 140/500 - 0s - loss: 2.2952 - acc: 0.2174 Epoch 141/500 - 0s - loss: 2.2936 - acc: 0.2174 Epoch 142/500 - 0s - loss: 2.2890 - acc: 0.1739 Epoch 143/500 - 0s - loss: 2.2830 - acc: 0.1739 Epoch 144/500 - 0s - loss: 2.2797 - acc: 0.2174 Epoch 145/500 - 0s - loss: 2.2757 - acc: 0.2174 Epoch 146/500 - 0s - loss: 2.2710 - acc: 0.2174 Epoch 147/500 - 0s - loss: 2.2676 - acc: 0.2174 Epoch 148/500 - 0s - loss: 2.2635 - acc: 0.1739 Epoch 149/500 - 0s - loss: 2.2603 - acc: 0.2174 Epoch 150/500 - 0s - loss: 2.2570 - acc: 0.2174 Epoch 151/500 - 0s - loss: 2.2524 - acc: 0.2174 Epoch 152/500 - 0s - loss: 2.2483 - acc: 0.1739 Epoch 153/500 - 0s - loss: 2.2437 - acc: 0.2174 Epoch 154/500 - 0s - loss: 2.2409 - acc: 0.2174 Epoch 155/500 - 0s - loss: 2.2361 - acc: 0.1739 Epoch 156/500 - 0s - loss: 2.2345 - acc: 0.2174 Epoch 157/500 - 0s - loss: 2.2296 - acc: 0.2174 Epoch 158/500 - 0s - loss: 2.2252 - acc: 0.2174 Epoch 159/500 - 0s - loss: 2.2219 - acc: 0.2174 Epoch 160/500 - 0s - loss: 2.2190 - acc: 0.2174 Epoch 161/500 - 0s - loss: 2.2161 - acc: 0.2609 Epoch 162/500 - 0s - loss: 2.2119 - acc: 0.2609 Epoch 163/500 - 0s - loss: 2.2065 - acc: 0.2609 Epoch 164/500 - 0s - loss: 2.2046 - acc: 0.2609 Epoch 165/500 - 0s - loss: 2.2011 - acc: 0.2609 Epoch 166/500 - 0s - loss: 2.1987 - acc: 0.3043 Epoch 167/500 - 0s - loss: 2.1948 - acc: 0.2174 Epoch 168/500 - 0s - loss: 2.1914 - acc: 0.3043 Epoch 169/500 - 0s - loss: 2.1882 - acc: 0.2609 Epoch 170/500 - 0s - loss: 2.1863 - acc: 0.2609 Epoch 171/500 - 0s - loss: 2.1808 - acc: 0.2174 Epoch 172/500 - 0s - loss: 2.1779 - acc: 0.3478 Epoch 173/500 - 0s - loss: 2.1744 - acc: 0.3478 Epoch 174/500 - 0s - loss: 2.1736 - acc: 0.3478 Epoch 175/500 - 0s - loss: 2.1686 - acc: 0.3478 Epoch 176/500 - 0s - loss: 2.1652 - acc: 0.3043 Epoch 177/500 - 0s - loss: 2.1617 - acc: 0.2609 Epoch 178/500 - 0s - loss: 2.1613 - acc: 0.2609 Epoch 179/500 - 0s - loss: 2.1553 - acc: 0.3478 Epoch 180/500 - 0s - loss: 2.1534 - acc: 0.2609 Epoch 181/500 - 0s - loss: 2.1511 - acc: 0.2609 Epoch 182/500 - 0s - loss: 2.1477 - acc: 0.3043 Epoch 183/500 - 0s - loss: 2.1445 - acc: 0.2609 Epoch 184/500 - 0s - loss: 2.1416 - acc: 0.3913 Epoch 185/500 - 0s - loss: 2.1383 - acc: 0.3478 Epoch 186/500 - 0s - loss: 2.1366 - acc: 0.3478 Epoch 187/500 - 0s - loss: 2.1328 - acc: 0.3043 Epoch 188/500 - 0s - loss: 2.1317 - acc: 0.3043 Epoch 189/500 - 0s - loss: 2.1284 - acc: 0.3478 Epoch 190/500 - 0s - loss: 2.1242 - acc: 0.3478 Epoch 191/500 - 0s - loss: 2.1225 - acc: 0.3043 Epoch 192/500 - 0s - loss: 2.1178 - acc: 0.3043 Epoch 193/500 - 0s - loss: 2.1171 - acc: 0.2609 Epoch 194/500 - 0s - loss: 2.1141 - acc: 0.2609 Epoch 195/500 - 0s - loss: 2.1108 - acc: 0.3043 Epoch 196/500 - 0s - loss: 2.1100 - acc: 0.3478 Epoch 197/500 - 0s - loss: 2.1051 - acc: 0.3043 Epoch 198/500 - 0s - loss: 2.1025 - acc: 0.3478 Epoch 199/500 - 0s - loss: 2.1005 - acc: 0.3478 Epoch 200/500 - 0s - loss: 2.0982 - acc: 0.3478 Epoch 201/500 - 0s - loss: 2.0951 - acc: 0.3478 Epoch 202/500 - 0s - loss: 2.0926 - acc: 0.3043 Epoch 203/500 - 0s - loss: 2.0919 - acc: 0.3043 Epoch 204/500 - 0s - loss: 2.0876 - acc: 0.3478 Epoch 205/500 - 0s - loss: 2.0844 - acc: 0.3043 Epoch 206/500 - 0s - loss: 2.0838 - acc: 0.3043 Epoch 207/500 - 0s - loss: 2.0798 - acc: 0.3043 Epoch 208/500 - 0s - loss: 2.0777 - acc: 0.3478 Epoch 209/500 - 0s - loss: 2.0767 - acc: 0.3043 Epoch 210/500 - 0s - loss: 2.0723 - acc: 0.2609 Epoch 211/500 - 0s - loss: 2.0716 - acc: 0.3043 Epoch 212/500 - 0s - loss: 2.0690 - acc: 0.3043 Epoch 213/500 - 0s - loss: 2.0663 - acc: 0.3478 Epoch 214/500 - 0s - loss: 2.0632 - acc: 0.3913 Epoch 215/500 - 0s - loss: 2.0628 - acc: 0.3478 Epoch 216/500 - 0s - loss: 2.0603 - acc: 0.3478 Epoch 217/500 - 0s - loss: 2.0567 - acc: 0.3913 Epoch 218/500 - 0s - loss: 2.0559 - acc: 0.3913 Epoch 219/500 - 0s - loss: 2.0509 - acc: 0.3913 Epoch 220/500 - 0s - loss: 2.0499 - acc: 0.3043 Epoch 221/500 - 0s - loss: 2.0482 - acc: 0.3478 Epoch 222/500 - 0s - loss: 2.0439 - acc: 0.3478 Epoch 223/500 - 0s - loss: 2.0427 - acc: 0.3913 Epoch 224/500 - 0s - loss: 2.0404 - acc: 0.4348 Epoch 225/500 - 0s - loss: 2.0393 - acc: 0.3913 Epoch 226/500 - 0s - loss: 2.0379 - acc: 0.4348 Epoch 227/500 - 0s - loss: 2.0360 - acc: 0.4348 Epoch 228/500 - 0s - loss: 2.0330 - acc: 0.4348 Epoch 229/500 - 0s - loss: 2.0307 - acc: 0.4348 Epoch 230/500 - 0s - loss: 2.0269 - acc: 0.4783 Epoch 231/500 - 0s - loss: 2.0251 - acc: 0.3913 Epoch 232/500 - 0s - loss: 2.0234 - acc: 0.4783 Epoch 233/500 - 0s - loss: 2.0222 - acc: 0.4348 Epoch 234/500 - 0s - loss: 2.0190 - acc: 0.4783 Epoch 235/500 - 0s - loss: 2.0175 - acc: 0.5652 Epoch 236/500 - 0s - loss: 2.0161 - acc: 0.4783 Epoch 237/500 - 0s - loss: 2.0133 - acc: 0.4348 Epoch 238/500 - 0s - loss: 2.0097 - acc: 0.4348 Epoch 239/500 - 0s - loss: 2.0094 - acc: 0.3913 Epoch 240/500 - 0s - loss: 2.0077 - acc: 0.4783 Epoch 241/500 - 0s - loss: 2.0048 - acc: 0.4348 Epoch 242/500 - 0s - loss: 2.0028 - acc: 0.4348 Epoch 243/500 - 0s - loss: 2.0002 - acc: 0.4348 Epoch 244/500 - 0s - loss: 1.9974 - acc: 0.4348 Epoch 245/500 - 0s - loss: 1.9958 - acc: 0.4783 Epoch 246/500 - 0s - loss: 1.9956 - acc: 0.4348 Epoch 247/500 - 0s - loss: 1.9929 - acc: 0.4783 Epoch 248/500 - 0s - loss: 1.9916 - acc: 0.4783 Epoch 249/500 - 0s - loss: 1.9888 - acc: 0.5652 Epoch 250/500 - 0s - loss: 1.9895 - acc: 0.5217 Epoch 251/500 - 0s - loss: 1.9838 - acc: 0.4348 Epoch 252/500 - 0s - loss: 1.9840 - acc: 0.4348 Epoch 253/500 - 0s - loss: 1.9814 - acc: 0.5652 Epoch 254/500 - 0s - loss: 1.9812 - acc: 0.4783 Epoch 255/500 - 0s - loss: 1.9768 - acc: 0.5217 Epoch 256/500 - 0s - loss: 1.9759 - acc: 0.4348 Epoch 257/500 - 0s - loss: 1.9741 - acc: 0.4783 Epoch 258/500 - 0s - loss: 1.9703 - acc: 0.5652 Epoch 259/500 - 0s - loss: 1.9713 - acc: 0.4348 Epoch 260/500 - 0s - loss: 1.9653 - acc: 0.5217 Epoch 261/500 - 0s - loss: 1.9658 - acc: 0.5217 Epoch 262/500 - 0s - loss: 1.9624 - acc: 0.5652 Epoch 263/500 - 0s - loss: 1.9614 - acc: 0.5217 Epoch 264/500 - 0s - loss: 1.9632 - acc: 0.5217 Epoch 265/500 - 0s - loss: 1.9588 - acc: 0.5217 Epoch 266/500 - 0s - loss: 1.9556 - acc: 0.5217 Epoch 267/500 - 0s - loss: 1.9556 - acc: 0.5217 Epoch 268/500 - 0s - loss: 1.9511 - acc: 0.5217 Epoch 269/500 - 0s - loss: 1.9522 - acc: 0.5652 Epoch 270/500 - 0s - loss: 1.9502 - acc: 0.5652 Epoch 271/500 - 0s - loss: 1.9494 - acc: 0.5652 Epoch 272/500 - 0s - loss: 1.9450 - acc: 0.5652 Epoch 273/500 - 0s - loss: 1.9455 - acc: 0.5217 Epoch 274/500 - 0s - loss: 1.9446 - acc: 0.3913 Epoch 275/500 - 0s - loss: 1.9406 - acc: 0.4783 Epoch 276/500 - 0s - loss: 1.9392 - acc: 0.4783 Epoch 277/500 - 0s - loss: 1.9353 - acc: 0.5652 Epoch 278/500 - 0s - loss: 1.9356 - acc: 0.4348 Epoch 279/500 - 0s - loss: 1.9355 - acc: 0.6087 Epoch 280/500 - 0s - loss: 1.9345 - acc: 0.5652 Epoch 281/500 - 0s - loss: 1.9291 - acc: 0.6087 Epoch 282/500 - 0s - loss: 1.9311 - acc: 0.6087 Epoch 283/500 - 0s - loss: 1.9298 - acc: 0.4783 Epoch 284/500 - 0s - loss: 1.9264 - acc: 0.5217 Epoch 285/500 - 0s - loss: 1.9245 - acc: 0.6087 Epoch 286/500 - 0s - loss: 1.9233 - acc: 0.5652 Epoch 287/500 - 0s - loss: 1.9217 - acc: 0.4783 Epoch 288/500 - 0s - loss: 1.9193 - acc: 0.5217 Epoch 289/500 - 0s - loss: 1.9149 - acc: 0.5217 Epoch 290/500 - 0s - loss: 1.9153 - acc: 0.5217 Epoch 291/500 - 0s - loss: 1.9128 - acc: 0.6087 Epoch 292/500 - 0s - loss: 1.9112 - acc: 0.6957 Epoch 293/500 - 0s - loss: 1.9112 - acc: 0.6087 Epoch 294/500 - 0s - loss: 1.9095 - acc: 0.6087 Epoch 295/500 - 0s - loss: 1.9077 - acc: 0.5652 Epoch 296/500 - 0s - loss: 1.9059 - acc: 0.6087 Epoch 297/500 - 0s - loss: 1.9054 - acc: 0.6522 Epoch 298/500 - 0s - loss: 1.9045 - acc: 0.6087 Epoch 299/500 - 0s - loss: 1.9010 - acc: 0.6522 Epoch 300/500 - 0s - loss: 1.8994 - acc: 0.5217 Epoch 301/500 - 0s - loss: 1.8975 - acc: 0.4348 Epoch 302/500 - 0s - loss: 1.8957 - acc: 0.5652 Epoch 303/500 - 0s - loss: 1.8956 - acc: 0.6087 Epoch 304/500 - 0s - loss: 1.8962 - acc: 0.4783 Epoch 305/500 - 0s - loss: 1.8935 - acc: 0.5217 Epoch 306/500 - 0s - loss: 1.8892 - acc: 0.5652 Epoch 307/500 - 0s - loss: 1.8881 - acc: 0.6087 Epoch 308/500 - 0s - loss: 1.8867 - acc: 0.5652 Epoch 309/500 - 0s - loss: 1.8869 - acc: 0.5652 Epoch 310/500 - 0s - loss: 1.8837 - acc: 0.6087 Epoch 311/500 - 0s - loss: 1.8825 - acc: 0.6522 Epoch 312/500 - 0s - loss: 1.8791 - acc: 0.5217 Epoch 313/500 - 0s - loss: 1.8790 - acc: 0.6087 Epoch 314/500 - 0s - loss: 1.8771 - acc: 0.6087 Epoch 315/500 - 0s - loss: 1.8766 - acc: 0.6087 Epoch 316/500 - 0s - loss: 1.8746 - acc: 0.5652 Epoch 317/500 - 0s - loss: 1.8720 - acc: 0.5652 Epoch 318/500 - 0s - loss: 1.8711 - acc: 0.6087 Epoch 319/500 - 0s - loss: 1.8699 - acc: 0.5652 Epoch 320/500 - 0s - loss: 1.8688 - acc: 0.4783 Epoch 321/500 - 0s - loss: 1.8674 - acc: 0.5652 Epoch 322/500 - 0s - loss: 1.8677 - acc: 0.5652 Epoch 323/500 - 0s - loss: 1.8627 - acc: 0.5217 Epoch 324/500 - 0s - loss: 1.8636 - acc: 0.6087 Epoch 325/500 - 0s - loss: 1.8623 - acc: 0.6522 Epoch 326/500 - 0s - loss: 1.8608 - acc: 0.5217 Epoch 327/500 - 0s - loss: 1.8619 - acc: 0.6522 Epoch 328/500 - 0s - loss: 1.8582 - acc: 0.6087 Epoch 329/500 - 0s - loss: 1.8554 - acc: 0.5652 Epoch 330/500 - 0s - loss: 1.8540 - acc: 0.6522 Epoch 331/500 - 0s - loss: 1.8567 - acc: 0.5652 Epoch 332/500 - 0s - loss: 1.8520 - acc: 0.5652 Epoch 333/500 - 0s - loss: 1.8515 - acc: 0.6522 Epoch 334/500 - 0s - loss: 1.8484 - acc: 0.6087 Epoch 335/500 - 0s - loss: 1.8498 - acc: 0.6087 Epoch 336/500 - 0s - loss: 1.8451 - acc: 0.6522 Epoch 337/500 - 0s - loss: 1.8434 - acc: 0.6522 Epoch 338/500 - 0s - loss: 1.8431 - acc: 0.5217 Epoch 339/500 - 0s - loss: 1.8418 - acc: 0.6087 Epoch 340/500 - 0s - loss: 1.8410 - acc: 0.5217 Epoch 341/500 - 0s - loss: 1.8395 - acc: 0.6522 Epoch 342/500 - 0s - loss: 1.8392 - acc: 0.6087 Epoch 343/500 - 0s - loss: 1.8362 - acc: 0.5652 Epoch 344/500 - 0s - loss: 1.8336 - acc: 0.6087 Epoch 345/500 - 0s - loss: 1.8320 - acc: 0.6087 Epoch 346/500 - 0s - loss: 1.8316 - acc: 0.6522 Epoch 347/500 - 0s - loss: 1.8325 - acc: 0.5652 Epoch 348/500 - 0s - loss: 1.8284 - acc: 0.5652 Epoch 349/500 - 0s - loss: 1.8278 - acc: 0.6087 Epoch 350/500 - 0s - loss: 1.8263 - acc: 0.6087 Epoch 351/500 - 0s - loss: 1.8234 - acc: 0.5217 Epoch 352/500 - 0s - loss: 1.8244 - acc: 0.6087 Epoch 353/500 - 0s - loss: 1.8224 - acc: 0.6522 Epoch 354/500 - 0s - loss: 1.8208 - acc: 0.6522 Epoch 355/500 - 0s - loss: 1.8225 - acc: 0.6522 Epoch 356/500 - 0s - loss: 1.8181 - acc: 0.6522 Epoch 357/500 - 0s - loss: 1.8170 - acc: 0.5217 Epoch 358/500 - 0s - loss: 1.8182 - acc: 0.6522 Epoch 359/500 - 0s - loss: 1.8146 - acc: 0.5652 Epoch 360/500 - 0s - loss: 1.8114 - acc: 0.6957 Epoch 361/500 - 0s - loss: 1.8111 - acc: 0.7391 Epoch 362/500 - 0s - loss: 1.8091 - acc: 0.6522 Epoch 363/500 - 0s - loss: 1.8096 - acc: 0.5652 Epoch 364/500 - 0s - loss: 1.8078 - acc: 0.6087 Epoch 365/500 - 0s - loss: 1.8069 - acc: 0.5652 Epoch 366/500 - 0s - loss: 1.8060 - acc: 0.6522 Epoch 367/500 - 0s - loss: 1.8041 - acc: 0.6087 Epoch 368/500 - 0s - loss: 1.8021 - acc: 0.6957 Epoch 369/500 - 0s - loss: 1.8003 - acc: 0.6957 Epoch 370/500 - 0s - loss: 1.8004 - acc: 0.6957 Epoch 371/500 - 0s - loss: 1.7980 - acc: 0.5652 Epoch 372/500 - 0s - loss: 1.7977 - acc: 0.6522 Epoch 373/500 - 0s - loss: 1.7946 - acc: 0.6957 Epoch 374/500 - 0s - loss: 1.7930 - acc: 0.6957 Epoch 375/500 - 0s - loss: 1.7939 - acc: 0.6957 Epoch 376/500 - 0s - loss: 1.7907 - acc: 0.6087 Epoch 377/500 - 0s - loss: 1.7892 - acc: 0.6522 Epoch 378/500 - 0s - loss: 1.7899 - acc: 0.6087 Epoch 379/500 - 0s - loss: 1.7861 - acc: 0.6522 Epoch 380/500 - 0s - loss: 1.7871 - acc: 0.6522 Epoch 381/500 - 0s - loss: 1.7870 - acc: 0.6087 Epoch 382/500 - 0s - loss: 1.7850 - acc: 0.7391 Epoch 383/500 - 0s - loss: 1.7811 - acc: 0.6957 Epoch 384/500 - 0s - loss: 1.7812 - acc: 0.6522 Epoch 385/500 - 0s - loss: 1.7824 - acc: 0.7391 Epoch 386/500 - 0s - loss: 1.7790 - acc: 0.6522 Epoch 387/500 - 0s - loss: 1.7762 - acc: 0.6957 Epoch 388/500 - 0s - loss: 1.7761 - acc: 0.7826 Epoch 389/500 - 0s - loss: 1.7763 - acc: 0.6957 Epoch 390/500 - 0s - loss: 1.7740 - acc: 0.6957 Epoch 391/500 - 0s - loss: 1.7719 - acc: 0.6957 Epoch 392/500 - 0s - loss: 1.7698 - acc: 0.6957 Epoch 393/500 - 0s - loss: 1.7712 - acc: 0.6522 Epoch 394/500 - 0s - loss: 1.7673 - acc: 0.6522 Epoch 395/500 - 0s - loss: 1.7690 - acc: 0.6957 Epoch 396/500 - 0s - loss: 1.7659 - acc: 0.6522 Epoch 397/500 - 0s - loss: 1.7666 - acc: 0.6087 Epoch 398/500 - 0s - loss: 1.7657 - acc: 0.6087 Epoch 399/500 - 0s - loss: 1.7630 - acc: 0.6957 Epoch 400/500 - 0s - loss: 1.7623 - acc: 0.6522 Epoch 401/500 - 0s - loss: 1.7604 - acc: 0.6957 Epoch 402/500 - 0s - loss: 1.7576 - acc: 0.7391 Epoch 403/500 - 0s - loss: 1.7580 - acc: 0.6522 Epoch 404/500 - 0s - loss: 1.7584 - acc: 0.6957 Epoch 405/500 - 0s - loss: 1.7561 - acc: 0.6522 Epoch 406/500 - 0s - loss: 1.7555 - acc: 0.6522 Epoch 407/500 - 0s - loss: 1.7526 - acc: 0.8261 Epoch 408/500 - 0s - loss: 1.7531 - acc: 0.6957 Epoch 409/500 - 0s - loss: 1.7507 - acc: 0.6957 Epoch 410/500 - 0s - loss: 1.7508 - acc: 0.7391 Epoch 411/500 - 0s - loss: 1.7495 - acc: 0.6957 Epoch 412/500 - 0s - loss: 1.7495 - acc: 0.7391 Epoch 413/500 - 0s - loss: 1.7469 - acc: 0.6957 Epoch 414/500 - 0s - loss: 1.7459 - acc: 0.6522 Epoch 415/500 - 0s - loss: 1.7434 - acc: 0.6957 Epoch 416/500 - 0s - loss: 1.7414 - acc: 0.6522 Epoch 417/500 - 0s - loss: 1.7393 - acc: 0.6957 Epoch 418/500 - 0s - loss: 1.7383 - acc: 0.6522 Epoch 419/500 - 0s - loss: 1.7388 - acc: 0.6957 Epoch 420/500 - 0s - loss: 1.7389 - acc: 0.6087 Epoch 421/500 - 0s - loss: 1.7379 - acc: 0.6957 Epoch 422/500 - 0s - loss: 1.7335 - acc: 0.6957 Epoch 423/500 - 0s - loss: 1.7331 - acc: 0.7391 Epoch 424/500 - 0s - loss: 1.7339 - acc: 0.6957 Epoch 425/500 - 0s - loss: 1.7338 - acc: 0.7391 Epoch 426/500 - 0s - loss: 1.7303 - acc: 0.6957 Epoch 427/500 - 0s - loss: 1.7278 - acc: 0.7826 Epoch 428/500 - 0s - loss: 1.7274 - acc: 0.6522 Epoch 429/500 - 0s - loss: 1.7277 - acc: 0.7391 Epoch 430/500 - 0s - loss: 1.7264 - acc: 0.6957 Epoch 431/500 - 0s - loss: 1.7249 - acc: 0.6522 Epoch 432/500 - 0s - loss: 1.7245 - acc: 0.6522 Epoch 433/500 - 0s - loss: 1.7202 - acc: 0.7391 Epoch 434/500 - 0s - loss: 1.7201 - acc: 0.6522 Epoch 435/500 - 0s - loss: 1.7186 - acc: 0.7391 Epoch 436/500 - 0s - loss: 1.7177 - acc: 0.8261 Epoch 437/500 - 0s - loss: 1.7187 - acc: 0.7391 Epoch 438/500 - 0s - loss: 1.7170 - acc: 0.7391 Epoch 439/500 - 0s - loss: 1.7148 - acc: 0.7391 Epoch 440/500 - 0s - loss: 1.7130 - acc: 0.6957 Epoch 441/500 - 0s - loss: 1.7140 - acc: 0.8261 Epoch 442/500 - 0s - loss: 1.7124 - acc: 0.7826 Epoch 443/500 - 0s - loss: 1.7077 - acc: 0.7826 Epoch 444/500 - 0s - loss: 1.7108 - acc: 0.6957 Epoch 445/500 - 0s - loss: 1.7080 - acc: 0.7391 Epoch 446/500 - 0s - loss: 1.7068 - acc: 0.7391 Epoch 447/500 - 0s - loss: 1.7061 - acc: 0.6522 Epoch 448/500 - 0s - loss: 1.7056 - acc: 0.6957 Epoch 449/500 - 0s - loss: 1.7052 - acc: 0.6957 Epoch 450/500 - 0s - loss: 1.7015 - acc: 0.7391 Epoch 451/500 - 0s - loss: 1.7008 - acc: 0.7391 Epoch 452/500 - 0s - loss: 1.6998 - acc: 0.6957 Epoch 453/500 - 0s - loss: 1.7005 - acc: 0.7391 Epoch 454/500 - 0s - loss: 1.6990 - acc: 0.7826 Epoch 455/500 - 0s - loss: 1.6948 - acc: 0.6957 Epoch 456/500 - 0s - loss: 1.6984 - acc: 0.8261 Epoch 457/500 - 0s - loss: 1.6917 - acc: 0.7826 Epoch 458/500 - 0s - loss: 1.6947 - acc: 0.6087 Epoch 459/500 - 0s - loss: 1.6923 - acc: 0.7826 Epoch 460/500 - 0s - loss: 1.6934 - acc: 0.7391 Epoch 461/500 - 0s - loss: 1.6918 - acc: 0.7391 Epoch 462/500 - 0s - loss: 1.6893 - acc: 0.7391 Epoch 463/500 - 0s - loss: 1.6865 - acc: 0.6957 Epoch 464/500 - 0s - loss: 1.6843 - acc: 0.6957 Epoch 465/500 - 0s - loss: 1.6856 - acc: 0.7391 Epoch 466/500 - 0s - loss: 1.6861 - acc: 0.7391 Epoch 467/500 - 0s - loss: 1.6828 - acc: 0.7826 Epoch 468/500 - 0s - loss: 1.6819 - acc: 0.7826 Epoch 469/500 - 0s - loss: 1.6800 - acc: 0.8261 Epoch 470/500 - 0s - loss: 1.6785 - acc: 0.7826 Epoch 471/500 - 0s - loss: 1.6795 - acc: 0.8261 Epoch 472/500 - 0s - loss: 1.6761 - acc: 0.7391 Epoch 473/500 - 0s - loss: 1.6770 - acc: 0.8261 Epoch 474/500 - 0s - loss: 1.6755 - acc: 0.8261 Epoch 475/500 - 0s - loss: 1.6722 - acc: 0.7826 Epoch 476/500 - 0s - loss: 1.6703 - acc: 0.7826 Epoch 477/500 - 0s - loss: 1.6705 - acc: 0.7391 Epoch 478/500 - 0s - loss: 1.6700 - acc: 0.7826 Epoch 479/500 - 0s - loss: 1.6676 - acc: 0.8696 Epoch 480/500 - 0s - loss: 1.6700 - acc: 0.7826 Epoch 481/500 - 0s - loss: 1.6695 - acc: 0.7826 Epoch 482/500 - 0s - loss: 1.6668 - acc: 0.6957 Epoch 483/500 - 0s - loss: 1.6669 - acc: 0.7391 Epoch 484/500 - 0s - loss: 1.6657 - acc: 0.6957 Epoch 485/500 - 0s - loss: 1.6640 - acc: 0.7391 Epoch 486/500 - 0s - loss: 1.6613 - acc: 0.7391 Epoch 487/500 - 0s - loss: 1.6623 - acc: 0.7826 Epoch 488/500 - 0s - loss: 1.6612 - acc: 0.6957 Epoch 489/500 - 0s - loss: 1.6574 - acc: 0.7391 Epoch 490/500 - 0s - loss: 1.6580 - acc: 0.7826 Epoch 491/500 - 0s - loss: 1.6575 - acc: 0.7826 Epoch 492/500 - 0s - loss: 1.6556 - acc: 0.8261 Epoch 493/500 - 0s - loss: 1.6568 - acc: 0.7391 Epoch 494/500 - 0s - loss: 1.6551 - acc: 0.7391 Epoch 495/500 - 0s - loss: 1.6500 - acc: 0.8261 Epoch 496/500 - 0s - loss: 1.6521 - acc: 0.7391 Epoch 497/500 - 0s - loss: 1.6502 - acc: 0.7391 Epoch 498/500 - 0s - loss: 1.6516 - acc: 0.8261 Epoch 499/500 - 0s - loss: 1.6491 - acc: 0.7826 Epoch 500/500 - 0s - loss: 1.6453 - acc: 0.7826 Model Accuracy: 86.96% ['A', 'B', 'C'] -> D ['B', 'C', 'D'] -> E ['C', 'D', 'E'] -> F ['D', 'E', 'F'] -> G ['E', 'F', 'G'] -> H ['F', 'G', 'H'] -> I ['G', 'H', 'I'] -> J ['H', 'I', 'J'] -> K ['I', 'J', 'K'] -> L ['J', 'K', 'L'] -> M ['K', 'L', 'M'] -> N ['L', 'M', 'N'] -> O ['M', 'N', 'O'] -> P ['N', 'O', 'P'] -> Q ['O', 'P', 'Q'] -> R ['P', 'Q', 'R'] -> S ['Q', 'R', 'S'] -> T ['R', 'S', 'T'] -> U ['S', 'T', 'U'] -> V ['T', 'U', 'V'] -> X ['U', 'V', 'W'] -> Z ['V', 'W', 'X'] -> Z ['W', 'X', 'Y'] -> Z
Keras入门——(4)长短期记忆网络LSTM(一)的更多相关文章
- 如何预测股票分析--长短期记忆网络(LSTM)
在上一篇中,我们回顾了先知的方法,但是在这个案例中表现也不是特别突出,今天介绍的是著名的l s t m算法,在时间序列中解决了传统r n n算法梯度消失问题的的它这一次还会有令人杰出的表现吗? 长短期 ...
- Keras入门——(7)长短期记忆网络LSTM(四)
数据准备:http://www.manythings.org/anki/cmn-eng.zip 源代码:https://github.com/pjgao/seq2seq_keras 参考:https: ...
- Keras入门——(6)长短期记忆网络LSTM(三)
参考: https://blog.csdn.net/u012735708/article/details/82769711 https://zybuluo.com/hanbingtao/note/58 ...
- Keras入门——(5)长短期记忆网络LSTM(二)
参考: https://blog.csdn.net/zwqjoy/article/details/80493341 https://blog.csdn.net/u012735708/article/d ...
- 递归神经网络之理解长短期记忆网络(LSTM NetWorks)(转载)
递归神经网络 人类并不是每时每刻都从头开始思考.正如你阅读这篇文章的时候,你是在理解前面词语的基础上来理解每个词.你不会丢弃所有已知的信息而从头开始思考.你的思想具有持续性. 传统的神经网络不能做到这 ...
- 理解长短期记忆网络(LSTM NetWorks)
转自:http://www.csdn.net/article/2015-11-25/2826323 原文链接:Understanding LSTM Networks(译者/刘翔宇 审校/赵屹华 责编/ ...
- LSTM - 长短期记忆网络
循环神经网络(RNN) 人们不是每一秒都从头开始思考,就像你阅读本文时,不会从头去重新学习一个文字,人类的思维是有持续性的.传统的卷积神经网络没有记忆,不能解决这一个问题,循环神经网络(Recurre ...
- LSTMs 长短期记忆网络系列
RNN的长期依赖问题 什么是长期依赖? 长期依赖是指当前系统的状态,可能受很长时间之前系统状态的影响,是RNN中无法解决的一个问题. 如果从(1) “ 这块冰糖味道真?”来预测下一个词,是很容易得出“ ...
- Long-Short Memory Network(LSTM长短期记忆网络)
自剪枝神经网络 Simple RNN从理论上来看,具有全局记忆能力,因为T时刻,递归隐层一定记录着时序为1的状态 但由于Gradient Vanish问题,T时刻向前反向传播的Gradient在T-1 ...
随机推荐
- 什么是Maven? 使用Apache Maven构建和依赖项管理
通过优锐课java架构学习中,学到了不少干货,整理分享给大家学习. 开始使用最流行的Java构建和依赖管理工具Maven Apache Maven是Java开发的基石,也是Java使用最广泛的构建管理 ...
- 八、ORDER BY优化
前言:在使用order by时,经常出现Using filesort,因此对于此类sql语句需尽力优化,使其尽量使用Using index. 0.准备 #1.创建test表. drop table i ...
- Python - for循环的本质,迭代器,可迭代对象
参考 https://foofish.net/how-for-works-in-python.html for循环可以迭代一个可迭代(iterable)的对象 原理 生成这个可迭代对象(实现了__it ...
- 创业学习---今日头条创业过程分析---HHR计划
本文搜集和整理了今日头条创业的一些关键点的资料------by 春跃(本文的主要观点都是搜集整理,所以不得本人同意不得转载) 一,18年之前的今日头条创业时间表: 1,张一鸣参与创业的履历:酷讯,饭否 ...
- HDU3172 Virtual Friends
基础并查集~ #include<cstdio> #include<algorithm> #include<cstring> #include<unordere ...
- pdf.js的使用 (3)真实项目分享
需求:a.jsp页面要做一个pdf的预览功能,我采用layer.open()弹窗的形式来预览pdf 1.在a.jsp点击文件然后弹出窗口(其实是弹出b.jsp) var lay=layer.open( ...
- CRS-1硬件维护
一.CRS-1硬件介绍CRS-1 路由器是Cisco 推出的新的大容量骨干路由器,是一个支持多机箱扩展的路由系统.其设计容量可以扩展至72 个线卡机箱.8 个矩阵机箱,总交换容量达到92Tbps,具有 ...
- Python学习第二十四课——Mysql 外键约束
外键:主要是关联两个表的 举个栗子:在建表中创建外键 -- 添加外键例子 CREATE TABLE teacher( id TINYINT PRIMARY KEY auto_increment, na ...
- 质因数分解(0)<P2012_1>
质因数分解 (prime.cpp/c/pas) [问题描述] 已知正整数n是两个不同的质数的乘积,试求出较大的那个质数. [输入] 输入文件名为prime.in. 输入只有一行,包含一个正整数n. [ ...
- iOS中常用的手势
--前言 智能手机问世后的很长一段时间,各大手机厂商都在思考着智能手机应该怎么玩?也都在尝试着制定自己的一套操作方式.直到2007年乔布斯发布了iPhone手机,人们才认识到智能手机就应该这样玩. 真 ...