src/model/supervised/lstm.py
def predict_single(self, observation):
        """ Predict the action of a single observation

        Args:
            observation: (num_stocks + 1, window_length)

        Returns: a single action array with shape (num_stocks + 1,)

        """
        action = np.zeros((self.num_classes,))
        obsX = observation[:, -self.window_length:, 3] / observation[:, -self.window_length:, 0]
        obsX = normalize(obsX)
        obsX = np.expand_dims(obsX, axis=0)
        with self.graph.as_default():
            current_action_index = self.model.predict_classes(obsX, verbose=False)
        action[current_action_index] = 1.0
        return action
 Predict the action of a single observation

        Args:
            observation: (num_stocks + 1, window_length)

        Returns: a single action array with shape (num_stocks + 1,)

        
Predict the action of a single observation
Predict the action of a single observation
def predict_single(self, observation):
        action = np.zeros((self.num_classes,))
        obsX = observation[:, -self.window_length:, 3] / observation[:, -self.window_length:, 0]
        obsX = normalize(obsX)
        obsX = np.expand_dims(obsX, axis=0)
        with self.graph.as_default():
            current_action_index = self.model.predict_classes(obsX, verbose=False)
        action[current_action_index] = 1.0
        return action
def predict_single ( self , observation ) : action = np . zeros ( ( self . num_classes , ) ) obsX = observation [ : , - self . window_length : , 3 ] / observation [ : , - self . window_length : , 0 ] obsX = normalize ( obsX ) obsX = np . expand_dims ( obsX , axis = 0 ) with self . graph . as_default ( ) : current_action_index = self . model . predict_classes ( obsX , verbose = False ) action [ current_action_index ] = 1.0 return action
Predict the action of a single observation
Predict the action of a single observation
""" Predict the action of a single observation

        Args:
            observation: (num_stocks + 1, window_length)

        Returns: a single action array with shape (num_stocks + 1,)

        """
self
observation
(num_stocks + 1, window_length)
( num_stocks + 1 window_length )