title: How to print output of training data in a keras model?
body: <p>What I'm doing is training a model with a dataset containing 318 rows and 6 attributes.7th is the target output(only 1 or 0) .I just want the model to print 1 or 0 i.e output of the model. I have trained the model as shown in the code below and got accuracy of 90%. But I couldn't figure out how to get those output values for each of the training data. Is there any way to print or generate a new csv file containing the predicted output for the training data? 
  For e.g.:
  Target(7th attribute): 1 0 0 Predicted(model output): 1 0 1
  Help would be great.Thanks!</p>
  
  <pre><code>from keras.models import Sequential
  from keras.layers import Dense, Dropout
  from sklearn.model_selection import train_test_split
  import numpy
  
  # random seed for reproducibility
  numpy.random.seed(2)
  
  # loading heart dataset
  dataset = numpy.loadtxt("heartorig1.csv", delimiter=",")
  
  # split into input (X) and output (Y) variables, splitting csv data
  X = dataset[:,0:6]
  Y = dataset[:,6]
  
  # split X, Y into a train and test set
  x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.2,       random_state=42)
  
  # create model, add dense layers one by one specifying activation function
  model = Sequential()
  model.add(Dense(10, input_dim=6, activation='relu')) # input layer requires       input_dim param
  model.add(Dense(8, activation='relu'))
  model.add(Dense(6, activation='relu'))
  model.add(Dropout(.2))
  model.add(Dense(1, activation='sigmoid')) # sigmoid instead of relu for final probability between 0 and 1
  
  # compile the model, adam gradient descent (optimized)
  model.compile(loss="binary_crossentropy", optimizer="adam", metrics=['accuracy'])
  
  # call the function to fit to the data (training the network)
  model.fit(x_train, y_train, epochs = 1000, batch_size=20, validation_data=(x_test, y_test))
  
  
  # save the model
  model.save('weights2.h5')
  </code></pre>