title: How to get a single value from model.predict() results
body: <p>I am trying to use a neural network to predict actions for a car simulator game that runs in another file. I need to get the value predicted for an action to pass into the game but i am struggling to do this. After calling model.predict i have attempted to access the value as if from an array but this returns an out of bounds error. </p>
  
  <p>I am fairly new to python in general, never mind using keras, but the idea i had is that the neural network would be trained on some data (saved in a CSV file) gathered by someone else playing the game. Then when it came time for the neural network to play, I would be able to pass in the game values at each frame to generate a predicted action. I <em>think</em> i have done that but am unable to get a predicted action. Here is neural network;</p>
  
  <pre><code>  def build_nn(self):
      model = Sequential()
      model.add(Dense(12, input_dim=8, activation='relu')) 
      model.add(Dense(8, activation='relu'))
      model.add(Dense(1, activation='linear'))
      model.compile(loss='mean_squared_error', optimizer=Adam(lr=self.learning_rate))
  
      return model
  </code></pre>
  
  <p>And my code for predicting the action (stateVector wasnt accepted as is, so I had to get the values from it)</p>
  
  <pre><code> def action(self, stateVector):
      a_action = stateVector['lastAction']
      currentLane = stateVector['currentLane']
      offRoad = stateVector['offRoad']
      collision = stateVector['collision']
      lane1 = stateVector['lane1Distance']
      lane2 = stateVector['lane2Distance']
      lane3 = stateVector['lane3Distance']
      a = [currentLane, offRoad, collision, lane1, lane2, lane3, reward, a_action]   
  
      act_value = self.model.predict(a)
      act = act_values[a_action]
  
      return act 
  </code></pre>