softqlearning/softqlearning/algorithms/rl_algorithm.py
def _evaluate(self, policy, evaluation_env):
        """Perform evaluation for the current policy."""

        if self._eval_n_episodes < 1:
            return

        # TODO: max_path_length should be a property of environment.
        paths = rollouts(evaluation_env, policy, self.sampler._max_path_length,
                         self._eval_n_episodes)

        total_returns = [path['rewards'].sum() for path in paths]
        episode_lengths = [len(p['rewards']) for p in paths]

        logger.record_tabular('return-average', np.mean(total_returns))
        logger.record_tabular('return-min', np.min(total_returns))
        logger.record_tabular('return-max', np.max(total_returns))
        logger.record_tabular('return-std', np.std(total_returns))
        logger.record_tabular('episode-length-avg', np.mean(episode_lengths))
        logger.record_tabular('episode-length-min', np.min(episode_lengths))
        logger.record_tabular('episode-length-max', np.max(episode_lengths))
        logger.record_tabular('episode-length-std', np.std(episode_lengths))

        evaluation_env.log_diagnostics(paths)
        if self._eval_render:
            evaluation_env.render(paths)

        if self.sampler.batch_ready():
            batch = self.sampler.random_batch()
            self.log_diagnostics(batch)
Perform evaluation for the current policy.
Perform evaluation for the current policy.
Perform evaluation for the current policy .
def _evaluate(self, policy, evaluation_env):
        if self._eval_n_episodes < 1:
            return
        paths = rollouts(evaluation_env, policy, self.sampler._max_path_length,
                         self._eval_n_episodes)
        total_returns = [path['rewards'].sum() for path in paths]
        episode_lengths = [len(p['rewards']) for p in paths]
        logger.record_tabular('return-average', np.mean(total_returns))
        logger.record_tabular('return-min', np.min(total_returns))
        logger.record_tabular('return-max', np.max(total_returns))
        logger.record_tabular('return-std', np.std(total_returns))
        logger.record_tabular('episode-length-avg', np.mean(episode_lengths))
        logger.record_tabular('episode-length-min', np.min(episode_lengths))
        logger.record_tabular('episode-length-max', np.max(episode_lengths))
        logger.record_tabular('episode-length-std', np.std(episode_lengths))
        evaluation_env.log_diagnostics(paths)
        if self._eval_render:
            evaluation_env.render(paths)
        if self.sampler.batch_ready():
            batch = self.sampler.random_batch()
            self.log_diagnostics(batch)
def _evaluate ( self , policy , evaluation_env ) : if self . _eval_n_episodes < 1 : return paths = rollouts ( evaluation_env , policy , self . sampler . _max_path_length , self . _eval_n_episodes ) total_returns = [ path [ 'rewards' ] . sum ( ) for path in paths ] episode_lengths = [ len ( p [ 'rewards' ] ) for p in paths ] logger . record_tabular ( 'return-average' , np . mean ( total_returns ) ) logger . record_tabular ( 'return-min' , np . min ( total_returns ) ) logger . record_tabular ( 'return-max' , np . max ( total_returns ) ) logger . record_tabular ( 'return-std' , np . std ( total_returns ) ) logger . record_tabular ( 'episode-length-avg' , np . mean ( episode_lengths ) ) logger . record_tabular ( 'episode-length-min' , np . min ( episode_lengths ) ) logger . record_tabular ( 'episode-length-max' , np . max ( episode_lengths ) ) logger . record_tabular ( 'episode-length-std' , np . std ( episode_lengths ) ) evaluation_env . log_diagnostics ( paths ) if self . _eval_render : evaluation_env . render ( paths ) if self . sampler . batch_ready ( ) : batch = self . sampler . random_batch ( ) self . log_diagnostics ( batch )
Perform evaluation for the current policy.
Perform evaluation for the current policy .
"""Perform evaluation for the current policy.""" # TODO: max_path_length should be a property of environment.
self
policy
evaluation_env