0
$\begingroup$

I have a training dataset with 8000 rows, and I am trying to train a Keras Neural Network on it, using 100 epochs. However, the training process gets stuck around epoch 6 every time, as shown below. I'm not sure if it's because of my computer (8GB RAM Macbook Pro) or because of some inappropriately set parameters for my model. Thanks!

    import keras
    from keras.models import Sequential
    from keras.layers import Dense

    classifier = Sequential()

    classifier.add(Dense(activation="relu", input_dim=11, units=6, kernel_initializer="uniform"))

    classifier.add(Dense(activation="relu", units=6, kernel_initializer="uniform"))

    classifier.add(Dense(activation="sigmoid", units=1, kernel_initializer="uniform"))

    classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])

    classifier.fit(X_train, y_train, batch_size = 10, nb_epoch = 100)

8000/8000 [==============================] - 3s 348us/step - loss: 0.3890 - acc: 0.8367
Epoch 2/100
8000/8000 [==============================] - 3s 329us/step - loss: 0.3894 - acc: 0.8376
Epoch 3/100
8000/8000 [==============================] - 3s 314us/step - loss: 0.3887 - acc: 0.8370
Epoch 4/100
8000/8000 [==============================] - 3s 346us/step - loss: 0.3895 - acc: 0.8379
Epoch 5/100
8000/8000 [==============================] - 3s 320us/step - loss: 0.3887 - acc: 0.8370 - ETA: 2s - loss: 0.4087 - acc: 0.8077
Epoch 6/100
7650/8000 [===========================>..] - ETA: 0s - loss: 0.3881 - acc: 0.8363 
//STUCK HERE

I do get the following message on my terminal window though (even though I'm using jupyter notebook):

2017-12-24 20:45:30.464660: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.

$\endgroup$
5
  • $\begingroup$ does it stuck or exits the code and shows the message? $\endgroup$ Dec 24, 2017 at 13:37
  • $\begingroup$ @Media It just gets stuck. The message is shown on terminal as soon as I execute classifier.fit(X_train, y_train, batch_size = 10, nb_epoch = 100), then it will go up to around epoch 7 and get stuck and my computer fan starts whirring loudly $\endgroup$
    – Programmer
    Dec 24, 2017 at 14:21
  • 1
    $\begingroup$ I suggest you update your anaconda. I had a similar problem on my windows version of anaconda jupyter notebook. But the keras worked fine in my ubuntu. I updated it on windows and it didn't get stuck. $\endgroup$ Dec 24, 2017 at 14:33
  • $\begingroup$ @Media Thanks very much, that fixed it! Merry Christmas $\endgroup$
    – Programmer
    Dec 26, 2017 at 1:21
  • $\begingroup$ happy christmas $\endgroup$ Dec 26, 2017 at 5:17

1 Answer 1

1
$\begingroup$

I had a similar problem. I guess the reason is incompatibility of Keras with your current anaconda. Just update it.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.