def test_LoggingVerbose(self): ppo_agent = easyagents.tfagents.PpoAgent( 'CartPole-v0', training_duration=TrainingDurationFast(), logging=LoggingVerbose()) ppo_agent.train() return
def test_play_episode(self): ppo_agent = easyagents.tfagents.PpoAgent( 'CartPole-v0', training_duration=TrainingDurationSingleEpisode(), logging=LoggingVerbose()) ppo_agent.train() TestEasyEnv._step_callback_call_count = 0 (reward, steps) = ppo_agent.play_episode(step_callback) assert reward > 0 assert steps > 0 assert TestEasyEnv._step_callback_call_count > 0 return
# # simple easyagents demo using cartpole from easyagents.tfagents import PpoAgent from easyagents.config import TrainingDurationSingleEpisode from easyagents.config import TrainingDurationFast from easyagents.config import LoggingVerbose ppo_agent = PpoAgent(gym_env_name='CartPole-v0', training_duration=TrainingDurationFast(), logging=LoggingVerbose()) ppo_agent.train() ppo_agent.plot_average_rewards() ppo_agent.plot_losses() ppo_agent.render_episodes_to_mp4() ppo_agent.render_episodes_to_html(fps=20)
def test_render_episodes_to_str(self): ppo_agent = PpoAgent( 'CartPole-v0', training_duration=TrainingDurationSingleEpisode(), logging=LoggingVerbose() ) ppo_agent.train() result = ppo_agent.render_episodes_to_str() assert isinstance(result,str), "render_episodes_to_str did not return a string" return
def test_render_episodes(self): ppo_agent = PpoAgent( 'CartPole-v0', training_duration=TrainingDurationSingleEpisode(), logging=LoggingVerbose() ) ppo_agent.train() ppo_agent.render_episodes() return
def test_plot_with_ylim(self): ppo_agent = PpoAgent( 'CartPole-v0', training_duration=TrainingDurationSingleEpisode(), logging=LoggingVerbose() ) ppo_agent.train() ppo_agent.plot_losses(ylim=[10,20]) return
def test_plot_no_ylim(self): ppo_agent = PpoAgent( 'CartPole-v0', training_duration=TrainingDurationSingleEpisode(), logging=LoggingVerbose() ) ppo_agent.train() ppo_agent.plot_average_rewards() return