How to use the yarl.agents.dqn_agent.DQNAgent function in yarl

To help you get started, we’ve selected a few yarl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rlgraph / rlgraph / yarl / performance_tests / test_single_threaded_dqn.py View on Github external
def test_replay_memory_atari_throughput(self):
        """
        Tests throughput on standard Atari envs using the replay memory.
        """
        agent = DQNAgent(
            states_spec=self.env.state_space,
            action_spec=self.env.action_space,
            network_spec=self.network,
            memory_spec=dict(
                type='replay_memory',
                capacity=100000,
                next_states=True
            )
        )
        worker = SingleThreadedWorker(
            environment=self.env,
            agent=agent,
            repeat_actions=1
        )

        result = worker.execute_timesteps(num_timesteps=1000000, deterministic=False)
github rlgraph / rlgraph / yarl / performance_tests / test_single_threaded_dqn.py View on Github external
def test_prioritized_replay_atari_throughput(self):
        """
        Tests throughput on standard Atari envs using the prioritized replay memory.
        """
        agent = DQNAgent(
            states_spec=self.env.state_space,
            action_spec=self.env.action_space,
            network_spec=self.network,
            memory_spec=dict(
                type='prioritized',
                capacity=100000,
                next_states=True
            )
        )
        worker = SingleThreadedWorker(
            environment=self.env,
            agent=agent,
            repeat_actions=1
        )

        result = worker.execute_timesteps(num_timesteps=1000000, deterministic=False)