{"id":16941979,"url":"https://github.com/shenweichen/reinforcementlearning","last_synced_at":"2025-04-11T19:32:36.467Z","repository":{"id":99631540,"uuid":"119265652","full_name":"shenweichen/ReinforcementLearning","owner":"shenweichen","description":"This project contains several  Deep Reinforcement Learning method and some experiments basd on OpenAi gym.","archived":false,"fork":false,"pushed_at":"2018-01-28T14:29:37.000Z","size":1277,"stargazers_count":20,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T15:21:20.080Z","etag":null,"topics":["deeprl","dqn","reinforcement-learning"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shenweichen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-28T14:28:39.000Z","updated_at":"2025-03-21T16:07:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4220c1b-6868-4ba9-b3d8-d67c5bd117a9","html_url":"https://github.com/shenweichen/ReinforcementLearning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FReinforcementLearning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FReinforcementLearning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FReinforcementLearning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenweichen%2FReinforcementLearning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shenweichen","download_url":"https://codeload.github.com/shenweichen/ReinforcementLearning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248466875,"owners_count":21108554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deeprl","dqn","reinforcement-learning"],"created_at":"2024-10-13T21:10:49.197Z","updated_at":"2025-04-11T19:32:36.441Z","avatar_url":"https://github.com/shenweichen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepRL\n对最近看的一些强化学习方法进行记录\n# 使用说明\n 1. 运行`solve.py`，当满足问题解决条件后，会自动保存模型。\n 2. 运行`test.py`，加载保存的模型进行测试。\n# 实验说明\n1. [Cart-Pole-v1](http://gym.openai.com/envs/CartPole-v1/)  \n这是一个比较简单的测试环境，输入状态为4维的连续值组成的向量，输出动作为2个离散动作。\n在该环境中，小车能够连续100局保持大于475个step即为解决。  \n[**实验结果和相关统计图表**](./experiment/CartPole-v1/results.md)。\n# 方法介绍\n\n## Value-Based\n\n### Q-Learning\n\n传统的Q-Learning方法对于每一个(state,action) 对，需要维护其价值。那么当state的维度升高时，就会导致维度灾难，例如对于一个输入是原始图像数据的环境来说，假设输入是\u003cimg src=\"https://latex.codecogs.com/png.latex?200*200\" title=\"200*200\" /\u003e的像素图片，每个像素有256种取值，那么总共的状态数为\u003cimg src=\"https://latex.codecogs.com/png.latex?256^{200*200}\" title=\"256^{200*200}\" /\u003e种。这是一个很大数字，会导致存储Q-Tabel消耗巨大的空间，同时Q-Value也将变得非常稀疏，导致学习难以进行。\n\n### Deep Q-Leaning\n\n引入神经网络来对Q(s,a)进行近似表示。神经网络输入为state_size维度的向量,输出为action_size维度的向量，每一维代表一个Q(s,a)值。根据DQN的输出，我们可以获得在当前state下每一个action的Q-Value,根据Q-Value来选择当前的action。\n\n这里简要介绍几种经典的DQN方法，具体细节请查阅相关论文\n- Nips DQN\n\n    \u003e Playing Atari with Deep Reinforcement Learning, Mnih et al., 2013\n    - 提出了end2end的DQN学习方法(针对图像输入，使用CNN提取图像信息)\n    - 引入经验回放  \n       1. 每个step的经验可能被使用多次，提高数据利用率\n       2. 连续若干step的经验存在着强相关性，从经验池中随机选择样本有助于打破相关性减少更新的方差\n       \n- Nature DQN\n    \u003e Human-level control through deep reinforcement learning, Mnih et al., 2015\n    - 引入了Target Q网络，在计算Target Q值(相当于DQN更新时的label)的时候使用专门的TargetQ网络计算，减少目标Q值与当前Q值得相关性。每隔若干step使用当前Q网络的参数更新TargetQ网络。\n    - clip error\n    提出将error截断在-1,1之间，提升稳定性\n- Double DQN\n    \u003e  Deep Reinforcement Learning with Double Q-learning, van Hasselt et al., 2015\n    - 主要提出在计算Target Q值的时候，使用当前网络选择贪婪策略，然后使用Target Q网络来评估策略。这样有利于减少由于直接使用max(Target Q)值带来的过度估计。\n    - 注意和Double Q-Learning进行区分(Double Q-Learning是交替交换两个Q的角色进行更新，而Double DQN依然是若干step使用当前网络更新TargetQ网络)\n- Dueling DQN\n    \u003e  Dueling Network Architectures for Deep Reinforcement Learning, Wang et al., 2016\n    - 在某些情况下，我们更关注agent所处的state如何，而不是其在该state下做出的action。\n    - 主要提出一种duelling结构，将Q网络分解为Value和Advantage,分别学习当前state的价值和在当前状态下各个action的相对价值。最后将两个通道的输出相加得到估计得Q-Value\n    - 实现过程中由于Q = V+A,对V和A同时加减一个常量不影响Q值的大小,为了能得到固定的V和A，对A减去所有A的均值。\n\n## Policy-Based\n\n待补充\n\n## Actor-Critic\n\n待补充","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenweichen%2Freinforcementlearning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshenweichen%2Freinforcementlearning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenweichen%2Freinforcementlearning/lists"}