title: python keras neural network prediction not working (outputs 0 or 1)
body: <p>I have created with keras a neural network for predicting addition.
  I have 2 inputs and 1 output (result of adding the 2 inputs).</p>
  
  <p>I trained my neural network with tensorflow and then I tried to predict addition but the program returns <code>0</code> or <code>1</code> value not <code>3,4,5,etc</code>.</p>
  
  <p>This is my code :</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense
  import numpy
  # fix random seed for reproducibility
  seed = 7
  numpy.random.seed(seed)
  # load dataset
  dataset = numpy.loadtxt("data.csv", delimiter=",")
  # split into input (X) and output (Y) variables
  X = dataset[:,0:2]
  Y = dataset[:,2]
  # create model
  model = Sequential()
  model.add(Dense(12, input_dim=2, init='uniform', activation='relu'))
  model.add(Dense(2, init='uniform', activation='relu'))
  model.add(Dense(1, init='uniform', activation='sigmoid'))
  # Compile model
  model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  # Fit the model
  model.fit(X, Y, epochs=150, batch_size=10,  verbose=2)
  
  
  
  # calculate predictions
  predictions = model.predict(X)
  # round predictions
  rounded = [round(x[0]) for x in predictions]
  print(rounded)
  </code></pre>
  
  <p>And my file <code>data.csv</code>:</p>
  
  <pre><code>1,2,3
  3,3,6
  4,5,9
  10,8,18
  1,3,4
  5,3,8
  </code></pre>
  
  <p>For example:</p>
  
  <pre><code>1+2=3
  3+3=6
  4+5=9
  ...etc.
  </code></pre>
  
  <p>But I get this as output : <code>0,1,0,0,1,0,1...</code>
  Why didn't I get the output as <code>3,6,9...</code>?</p>
  
  <p>i updated code for use other loss function but i have same error :</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense
  import numpy
  # fix random seed for reproducibility
  seed = 7
  numpy.random.seed(seed)
  # load pima indians dataset
  dataset = numpy.loadtxt("data.csv", delimiter=",")
  # split into input (X) and output (Y) variables
  X = dataset[:,0:2]
  Y = dataset[:,2]
  # create model
  model = Sequential()
  model.add(Dense(12, input_dim=2, init='uniform', activation='relu'))
  model.add(Dense(2, init='uniform', activation='relu'))
  #model.add(Dense(1, init='uniform', activation='sigmoid'))
  model.add(Dense(1, input_dim=2, init='uniform', activation='linear'))
  
  # Compile model
  #model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy'])
  # Fit the model
  model.fit(X, Y, epochs=150, batch_size=10,  verbose=2)
  
  
  
  # calculate predictions
  predictions = model.predict(X)
  # round predictions
  rounded = [round(x[0]) for x in predictions]
  print(rounded)
  </code></pre>
  
  <p>outout=1,1,1,3,1,1,...etc</p>