title: keras MLP accuracy zero
body: <p>The following is my MLP model,</p>
  
  <pre><code>layers = [10,20,30,40,50]
  model = keras.models.Sequential()
  #Stacking Layers
  model.add(keras.layers.Dense(layers[0], input_dim = input_dim, activation='relu'))
  #Defining the shape of input
  for layer in layers[1:]:
      model.add(keras.layers.Dense(layer, activation='relu'))
      #Layer activation function
  # Output layer
  model.add(keras.layers.Dense(1, activation='sigmoid'))
  #Pre-training
  model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy'])
  #Training
  model.fit(train_set, test_set, validation_split = 0.10, epochs = 50, batch_size = 10, shuffle = True, verbose = 2)
  # evaluate the network
  loss, accuracy = model.evaluate(train_set, test_set)
  print("\nLoss: %.2f, Accuracy: %.2f%%" % (loss, accuracy*100))
  #predictions
  predt = model.predict(final_test)
  print(predt)
  </code></pre>
  
  <p>The problem is that, accuracy is always 0, error log as shown,</p>
  
  <pre><code>Epoch 48/50 - 0s - loss: 1.0578 - acc: 0.0000e+00 - val_loss: 0.4885 - val_acc: 0.0000e+00 
  Epoch 49/50 - 0s - loss: 1.0578 - acc: 0.0000e+00 - val_loss: 0.4885 - val_acc: 0.0000e+00 
  Epoch 50/50 - 0s - loss: 1.0578 - acc: 0.0000e+00 - val_loss: 0.4885 - val_acc: 0.0000e+00 
  2422/2422 [==============================] - 0s 17us/step
  </code></pre>
  
  <blockquote>
    <p>Loss: 1.00, Accuracy: 0.00%</p>
  </blockquote>
  
  <p>As suggested i've changed my learning signal from -1,1 to 0,1 and yet, the following is the error log</p>
  
  <pre><code>Epoch 48/50 - 0s - loss: 8.5879 - acc: 0.4672 - val_loss: 8.2912 - val_acc: 0.4856 
  Epoch 49/50 - 0s - loss: 8.5879 - acc: 0.4672 - val_loss: 8.2912 - val_acc: 0.4856 
  Epoch 50/50 - 0s - loss: 8.5879 - acc: 0.4672 - val_loss: 8.2912 - val_acc: 0.4856 
  2422/2422 [==============================] - 0s 19us/step
  </code></pre>