original_docstring: Runs the agent/environment loop until a desired number of steps.
  
      We follow the Machado et al., 2017 convention of running full episodes,
      and terminating once we've run a minimum number of steps.
  
      Args:
        min_steps: int, minimum number of steps to generate in this phase.
        statistics: `IterationStatistics` object which records the experimental
          results.
        run_mode_str: str, describes the run mode for this agent.
  
      Returns:
        Tuple containing the number of steps taken in this phase (int), the sum of
          returns (float), and the number of episodes performed (int).
      
docstring: Runs the agent/environment loop until a desired number of steps.
  We follow the Machado et al., 2017 convention of running full episodes,
  and terminating once we've run a minimum number of steps.
docstring_tokens: Runs the agent / environment loop until a desired number of steps . We follow the Machado et al . 2017 convention of running full episodes and terminating once we ' ve run a minimum number of steps .
code: def _run_one_phase(self, min_steps, statistics, run_mode_str):
      """Runs the agent/environment loop until a desired number of steps.
  
      We follow the Machado et al., 2017 convention of running full episodes,
      and terminating once we've run a minimum number of steps.
  
      Args:
        min_steps: int, minimum number of steps to generate in this phase.
        statistics: `IterationStatistics` object which records the experimental
          results.
        run_mode_str: str, describes the run mode for this agent.
  
      Returns:
        Tuple containing the number of steps taken in this phase (int), the sum of
          returns (float), and the number of episodes performed (int).
      """
      step_count = 0
      num_episodes = 0
      sum_returns = 0.
  
      while step_count < min_steps:
        episode_length, episode_return = self._run_one_episode()
        statistics.append({
            '{}_episode_lengths'.format(run_mode_str): episode_length,
            '{}_episode_returns'.format(run_mode_str): episode_return
        })
        step_count += episode_length
        sum_returns += episode_return
        num_episodes += 1
        # We use sys.stdout.write instead of tf.logging so as to flush frequently
        # without generating a line break.
        sys.stdout.write('Steps executed: {} '.format(step_count) +
                         'Episode length: {} '.format(episode_length) +
                         'Return: {}\r'.format(episode_return))
        sys.stdout.flush()
      return step_count, sum_returns, num_episodes
code_tokens: def _run_one_phase ( self , min_steps , statistics , run_mode_str ) : step_count = 0 num_episodes = 0 sum_returns = 0. while step_count < min_steps : episode_length , episode_return = self . _run_one_episode ( ) statistics . append ( { '{}_episode_lengths' . format ( run_mode_str ) : episode_length , '{}_episode_returns' . format ( run_mode_str ) : episode_return } ) step_count += episode_length sum_returns += episode_return num_episodes += 1 sys . stdout . write ( 'Steps executed: {} ' . format ( step_count ) + 'Episode length: {} ' . format ( episode_length ) + 'Return: {}\r' . format ( episode_return ) ) sys . stdout . flush ( ) return step_count , sum_returns , num_episodes
short_docstring: Runs the agent/environment loop until a desired number of steps.
short_docstring_tokens: Runs the agent / environment loop until a desired number of steps .
comment: """Runs the agent/environment loop until a desired number of steps.
  
      We follow the Machado et al., 2017 convention of running full episodes,
      and terminating once we've run a minimum number of steps.
  
      Args:
        min_steps: int, minimum number of steps to generate in this phase.
        statistics: `IterationStatistics` object which records the experimental
          results.
        run_mode_str: str, describes the run mode for this agent.
  
      Returns:
        Tuple containing the number of steps taken in this phase (int), the sum of
          returns (float), and the number of episodes performed (int).
      """$SEP$# We use sys.stdout.write instead of tf.logging so as to flush frequently$SEP$# without generating a line break.