tensorflow-deepq-master
所属分类:其他
开发工具:Python
文件大小:8337KB
下载次数:1
上传日期:2020-03-28 11:44:46
上 传 者:
Gordo
说明: Tensorflow DQN master code
文件列表:
LICENSE.md (1079, 2017-05-25)
LICENSE2.md (11406, 2017-05-25)
TODO.txt (91, 2017-05-25)
data (0, 2017-05-25)
data\example.gif (8560402, 2017-05-25)
notebooks (0, 2017-05-25)
notebooks\DoublePendulum.ipynb (3900, 2017-05-25)
notebooks\MLP.ipynb (6407, 2017-05-25)
notebooks\MLP_copy.ipynb (4987, 2017-05-25)
notebooks\XOR Network.ipynb (10631, 2017-05-25)
notebooks\game.ipynb (30203, 2017-05-25)
notebooks\game_memory.ipynb (30343, 2017-05-25)
notebooks\karpathy_game.ipynb (51330, 2017-05-25)
notebooks\pong.py (5540, 2017-05-25)
notebooks\tf_rl (8, 2017-05-25)
requirements.txt (27, 2017-05-25)
saved_models (0, 2017-05-25)
saved_models\checkpoint (125, 2017-05-25)
saved_models\karpathy_game.ckpt (432277, 2017-05-25)
scripts (0, 2017-05-25)
scripts\make_gif.sh (562, 2017-05-25)
tf_rl (0, 2017-05-25)
tf_rl\__init__.py (31, 2017-05-25)
tf_rl\controller (0, 2017-05-25)
tf_rl\controller\__init__.py (88, 2017-05-25)
tf_rl\controller\discrete_deepq.py (13401, 2017-05-25)
tf_rl\controller\human_controller.py (575, 2017-05-25)
tf_rl\models.py (6123, 2017-05-25)
tf_rl\simulate.py (4285, 2017-05-25)
tf_rl\simulation (0, 2017-05-25)
tf_rl\simulation\__init__.py (128, 2017-05-25)
tf_rl\simulation\discrete_hill.py (1446, 2017-05-25)
tf_rl\simulation\double_pendulum.py (5191, 2017-05-25)
tf_rl\simulation\karpathy_game.py (14206, 2017-05-25)
tf_rl\utils (0, 2017-05-25)
tf_rl\utils\__init__.py (370, 2017-05-25)
tf_rl\utils\event_queue.py (1454, 2017-05-25)
... ...
# This reposity is now obsolte!
Check out the new simpler, better performing and more complete implementation that we released at OpenAI:
https://github.com/openai/baselines
(scroll for docs of the obsolete version)
### Reinforcement Learning using Tensor Flow
#### Quick start
Check out Karpathy game in `notebooks` folder.
*The image above depicts a strategy learned by the DeepQ controller. Available actions are accelerating top, bottom, left or right. The reward signal is +1 for the green fellas, -1 for red and -5 for orange.*
#### Requirements
- `future==0.15.2`
- `euclid==0.1`
- `inkscape` (for animation gif creation)
#### How does this all fit together.
`tf_rl` has controllers and simulators which can be pieced together using simulate function.
#### Using human controller.
Want to have some fun controlling the simulation by yourself? You got it!
Use `tf_rl.controller.HumanController` in your simulation.
To issue commands run in terminal
```python3
python3 tf_rl/controller/human_controller.py
```
For it to work you also need to have a redis server running locally.
#### Writing your own controller
To write your own controller define a controller class with 3 functions:
- `action(self, observation)` given an observation (usually a tensor of numbers) representing an observation returns action to perform.
- `store(self, observation, action, reward, newobservation)` called each time a transition is observed from `observation` to `newobservation`. Transition is a consequence of `action` and has associated `reward`
- `training_step(self)` if your controller requires training that is the place to do it, should not take to long, because it will be called roughly every action execution.
#### Writing your own simulation
To write your own simulation define a simulation class with 4 functions:
- `observe(self)` returns a current observation
- `collect_reward(self)` returns the reward accumulated since the last time function was called.
- `perform_action(self, action)` updates internal state to reflect the fact that `aciton` was executed
- `step(self, dt)` update internal state as if `dt` of simulation time has passed.
- `to_html(self, info=[])` generate an html visualization of the game. `info` can be optionally passed an has a list of strings that should be displayed along with the visualization
#### Creating GIFs based on simulation
The `simulate` method accepts `save_path` argument which is a folder where all the consecutive images will be stored.
To make them into a GIF use `scripts/make_gif.sh PATH` where path is the same as the path you passed to `save_path` argument
近期下载者:
相关文件:
收藏者: