(self)
simple run
simple run
simple run
def simple_run(self):
        """
            simple run
        """
        print("Simple run target is 20")
        mid = 0
        shadow = 0
        is_first = True
        while mid <= self.num_models:
            actions_to, actions_ad = self.autodl_agent.sample()
            rewards = np.count_nonzero(actions_to == 1, axis=1).astype("int32")
            # moving average
            current_mean_reward = np.mean(rewards)
            if is_first:
                shadow = current_mean_reward
                is_first = False
            else:
                shadow = shadow * self.bl_decay \
                        + current_mean_reward * (1 - self.bl_decay)
            self.autodl_agent.learn((np.array(actions_to).astype("int32"),
                                    np.array(actions_ad).astype("int32")),
                                    rewards - shadow)

            if mid % 10 == 0:
                print('mid=%d, average rewards=%.3f' % (mid, np.mean(rewards)))
            mid += 1
def simple_run ( self ) : print ( "Simple run target is 20" ) mid = 0 shadow = 0 is_first = True while mid <= self . num_models : actions_to , actions_ad = self . autodl_agent . sample ( ) rewards = np . count_nonzero ( actions_to == 1 , axis = 1 ) . astype ( "int32" ) # moving average current_mean_reward = np . mean ( rewards ) if is_first : shadow = current_mean_reward is_first = False else : shadow = shadow * self . bl_decay + current_mean_reward * ( 1 - self . bl_decay ) self . autodl_agent . learn ( ( np . array ( actions_to ) . astype ( "int32" ) , np . array ( actions_ad ) . astype ( "int32" ) ) , rewards - shadow ) if mid % 10 == 0 : print ( 'mid=%d, average rewards=%.3f' % ( mid , np . mean ( rewards ) ) ) mid += 1