def learn_q(self, predicted_q_arr, real_q_arr):
        '''
        Infernce Q-Value.
        
        Args:
            predicted_q_arr:    `np.ndarray` of predicted Q-Values.
            real_q_arr:         `np.ndarray` of real Q-Values.
        '''
        self.__predicted_q_arr_list.append(predicted_q_arr)
        while len(self.__predicted_q_arr_list) > self.__seq_len:
            self.__predicted_q_arr_list = self.__predicted_q_arr_list[1:]
        while len(self.__predicted_q_arr_list) < self.__seq_len:
            self.__predicted_q_arr_list.append(self.__predicted_q_arr_list[-1])
        predicted_q_arr = np.array(self.__predicted_q_arr_list)
        predicted_q_arr = predicted_q_arr.transpose((1, 0, 2))

        self.__real_q_arr_list.append(real_q_arr)
        while len(self.__real_q_arr_list) > self.__seq_len:
            self.__real_q_arr_list = self.__real_q_arr_list[1:]
        while len(self.__real_q_arr_list) < self.__seq_len:
            self.__real_q_arr_list.append(self.__real_q_arr_list[-1])
        real_q_arr = np.array(self.__real_q_arr_list)
        real_q_arr = real_q_arr.transpose((1, 0, 2))

        loss = self.__computable_loss.compute_loss(predicted_q_arr, real_q_arr)
        delta_arr = self.__computable_loss.compute_delta(predicted_q_arr, real_q_arr)

        delta_arr, lstm_output_grads_list = self.__lstm_model.output_back_propagate(
            predicted_q_arr,
            delta_arr
        )
        delta_arr, _, lstm_hidden_grads_list = self.__lstm_model.hidden_back_propagate(
            delta_arr[:, -1]
        )
        lstm_grads_list = lstm_output_grads_list
        lstm_grads_list.extend(lstm_hidden_grads_list)
        self.__lstm_model.optimize(lstm_grads_list, self.__learning_rate, 1)
        self.__loss_list.append(loss)
def learn_q ( self , predicted_q_arr , real_q_arr ) : self . __predicted_q_arr_list . append ( predicted_q_arr ) while len ( self . __predicted_q_arr_list ) > self . __seq_len : self . __predicted_q_arr_list = self . __predicted_q_arr_list [ 1 : ] while len ( self . __predicted_q_arr_list ) < self . __seq_len : self . __predicted_q_arr_list . append ( self . __predicted_q_arr_list [ - 1 ] ) predicted_q_arr = np . array ( self . __predicted_q_arr_list ) predicted_q_arr = predicted_q_arr . transpose ( ( 1 , 0 , 2 ) ) self . __real_q_arr_list . append ( real_q_arr ) while len ( self . __real_q_arr_list ) > self . __seq_len : self . __real_q_arr_list = self . __real_q_arr_list [ 1 : ] while len ( self . __real_q_arr_list ) < self . __seq_len : self . __real_q_arr_list . append ( self . __real_q_arr_list [ - 1 ] ) real_q_arr = np . array ( self . __real_q_arr_list ) real_q_arr = real_q_arr . transpose ( ( 1 , 0 , 2 ) ) loss = self . __computable_loss . compute_loss ( predicted_q_arr , real_q_arr ) delta_arr = self . __computable_loss . compute_delta ( predicted_q_arr , real_q_arr ) delta_arr , lstm_output_grads_list = self . __lstm_model . output_back_propagate ( predicted_q_arr , delta_arr ) delta_arr , _ , lstm_hidden_grads_list = self . __lstm_model . hidden_back_propagate ( delta_arr [ : , - 1 ] ) lstm_grads_list = lstm_output_grads_list lstm_grads_list . extend ( lstm_hidden_grads_list ) self . __lstm_model . optimize ( lstm_grads_list , self . __learning_rate , 1 ) self . __loss_list . append ( loss )
Infernce Q-Value.
        
        Args:
            predicted_q_arr:    `np.ndarray` of predicted Q-Values.
            real_q_arr:         `np.ndarray` of real Q-Values.