title: Keras model predicting wrong values(accuracy: 0.0000e+00)
body: <p>Que the cliche "This is my first Keras project", but alas, this is the truth. I apologize for any cringe beginner mistakes in advance.</p>
  
  <p><strong>How is the data setup</strong></p>
  
  <p>Column A: We capture the time a given train is scheduled to depart in 24-hour time format.</p>
  
  <p>Column B: An integer representation of the given trains destination. EX California == 2, New York == 0</p>
  
  <p>Column C: The track assigned to the given train. </p>
  
  <p><a href="https://i.stack.imgur.com/VB5cP.png" rel="nofollow noreferrer">Screenshot of data setup</a> </p>
  
  <p><strong>GOAL</strong></p>
  
  <p>By using this data, can we predict the track number using the time and location.</p>
  
  <p><strong>Current Attempt</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code># multivariate one step problem
  from numpy import array
  from numpy import hstack
  from numpy import insert
  from numpy import zeros,newaxis
  from numpy import reshape
  from tensorflow.keras.models import Sequential
  from tensorflow.keras.layers import Dense
  from tensorflow.keras.layers import LSTM
  from tensorflow.keras.optimizers import Adam
  from tensorflow.keras.preprocessing.sequence import TimeseriesGenerator
  import pandas as pd
  
  
  file_name  = "DATA_DUMP.csv"
  destination = 0
  departure = 1622
  
  #extract values
  raw_data  = pd.read_csv(file_name)
  data   = raw_data
  
  in_seq1  = array([data['TIME'].values])
  in_seq2  = array([data['LOCATION'].values])
  result  = array([data['TRACK'][0:-1].values])
  
  # reshape series
  in_seq1  = in_seq1.reshape((in_seq1.shape[1],len(in_seq1)))
  in_seq2  = in_seq2.reshape((in_seq2.shape[1],len(in_seq2)))
  result  = result.reshape((result.shape[1],len(result)))
  
  dataset  = hstack((in_seq1, in_seq2))
  result  = insert(result,0,0)
  result  = result.reshape((len(result),1))
  
  # define generator
  n_features  = dataset.shape[1]
  n_input  = 1
  generator  = TimeseriesGenerator(dataset, result, length=n_input, batch_size=1)
  
  for i in range(len(generator)):
   x, y = generator[i]
   print('%s =&gt; %s' % (x, y))
  
  # define model
  model = Sequential()
  model.add(LSTM(100, activation='sigmoid', input_shape=(n_input, n_features)))
  model.add(Dense(1))
  model.compile(optimizer=Adam(lr=0.00001), loss='mse',metrics=['accuracy'])
  # fit model
  
  model.fit_generator(generator, steps_per_epoch=1, epochs=500, verbose=2)
  # make a one step prediction out of sample
  
  raw_array = array([1507,3]) #predict arrival at 15:07 destination 3, what track will it be?
  
  x_input = array(raw_array).reshape((1,n_input,n_features))
  
  yhat = model.predict(x_input, verbose=1)
  print(yhat)</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>The Problem</strong></p>
  
  <p>Although my code runs, I am getting <em>extremely</em> inaccurate predictions. I'm assuming this is due to my large loss. Any help in getting this model up and running would be greatly appreciated.</p>
  
  <p><code>Epoch 500/500
  1/1 - 0s - loss: 424.2032 - accuracy: 0.0000e+00</code></p>