コード例 #1
0
ファイル: easyenv_test.py プロジェクト: DJCordhose/easyagents
 def test_LoggingVerbose(self):
     ppo_agent = easyagents.tfagents.PpoAgent(
         'CartPole-v0',
         training_duration=TrainingDurationFast(),
         logging=LoggingVerbose())
     ppo_agent.train()
     return
コード例 #2
0
ファイル: easyenv_test.py プロジェクト: DJCordhose/easyagents
    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
コード例 #3
0
#
# 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)
コード例 #4
0
    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
コード例 #5
0
    def test_render_episodes(self):
        ppo_agent = PpoAgent( 'CartPole-v0', training_duration=TrainingDurationSingleEpisode(), logging=LoggingVerbose() )
        ppo_agent.train()

        ppo_agent.render_episodes()
        return
コード例 #6
0
    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
コード例 #7
0
    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