keras 為 High Level DNN Design Tool Language


In [10]:
from keras.models import Sequential

model = Sequential()

In [ ]:


In [11]:
from keras.layers import Dense, Activation

model.add(Dense(output_dim=64, input_dim=100))
model.add(Activation("sigmoid"))
model.add(Dense(output_dim=10))
model.add(Activation("softmax"))

In [12]:
model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])

In [13]:
from IPython.display import SVG
from keras.utils.visualize_util import model_to_dot

SVG(model_to_dot(model).create(prog='dot', format='svg'))


Out[13]:
G 4436892368 dense_input_2 (InputLayer) 4436893008 dense_3 (Dense) 4436892368->4436893008 4437202192 activation_3 (Activation) 4436893008->4437202192 4437204304 dense_4 (Dense) 4437202192->4437204304 4437230160 activation_4 (Activation) 4437204304->4437230160

In [14]:
import numpy as np

In [15]:
X_train = np.random.uniform(low=0, high=100, size=[100,100])
print X_train.shape
Y_train = np.matrix([[1]+[0]*9]*100)
print Y_train.shape


(100, 100)
(100, 10)

In [16]:
model.fit(X_train, Y_train, nb_epoch=1000, batch_size=20)


Epoch 1/1000
100/100 [==============================] - 0s - loss: 1.1566 - acc: 0.8300     
Epoch 2/1000
100/100 [==============================] - 0s - loss: 0.4642 - acc: 1.0000     
Epoch 3/1000
100/100 [==============================] - 0s - loss: 0.2602 - acc: 1.0000     
Epoch 4/1000
100/100 [==============================] - 0s - loss: 0.1816 - acc: 1.0000     
Epoch 5/1000
100/100 [==============================] - 0s - loss: 0.1391 - acc: 1.0000     
Epoch 6/1000
100/100 [==============================] - 0s - loss: 0.1117 - acc: 1.0000     
Epoch 7/1000
100/100 [==============================] - 0s - loss: 0.0932 - acc: 1.0000     
Epoch 8/1000
100/100 [==============================] - 0s - loss: 0.0778 - acc: 1.0000     
Epoch 9/1000
100/100 [==============================] - 0s - loss: 0.0679 - acc: 1.0000     
Epoch 10/1000
100/100 [==============================] - 0s - loss: 0.0610 - acc: 1.0000     
Epoch 11/1000
100/100 [==============================] - 0s - loss: 0.0554 - acc: 1.0000     
Epoch 12/1000
100/100 [==============================] - 0s - loss: 0.0510 - acc: 1.0000     
Epoch 13/1000
100/100 [==============================] - 0s - loss: 0.0471 - acc: 1.0000     
Epoch 14/1000
100/100 [==============================] - 0s - loss: 0.0434 - acc: 1.0000     
Epoch 15/1000
100/100 [==============================] - 0s - loss: 0.0399 - acc: 1.0000     
Epoch 16/1000
100/100 [==============================] - 0s - loss: 0.0371 - acc: 1.0000     
Epoch 17/1000
100/100 [==============================] - 0s - loss: 0.0349 - acc: 1.0000     
Epoch 18/1000
100/100 [==============================] - 0s - loss: 0.0331 - acc: 1.0000     
Epoch 19/1000
100/100 [==============================] - 0s - loss: 0.0314 - acc: 1.0000     
Epoch 20/1000
100/100 [==============================] - 0s - loss: 0.0298 - acc: 1.0000     
Epoch 21/1000
100/100 [==============================] - 0s - loss: 0.0283 - acc: 1.0000     
Epoch 22/1000
100/100 [==============================] - 0s - loss: 0.0268 - acc: 1.0000     
Epoch 23/1000
100/100 [==============================] - 0s - loss: 0.0253 - acc: 1.0000     
Epoch 24/1000
100/100 [==============================] - 0s - loss: 0.0242 - acc: 1.0000     
Epoch 25/1000
100/100 [==============================] - 0s - loss: 0.0232 - acc: 1.0000     
Epoch 26/1000
100/100 [==============================] - 0s - loss: 0.0223 - acc: 1.0000     
Epoch 27/1000
100/100 [==============================] - 0s - loss: 0.0215 - acc: 1.0000     
Epoch 28/1000
100/100 [==============================] - 0s - loss: 0.0207 - acc: 1.0000     
Epoch 29/1000
100/100 [==============================] - 0s - loss: 0.0200 - acc: 1.0000     
Epoch 30/1000
100/100 [==============================] - 0s - loss: 0.0193 - acc: 1.0000     
Epoch 31/1000
100/100 [==============================] - 0s - loss: 0.0187 - acc: 1.0000     
Epoch 32/1000
100/100 [==============================] - 0s - loss: 0.0181 - acc: 1.0000     
Epoch 33/1000
100/100 [==============================] - 0s - loss: 0.0176 - acc: 1.0000     
Epoch 34/1000
100/100 [==============================] - 0s - loss: 0.0170 - acc: 1.0000     
Epoch 35/1000
100/100 [==============================] - 0s - loss: 0.0165 - acc: 1.0000     
Epoch 36/1000
100/100 [==============================] - 0s - loss: 0.0160 - acc: 1.0000     
Epoch 37/1000
100/100 [==============================] - 0s - loss: 0.0155 - acc: 1.0000     
Epoch 38/1000
100/100 [==============================] - 0s - loss: 0.0150 - acc: 1.0000     
Epoch 39/1000
100/100 [==============================] - 0s - loss: 0.0146 - acc: 1.0000     
Epoch 40/1000
100/100 [==============================] - 0s - loss: 0.0142 - acc: 1.0000     
Epoch 41/1000
100/100 [==============================] - 0s - loss: 0.0138 - acc: 1.0000     
Epoch 42/1000
100/100 [==============================] - 0s - loss: 0.0134 - acc: 1.0000     
Epoch 43/1000
100/100 [==============================] - 0s - loss: 0.0131 - acc: 1.0000     
Epoch 44/1000
100/100 [==============================] - 0s - loss: 0.0127 - acc: 1.0000     
Epoch 45/1000
100/100 [==============================] - 0s - loss: 0.0124 - acc: 1.0000     
Epoch 46/1000
100/100 [==============================] - 0s - loss: 0.0121 - acc: 1.0000     
Epoch 47/1000
100/100 [==============================] - 0s - loss: 0.0118 - acc: 1.0000     
Epoch 48/1000
100/100 [==============================] - 0s - loss: 0.0115 - acc: 1.0000     
Epoch 49/1000
100/100 [==============================] - 0s - loss: 0.0113 - acc: 1.0000     
Epoch 50/1000
100/100 [==============================] - 0s - loss: 0.0110 - acc: 1.0000     
Epoch 51/1000
100/100 [==============================] - 0s - loss: 0.0108 - acc: 1.0000     
Epoch 52/1000
100/100 [==============================] - 0s - loss: 0.0106 - acc: 1.0000     
Epoch 53/1000
100/100 [==============================] - 0s - loss: 0.0104 - acc: 1.0000     
Epoch 54/1000
100/100 [==============================] - 0s - loss: 0.0101 - acc: 1.0000     
Epoch 55/1000
100/100 [==============================] - 0s - loss: 0.0099 - acc: 1.0000     
Epoch 56/1000
100/100 [==============================] - 0s - loss: 0.0097 - acc: 1.0000     
Epoch 57/1000
100/100 [==============================] - 0s - loss: 0.0096 - acc: 1.0000     
Epoch 58/1000
100/100 [==============================] - 0s - loss: 0.0094 - acc: 1.0000     
Epoch 59/1000
100/100 [==============================] - 0s - loss: 0.0092 - acc: 1.0000     
Epoch 60/1000
100/100 [==============================] - 0s - loss: 0.0091 - acc: 1.0000     
Epoch 61/1000
100/100 [==============================] - 0s - loss: 0.0089 - acc: 1.0000     
Epoch 62/1000
100/100 [==============================] - 0s - loss: 0.0088 - acc: 1.0000     
Epoch 63/1000
100/100 [==============================] - 0s - loss: 0.0086 - acc: 1.0000     
Epoch 64/1000
100/100 [==============================] - 0s - loss: 0.0085 - acc: 1.0000     
Epoch 65/1000
100/100 [==============================] - 0s - loss: 0.0084 - acc: 1.0000     
Epoch 66/1000
100/100 [==============================] - 0s - loss: 0.0082 - acc: 1.0000     
Epoch 67/1000
100/100 [==============================] - 0s - loss: 0.0081 - acc: 1.0000     
Epoch 68/1000
100/100 [==============================] - 0s - loss: 0.0080 - acc: 1.0000     
Epoch 69/1000
100/100 [==============================] - 0s - loss: 0.0079 - acc: 1.0000     
Epoch 70/1000
100/100 [==============================] - 0s - loss: 0.0078 - acc: 1.0000     
Epoch 71/1000
100/100 [==============================] - 0s - loss: 0.0077 - acc: 1.0000     
Epoch 72/1000
100/100 [==============================] - 0s - loss: 0.0076 - acc: 1.0000     
Epoch 73/1000
100/100 [==============================] - 0s - loss: 0.0075 - acc: 1.0000     
Epoch 74/1000
100/100 [==============================] - 0s - loss: 0.0074 - acc: 1.0000     
Epoch 75/1000
100/100 [==============================] - 0s - loss: 0.0073 - acc: 1.0000     
Epoch 76/1000
100/100 [==============================] - 0s - loss: 0.0072 - acc: 1.0000     
Epoch 77/1000
100/100 [==============================] - 0s - loss: 0.0071 - acc: 1.0000     
Epoch 78/1000
100/100 [==============================] - 0s - loss: 0.0070 - acc: 1.0000     
Epoch 79/1000
100/100 [==============================] - 0s - loss: 0.0069 - acc: 1.0000     
Epoch 80/1000
100/100 [==============================] - 0s - loss: 0.0068 - acc: 1.0000     
Epoch 81/1000
100/100 [==============================] - 0s - loss: 0.0067 - acc: 1.0000     
Epoch 82/1000
100/100 [==============================] - 0s - loss: 0.0067 - acc: 1.0000     
Epoch 83/1000
100/100 [==============================] - 0s - loss: 0.0066 - acc: 1.0000     
Epoch 84/1000
100/100 [==============================] - 0s - loss: 0.0065 - acc: 1.0000     
Epoch 85/1000
100/100 [==============================] - 0s - loss: 0.0064 - acc: 1.0000     
Epoch 86/1000
100/100 [==============================] - 0s - loss: 0.0063 - acc: 1.0000     
Epoch 87/1000
100/100 [==============================] - 0s - loss: 0.0063 - acc: 1.0000     
Epoch 88/1000
100/100 [==============================] - 0s - loss: 0.0062 - acc: 1.0000     
Epoch 89/1000
100/100 [==============================] - 0s - loss: 0.0061 - acc: 1.0000     
Epoch 90/1000
100/100 [==============================] - 0s - loss: 0.0060 - acc: 1.0000     
Epoch 91/1000
100/100 [==============================] - 0s - loss: 0.0060 - acc: 1.0000     
Epoch 92/1000
100/100 [==============================] - 0s - loss: 0.0059 - acc: 1.0000     
Epoch 93/1000
100/100 [==============================] - 0s - loss: 0.0058 - acc: 1.0000     
Epoch 94/1000
100/100 [==============================] - 0s - loss: 0.0057 - acc: 1.0000     
Epoch 95/1000
100/100 [==============================] - 0s - loss: 0.0057 - acc: 1.0000     
Epoch 96/1000
100/100 [==============================] - 0s - loss: 0.0056 - acc: 1.0000     
Epoch 97/1000
100/100 [==============================] - 0s - loss: 0.0055 - acc: 1.0000     
Epoch 98/1000
100/100 [==============================] - 0s - loss: 0.0054 - acc: 1.0000     
Epoch 99/1000
100/100 [==============================] - 0s - loss: 0.0054 - acc: 1.0000     
Epoch 100/1000
100/100 [==============================] - 0s - loss: 0.0053 - acc: 1.0000     
Epoch 101/1000
100/100 [==============================] - 0s - loss: 0.0052 - acc: 1.0000     
Epoch 102/1000
100/100 [==============================] - 0s - loss: 0.0052 - acc: 1.0000     
Epoch 103/1000
100/100 [==============================] - 0s - loss: 0.0051 - acc: 1.0000     
Epoch 104/1000
100/100 [==============================] - 0s - loss: 0.0051 - acc: 1.0000     
Epoch 105/1000
100/100 [==============================] - 0s - loss: 0.0050 - acc: 1.0000     
Epoch 106/1000
100/100 [==============================] - 0s - loss: 0.0050 - acc: 1.0000     
Epoch 107/1000
100/100 [==============================] - 0s - loss: 0.0049 - acc: 1.0000     
Epoch 108/1000
100/100 [==============================] - 0s - loss: 0.0049 - acc: 1.0000     
Epoch 109/1000
100/100 [==============================] - 0s - loss: 0.0048 - acc: 1.0000     
Epoch 110/1000
100/100 [==============================] - 0s - loss: 0.0048 - acc: 1.0000     
Epoch 111/1000
100/100 [==============================] - 0s - loss: 0.0047 - acc: 1.0000     
Epoch 112/1000
100/100 [==============================] - 0s - loss: 0.0047 - acc: 1.0000     
Epoch 113/1000
100/100 [==============================] - 0s - loss: 0.0047 - acc: 1.0000     
Epoch 114/1000
100/100 [==============================] - 0s - loss: 0.0046 - acc: 1.0000     
Epoch 115/1000
100/100 [==============================] - 0s - loss: 0.0046 - acc: 1.0000     
Epoch 116/1000
100/100 [==============================] - 0s - loss: 0.0045 - acc: 1.0000     
Epoch 117/1000
100/100 [==============================] - 0s - loss: 0.0045 - acc: 1.0000     
Epoch 118/1000
100/100 [==============================] - 0s - loss: 0.0045 - acc: 1.0000     
Epoch 119/1000
100/100 [==============================] - 0s - loss: 0.0044 - acc: 1.0000     
Epoch 120/1000
100/100 [==============================] - 0s - loss: 0.0044 - acc: 1.0000     
Epoch 121/1000
100/100 [==============================] - 0s - loss: 0.0044 - acc: 1.0000     
Epoch 122/1000
100/100 [==============================] - 0s - loss: 0.0043 - acc: 1.0000     
Epoch 123/1000
100/100 [==============================] - 0s - loss: 0.0043 - acc: 1.0000     
Epoch 124/1000
100/100 [==============================] - 0s - loss: 0.0043 - acc: 1.0000     
Epoch 125/1000
100/100 [==============================] - 0s - loss: 0.0042 - acc: 1.0000     
Epoch 126/1000
100/100 [==============================] - 0s - loss: 0.0042 - acc: 1.0000     
Epoch 127/1000
100/100 [==============================] - 0s - loss: 0.0042 - acc: 1.0000     
Epoch 128/1000
100/100 [==============================] - 0s - loss: 0.0041 - acc: 1.0000     
Epoch 129/1000
100/100 [==============================] - 0s - loss: 0.0041 - acc: 1.0000     
Epoch 130/1000
100/100 [==============================] - 0s - loss: 0.0041 - acc: 1.0000     
Epoch 131/1000
100/100 [==============================] - 0s - loss: 0.0040 - acc: 1.0000     
Epoch 132/1000
100/100 [==============================] - 0s - loss: 0.0040 - acc: 1.0000     
Epoch 133/1000
100/100 [==============================] - 0s - loss: 0.0040 - acc: 1.0000     
Epoch 134/1000
100/100 [==============================] - 0s - loss: 0.0039 - acc: 1.0000     
Epoch 135/1000
100/100 [==============================] - 0s - loss: 0.0039 - acc: 1.0000     
Epoch 136/1000
100/100 [==============================] - 0s - loss: 0.0039 - acc: 1.0000     
Epoch 137/1000
100/100 [==============================] - 0s - loss: 0.0039 - acc: 1.0000     
Epoch 138/1000
100/100 [==============================] - 0s - loss: 0.0038 - acc: 1.0000     
Epoch 139/1000
100/100 [==============================] - 0s - loss: 0.0038 - acc: 1.0000     
Epoch 140/1000
100/100 [==============================] - 0s - loss: 0.0038 - acc: 1.0000     
Epoch 141/1000
100/100 [==============================] - 0s - loss: 0.0038 - acc: 1.0000     
Epoch 142/1000
100/100 [==============================] - 0s - loss: 0.0037 - acc: 1.0000     
Epoch 143/1000
100/100 [==============================] - 0s - loss: 0.0037 - acc: 1.0000     
Epoch 144/1000
100/100 [==============================] - 0s - loss: 0.0037 - acc: 1.0000     
Epoch 145/1000
100/100 [==============================] - 0s - loss: 0.0037 - acc: 1.0000     
Epoch 146/1000
100/100 [==============================] - 0s - loss: 0.0036 - acc: 1.0000     
Epoch 147/1000
100/100 [==============================] - 0s - loss: 0.0036 - acc: 1.0000     
Epoch 148/1000
100/100 [==============================] - 0s - loss: 0.0036 - acc: 1.0000     
Epoch 149/1000
100/100 [==============================] - 0s - loss: 0.0036 - acc: 1.0000     
Epoch 150/1000
100/100 [==============================] - 0s - loss: 0.0035 - acc: 1.0000     
Epoch 151/1000
100/100 [==============================] - 0s - loss: 0.0035 - acc: 1.0000     
Epoch 152/1000
100/100 [==============================] - 0s - loss: 0.0035 - acc: 1.0000     
Epoch 153/1000
100/100 [==============================] - 0s - loss: 0.0035 - acc: 1.0000     
Epoch 154/1000
100/100 [==============================] - 0s - loss: 0.0035 - acc: 1.0000     
Epoch 155/1000
100/100 [==============================] - 0s - loss: 0.0034 - acc: 1.0000     
Epoch 156/1000
100/100 [==============================] - 0s - loss: 0.0034 - acc: 1.0000     
Epoch 157/1000
100/100 [==============================] - 0s - loss: 0.0034 - acc: 1.0000     
Epoch 158/1000
100/100 [==============================] - 0s - loss: 0.0034 - acc: 1.0000     
Epoch 159/1000
100/100 [==============================] - 0s - loss: 0.0034 - acc: 1.0000     
Epoch 160/1000
100/100 [==============================] - 0s - loss: 0.0033 - acc: 1.0000     
Epoch 161/1000
100/100 [==============================] - 0s - loss: 0.0033 - acc: 1.0000     
Epoch 162/1000
100/100 [==============================] - 0s - loss: 0.0033 - acc: 1.0000     
Epoch 163/1000
100/100 [==============================] - 0s - loss: 0.0033 - acc: 1.0000     
Epoch 164/1000
100/100 [==============================] - 0s - loss: 0.0033 - acc: 1.0000     
Epoch 165/1000
100/100 [==============================] - 0s - loss: 0.0032 - acc: 1.0000     
Epoch 166/1000
100/100 [==============================] - 0s - loss: 0.0032 - acc: 1.0000     
Epoch 167/1000
100/100 [==============================] - 0s - loss: 0.0032 - acc: 1.0000     
Epoch 168/1000
100/100 [==============================] - 0s - loss: 0.0032 - acc: 1.0000     
Epoch 169/1000
100/100 [==============================] - 0s - loss: 0.0032 - acc: 1.0000     
Epoch 170/1000
100/100 [==============================] - 0s - loss: 0.0031 - acc: 1.0000     
Epoch 171/1000
100/100 [==============================] - 0s - loss: 0.0031 - acc: 1.0000     
Epoch 172/1000
100/100 [==============================] - 0s - loss: 0.0031 - acc: 1.0000     
Epoch 173/1000
100/100 [==============================] - 0s - loss: 0.0031 - acc: 1.0000     
Epoch 174/1000
100/100 [==============================] - 0s - loss: 0.0031 - acc: 1.0000     
Epoch 175/1000
100/100 [==============================] - 0s - loss: 0.0031 - acc: 1.0000     
Epoch 176/1000
100/100 [==============================] - 0s - loss: 0.0030 - acc: 1.0000     
Epoch 177/1000
100/100 [==============================] - 0s - loss: 0.0030 - acc: 1.0000     
Epoch 178/1000
100/100 [==============================] - 0s - loss: 0.0030 - acc: 1.0000     
Epoch 179/1000
100/100 [==============================] - 0s - loss: 0.0030 - acc: 1.0000     
Epoch 180/1000
100/100 [==============================] - 0s - loss: 0.0030 - acc: 1.0000     
Epoch 181/1000
100/100 [==============================] - 0s - loss: 0.0030 - acc: 1.0000     
Epoch 182/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 183/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 184/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 185/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 186/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 187/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 188/1000
100/100 [==============================] - 0s - loss: 0.0029 - acc: 1.0000     
Epoch 189/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 190/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 191/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 192/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 193/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 194/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 195/1000
100/100 [==============================] - 0s - loss: 0.0028 - acc: 1.0000     
Epoch 196/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 197/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 198/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 199/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 200/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 201/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 202/1000
100/100 [==============================] - 0s - loss: 0.0027 - acc: 1.0000     
Epoch 203/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 204/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 205/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 206/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 207/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 208/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 209/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 210/1000
100/100 [==============================] - 0s - loss: 0.0026 - acc: 1.0000     
Epoch 211/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 212/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 213/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 214/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 215/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 216/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 217/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 218/1000
100/100 [==============================] - 0s - loss: 0.0025 - acc: 1.0000     
Epoch 219/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 220/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 221/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 222/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 223/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 224/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 225/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 226/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 227/1000
100/100 [==============================] - 0s - loss: 0.0024 - acc: 1.0000     
Epoch 228/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 229/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 230/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 231/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 232/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 233/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 234/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 235/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 236/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 237/1000
100/100 [==============================] - 0s - loss: 0.0023 - acc: 1.0000     
Epoch 238/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 239/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 240/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 241/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 242/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 243/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 244/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 245/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 246/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 247/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 248/1000
100/100 [==============================] - 0s - loss: 0.0022 - acc: 1.0000     
Epoch 249/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 250/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 251/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 252/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 253/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 254/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 255/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 256/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 257/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 258/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 259/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 260/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 261/1000
100/100 [==============================] - 0s - loss: 0.0021 - acc: 1.0000     
Epoch 262/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 263/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 264/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 265/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 266/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 267/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 268/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 269/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 270/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 271/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 272/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 273/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 274/1000
100/100 [==============================] - 0s - loss: 0.0020 - acc: 1.0000     
Epoch 275/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 276/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 277/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 278/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 279/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 280/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 281/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 282/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 283/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 284/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 285/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 286/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 287/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 288/1000
100/100 [==============================] - 0s - loss: 0.0019 - acc: 1.0000     
Epoch 289/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 290/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 291/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 292/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 293/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 294/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 295/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 296/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 297/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 298/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 299/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 300/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 301/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 302/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 303/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 304/1000
100/100 [==============================] - 0s - loss: 0.0018 - acc: 1.0000     
Epoch 305/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 306/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 307/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 308/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 309/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 310/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 311/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 312/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 313/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 314/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 315/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 316/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 317/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 318/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 319/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 320/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 321/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 322/1000
100/100 [==============================] - 0s - loss: 0.0017 - acc: 1.0000     
Epoch 323/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 324/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 325/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 326/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 327/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 328/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 329/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 330/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 331/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 332/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 333/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 334/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 335/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 336/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 337/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 338/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 339/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 340/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 341/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 342/1000
100/100 [==============================] - 0s - loss: 0.0016 - acc: 1.0000     
Epoch 343/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 344/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 345/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 346/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 347/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 348/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 349/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 350/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 351/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 352/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 353/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 354/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 355/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 356/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 357/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 358/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 359/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 360/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 361/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 362/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 363/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 364/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 365/1000
100/100 [==============================] - 0s - loss: 0.0015 - acc: 1.0000     
Epoch 366/1000
100/100 [==============================] - 0s - loss: 0.0014 - acc: 1.0000     
Epoch 367/1000
100/100 [==============================] - 0s - loss: 0.0014 - acc: 1.0000     
Epoch 368/1000
100/100 [==============================] - 0s - loss: 0.0014 - acc: 1.0000     
Epoch 369/1000
100/100 [==============================] - 0s - loss: 0.0014 - acc: 1.0000     
Epoch 370/1000
 20/100 [=====>........................] - ETA: 0s - loss: 0.0015 - acc: 1.0000
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-16-eadc97f0b5d2> in <module>()
      1 
----> 2 model.fit(X_train, Y_train, nb_epoch=1000, batch_size=20)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/models.pyc in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, **kwargs)
    427                               shuffle=shuffle,
    428                               class_weight=class_weight,
--> 429                               sample_weight=sample_weight)
    430 
    431     def evaluate(self, x, y, batch_size=32, verbose=1,

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/engine/training.pyc in fit(self, x, y, batch_size, nb_epoch, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight)
   1106                               verbose=verbose, callbacks=callbacks,
   1107                               val_f=val_f, val_ins=val_ins, shuffle=shuffle,
-> 1108                               callback_metrics=callback_metrics)
   1109 
   1110     def evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None):

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/engine/training.pyc in _fit_loop(self, f, ins, out_labels, batch_size, nb_epoch, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics)
    844                         for l, o in zip(out_labels, val_outs):
    845                             epoch_logs['val_' + l] = o
--> 846             callbacks.on_epoch_end(epoch, epoch_logs)
    847             if callback_model.stop_training:
    848                 break

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/callbacks.pyc in on_epoch_end(self, epoch, logs)
     37     def on_epoch_end(self, epoch, logs={}):
     38         for callback in self.callbacks:
---> 39             callback.on_epoch_end(epoch, logs)
     40 
     41     def on_batch_begin(self, batch, logs={}):

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/callbacks.pyc in on_epoch_end(self, epoch, logs)
    193                 self.log_values.append((k, logs[k]))
    194         if self.verbose:
--> 195             self.progbar.update(self.seen, self.log_values, force=True)
    196 
    197 

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/keras/utils/generic_utils.pyc in update(self, current, values, force)
     73 
     74             prev_total_width = self.total_width
---> 75             sys.stdout.write("\b" * prev_total_width)
     76             sys.stdout.write("\r")
     77 

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ipykernel/iostream.pyc in write(self, string)
    213                 string = string.decode(self.encoding, 'replace')
    214 
--> 215             is_child = (self._check_mp_mode() == CHILD)
    216             self._buffer.write(string)
    217             if is_child:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ipykernel/iostream.pyc in _check_mp_mode(self)
    102     def _check_mp_mode(self):
    103         """check for forks, and switch to zmq pipeline if necessary"""
--> 104         if not self._pipe_flag or self._is_master_process():
    105             return MASTER
    106         else:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ipykernel/iostream.pyc in _is_master_process(self)
     92 
     93     def _is_master_process(self):
---> 94         return os.getpid() == self._master_pid
     95 
     96     def _is_master_thread(self):

KeyboardInterrupt: 

In [ ]: