Skip to main content

A simple benchmarking tool for RL algorithms on Atari games

Project description

Just Bench It: RL Algorithm Benchmarking Tool

这个项目提供了一个简单的工具,用于对强化学习(RL)算法在Atari游戏上进行基准测试。 WEBSITE: https://justbechit.github.io/rl_ladder/

安装

PYPI

  1. 安装:
    pip install just-bench-it
    

Build from source

  1. 克隆这个仓库:

    git clone https://github.com/your_username/just_bench_it.git
    cd just_bench_it
    
  2. 安装依赖:

    pip install -e .
    

使用方法

  1. 创建你的RL agent类,并使用@benchmark装饰器。

  2. 在你的agent类中实现以下方法:

    • set_env_info(self, env_info): 设置环境信息
    • act(self, state): 根据当前状态选择动作
    • update(self, state, action, reward, next_state, done): 更新agent的内部状态或模型
  3. 运行你的脚本来执行基准测试。

示例

这里有一个DQN agent的示例实现:

from just_bench_it import benchmark

@benchmark(pretrained=False, train_episodes=1000, eval_episodes=100)
class DQNAgent:
    def __init__(self):
        # 初始化你的DQN agent
        pass

    def set_env_info(self, env_info):
        # 设置环境信息: bench_it 会提供当前动作空间和观察空间
        #         input_shape = env_info['observation_space'].shape
        #         output_dim = env_info['action_space'].n
        #  不同的环境其输入可能不同,确保您的算法能够应对不同环境
        pass

    def act(self, state):
        # 根据状态选择动作
        pass

    def update(self, state, action, reward, next_state, done):
        # 更新agent
        pass

if __name__ == "__main__":
    agent = DQNAgent()
    results = agent.bench()
    print(results)

自定义

你可以通过修改@benchmark装饰器的参数来自定义基准测试:

  • pretrained: 是否使用预训练模型(默认为False)
  • train_episodes: 训练的回合数(默认为1000)
  • eval_episodes: 评估的回合数(默认为100)

结果

基准测试的结果会自动发布为GitHub issue,包含每个环境的平均得分和其他相关信息。

贡献

欢迎提交问题报告和拉取请求。对于重大更改,请先开issue讨论您想要更改的内容。

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

just_bench_it-0.1.9.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

just_bench_it-0.1.9-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file just_bench_it-0.1.9.tar.gz.

File metadata

  • Download URL: just_bench_it-0.1.9.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for just_bench_it-0.1.9.tar.gz
Algorithm Hash digest
SHA256 b1928f4839927c39276b92fb6a5445e967ef9656bfc299932260f4742d4d7c63
MD5 9163bee98c9864fdb0a80cafedc821b5
BLAKE2b-256 aae18e591c6875814af77f46ad7323356ae200ad1865bb3bb8662275184c9d3e

See more details on using hashes here.

File details

Details for the file just_bench_it-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: just_bench_it-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for just_bench_it-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1f5e365c4a611fd9dba9503c2cda3772eb401a0c381fdd3df3afa0a6e7383fe0
MD5 faef0b28cf1dd53c0d69bb1be6f29e7a
BLAKE2b-256 89ea2cf6ff44d01a45ccdf4704bd7ac487c3aa4918c9e9d20785767348f603f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page