Skip to content

Commit

Permalink
update note7
Browse files Browse the repository at this point in the history
  • Loading branch information
yeyupiaoling committed Nov 22, 2018
1 parent 779e76a commit 6c1e5c4
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 175 deletions.
336 changes: 164 additions & 172 deletions note7/DQNetwork.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"def QNetWork(ipt):\n",
" fc1 = fluid.layers.fc(input=ipt, size=1024, act='relu')\n",
" fc3 = fluid.layers.fc(input=fc1, size=4096, act='relu')\n",
" out = fluid.layers.fc(input=fc3, size=2, act='relu')\n",
" out = fluid.layers.fc(input=fc3, size=2)\n",
" return out"
]
},
Expand Down Expand Up @@ -143,176 +143,168 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Pass: 0, score:13\n",
"Pass: 1, score:9\n",
"Pass: 2, score:12\n",
"Pass: 3, score:13\n",
"Pass: 4, score:15\n",
"Pass: 5, score:9\n",
"Pass: 6, score:14\n",
"Pass: 7, score:33\n",
"Pass: 8, score:9\n",
"Pass: 9, score:21\n",
"Pass: 10, score:17\n",
"Pass: 11, score:18\n",
"Pass: 12, score:11\n",
"Pass: 13, score:11\n",
"Pass: 14, score:14\n",
"Pass: 15, score:45\n",
"Pass: 16, score:18\n",
"Pass: 0, score:11\n",
"Pass: 1, score:13\n",
"Pass: 2, score:11\n",
"Pass: 3, score:16\n",
"Pass: 4, score:16\n",
"Pass: 5, score:36\n",
"Pass: 6, score:72\n",
"Pass: 7, score:17\n",
"Pass: 8, score:19\n",
"Pass: 9, score:20\n",
"Pass: 10, score:26\n",
"Pass: 11, score:13\n",
"Pass: 12, score:17\n",
"Pass: 13, score:47\n",
"Pass: 14, score:33\n",
"Pass: 15, score:60\n",
"Pass: 16, score:26\n",
"Pass: 17, score:10\n",
"Pass: 18, score:10\n",
"Pass: 19, score:18\n",
"Pass: 18, score:83\n",
"Pass: 19, score:43\n",
"Pass: 20, score:13\n",
"Pass: 21, score:25\n",
"Pass: 22, score:9\n",
"Pass: 23, score:14\n",
"Pass: 24, score:14\n",
"Pass: 25, score:15\n",
"Pass: 26, score:17\n",
"Pass: 27, score:41\n",
"Pass: 28, score:26\n",
"Pass: 29, score:12\n",
"Pass: 30, score:10\n",
"Pass: 31, score:22\n",
"Pass: 32, score:8\n",
"Pass: 33, score:27\n",
"Pass: 34, score:12\n",
"Pass: 35, score:14\n",
"Pass: 36, score:10\n",
"Pass: 37, score:14\n",
"Pass: 38, score:13\n",
"Pass: 39, score:13\n",
"Pass: 40, score:13\n",
"Pass: 41, score:23\n",
"Pass: 21, score:21\n",
"Pass: 22, score:19\n",
"Pass: 23, score:34\n",
"Pass: 24, score:65\n",
"Pass: 25, score:29\n",
"Pass: 26, score:98\n",
"Pass: 27, score:33\n",
"Pass: 28, score:16\n",
"Pass: 29, score:65\n",
"Pass: 30, score:23\n",
"Pass: 31, score:46\n",
"Pass: 32, score:68\n",
"Pass: 33, score:58\n",
"Pass: 34, score:55\n",
"Pass: 35, score:80\n",
"Pass: 36, score:30\n",
"Pass: 37, score:79\n",
"Pass: 38, score:112\n",
"Pass: 39, score:31\n",
"Pass: 40, score:25\n",
"Pass: 41, score:81\n",
"Pass: 42, score:10\n",
"Pass: 43, score:11\n",
"Pass: 44, score:24\n",
"Pass: 45, score:16\n",
"Pass: 46, score:10\n",
"Pass: 47, score:11\n",
"Pass: 48, score:11\n",
"Pass: 49, score:8\n",
"Pass: 50, score:21\n",
"Pass: 51, score:15\n",
"Pass: 52, score:27\n",
"Pass: 53, score:9\n",
"Pass: 54, score:9\n",
"Pass: 55, score:10\n",
"Pass: 56, score:9\n",
"Pass: 57, score:9\n",
"Pass: 58, score:15\n",
"Pass: 59, score:8\n",
"Pass: 60, score:14\n",
"Pass: 61, score:13\n",
"Pass: 62, score:15\n",
"Pass: 63, score:8\n",
"Pass: 64, score:10\n",
"Pass: 65, score:9\n",
"Pass: 66, score:10\n",
"Pass: 67, score:9\n",
"Pass: 68, score:14\n",
"Pass: 69, score:10\n",
"Pass: 70, score:11\n",
"Pass: 71, score:11\n",
"Pass: 72, score:8\n",
"Pass: 73, score:10\n",
"Pass: 74, score:8\n",
"Pass: 75, score:12\n",
"Pass: 76, score:9\n",
"Pass: 77, score:9\n",
"Pass: 78, score:10\n",
"Pass: 79, score:10\n",
"Pass: 80, score:9\n",
"Pass: 81, score:9\n",
"Pass: 82, score:9\n",
"Pass: 83, score:9\n",
"Pass: 84, score:9\n",
"Pass: 85, score:11\n",
"Pass: 86, score:10\n",
"Pass: 87, score:7\n",
"Pass: 88, score:9\n",
"Pass: 89, score:8\n",
"Pass: 90, score:9\n",
"Pass: 91, score:14\n",
"Pass: 92, score:8\n",
"Pass: 93, score:10\n",
"Pass: 94, score:7\n",
"Pass: 95, score:9\n",
"Pass: 96, score:8\n",
"Pass: 97, score:9\n",
"Pass: 98, score:8\n",
"Pass: 99, score:8\n",
"Pass: 100, score:8\n",
"Pass: 101, score:9\n",
"Pass: 102, score:9\n",
"Pass: 103, score:7\n",
"Pass: 104, score:9\n",
"Pass: 105, score:8\n",
"Pass: 106, score:8\n",
"Pass: 107, score:9\n",
"Pass: 108, score:9\n",
"Pass: 109, score:9\n",
"Pass: 110, score:7\n",
"Pass: 111, score:9\n",
"Pass: 112, score:9\n",
"Pass: 113, score:8\n",
"Pass: 114, score:8\n",
"Pass: 115, score:9\n",
"Pass: 116, score:7\n",
"Pass: 117, score:8\n",
"Pass: 118, score:9\n",
"Pass: 119, score:9\n",
"Pass: 120, score:9\n",
"Pass: 121, score:9\n",
"Pass: 122, score:7\n",
"Pass: 123, score:9\n",
"Pass: 124, score:8\n",
"Pass: 125, score:8\n",
"Pass: 126, score:8\n",
"Pass: 127, score:8\n",
"Pass: 128, score:7\n",
"Pass: 129, score:10\n",
"Pass: 130, score:8\n",
"Pass: 131, score:9\n",
"Pass: 132, score:9\n",
"Pass: 133, score:8\n",
"Pass: 134, score:8\n",
"Pass: 135, score:8\n",
"Pass: 136, score:8\n",
"Pass: 137, score:9\n",
"Pass: 138, score:9\n",
"Pass: 139, score:9\n",
"Pass: 140, score:8\n",
"Pass: 141, score:9\n",
"Pass: 142, score:8\n",
"Pass: 143, score:8\n",
"Pass: 144, score:8\n",
"Pass: 145, score:7\n",
"Pass: 146, score:8\n",
"Pass: 147, score:10\n",
"Pass: 148, score:9\n",
"Pass: 149, score:9\n",
"Pass: 150, score:7\n",
"Pass: 151, score:9\n",
"Pass: 152, score:9\n",
"Pass: 153, score:9\n",
"Pass: 154, score:8\n",
"Pass: 155, score:9\n",
"Pass: 156, score:8\n",
"Pass: 157, score:9\n",
"Pass: 158, score:8\n",
"Pass: 159, score:7\n",
"Pass: 160, score:9\n",
"Pass: 161, score:9\n",
"Pass: 162, score:9\n",
"Pass: 163, score:8\n",
"Pass: 164, score:9\n",
"Pass: 165, score:7\n",
"Pass: 166, score:8\n",
"Pass: 167, score:9\n",
"Pass: 168, score:8\n",
"Pass: 169, score:7\n"
"Pass: 43, score:55\n",
"Pass: 44, score:74\n",
"Pass: 45, score:45\n",
"Pass: 46, score:60\n",
"Pass: 47, score:14\n",
"Pass: 48, score:74\n",
"Pass: 49, score:121\n",
"Pass: 50, score:77\n",
"Pass: 51, score:37\n",
"Pass: 52, score:107\n",
"Pass: 53, score:73\n",
"Pass: 54, score:70\n",
"Pass: 55, score:42\n",
"Pass: 56, score:82\n",
"Pass: 57, score:41\n",
"Pass: 58, score:59\n",
"Pass: 59, score:69\n",
"Pass: 60, score:99\n",
"Pass: 61, score:44\n",
"Pass: 62, score:68\n",
"Pass: 63, score:64\n",
"Pass: 64, score:23\n",
"Pass: 65, score:53\n",
"Pass: 66, score:62\n",
"Pass: 67, score:54\n",
"Pass: 68, score:63\n",
"Pass: 69, score:101\n",
"Pass: 70, score:59\n",
"Pass: 71, score:58\n",
"Pass: 72, score:51\n",
"Pass: 73, score:81\n",
"Pass: 74, score:44\n",
"Pass: 75, score:68\n",
"Pass: 76, score:18\n",
"Pass: 77, score:74\n",
"Pass: 78, score:57\n",
"Pass: 79, score:75\n",
"Pass: 80, score:50\n",
"Pass: 81, score:43\n",
"Pass: 82, score:64\n",
"Pass: 83, score:50\n",
"Pass: 84, score:63\n",
"Pass: 85, score:54\n",
"Pass: 86, score:62\n",
"Pass: 87, score:49\n",
"Pass: 88, score:33\n",
"Pass: 89, score:16\n",
"Pass: 90, score:24\n",
"Pass: 91, score:47\n",
"Pass: 92, score:68\n",
"Pass: 93, score:54\n",
"Pass: 94, score:72\n",
"Pass: 95, score:64\n",
"Pass: 96, score:64\n",
"Pass: 97, score:65\n",
"Pass: 98, score:38\n",
"Pass: 99, score:53\n",
"Pass: 100, score:38\n",
"Pass: 101, score:60\n",
"Pass: 102, score:31\n",
"Pass: 103, score:38\n",
"Pass: 104, score:26\n",
"Pass: 105, score:22\n",
"Pass: 106, score:35\n",
"Pass: 107, score:8\n",
"Pass: 108, score:11\n",
"Pass: 109, score:28\n",
"Pass: 110, score:46\n",
"Pass: 111, score:19\n",
"Pass: 112, score:19\n",
"Pass: 113, score:29\n",
"Pass: 114, score:31\n",
"Pass: 115, score:33\n",
"Pass: 116, score:50\n",
"Pass: 117, score:43\n",
"Pass: 118, score:46\n",
"Pass: 119, score:36\n",
"Pass: 120, score:52\n",
"Pass: 121, score:36\n",
"Pass: 122, score:34\n",
"Pass: 123, score:32\n",
"Pass: 124, score:41\n",
"Pass: 125, score:38\n",
"Pass: 126, score:28\n",
"Pass: 127, score:27\n",
"Pass: 128, score:16\n",
"Pass: 129, score:33\n",
"Pass: 130, score:14\n",
"Pass: 131, score:27\n",
"Pass: 132, score:41\n",
"Pass: 133, score:31\n",
"Pass: 134, score:20\n",
"Pass: 135, score:21\n",
"Pass: 136, score:15\n",
"Pass: 137, score:11\n",
"Pass: 138, score:18\n",
"Pass: 139, score:25\n",
"Pass: 140, score:39\n",
"Pass: 141, score:22\n",
"Pass: 142, score:27\n",
"Pass: 143, score:27\n",
"Pass: 144, score:39\n",
"Pass: 145, score:30\n",
"Pass: 146, score:28\n",
"Pass: 147, score:34\n",
"Pass: 148, score:58\n",
"Pass: 149, score:47\n",
"Pass: 150, score:20\n",
"Pass: 151, score:36\n",
"Pass: 152, score:24\n",
"Pass: 153, score:31\n",
"Pass: 154, score:34\n",
"Pass: 155, score:29\n",
"Pass: 156, score:24\n",
"Pass: 157, score:16\n",
"Pass: 158, score:35\n",
"Pass: 159, score:17\n",
"Pass: 160, score:26\n",
"Pass: 161, score:24\n"
]
}
],
Expand All @@ -322,7 +314,7 @@
" epsilon = max(initial_epsilon * (num_exploration_episodes - epsilon_id) /\n",
" num_exploration_episodes, final_epsilon)\n",
" for t in range(max_len_episode):\n",
"# env.render()\n",
" # env.render()\n",
" if random.random() < epsilon:\n",
" state = np.expand_dims(state, axis=0)\n",
" action = env.action_space.sample()\n",
Expand Down Expand Up @@ -376,9 +368,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "PaddlePaddle 1.0.1 (Python 3.5)",
"display_name": "Python 3",
"language": "python",
"name": "paddle1.0.1-py35"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -390,7 +382,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.5"
"version": "3.5.2"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions note7/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


def QNetWork(ipt):
fc1 = fluid.layers.fc(input=ipt, size=512, act='relu')
fc3 = fluid.layers.fc(input=fc1, size=512, act='relu')
fc1 = fluid.layers.fc(input=ipt, size=1024, act='relu')
fc3 = fluid.layers.fc(input=fc1, size=4096, act='relu')
out = fluid.layers.fc(input=fc3, size=2)
return out

Expand All @@ -19,7 +19,7 @@ def QNetWork(ipt):
done_data = fluid.layers.data(name='done', shape=[], dtype='bool')

batch_size = 32
num_episodes = 35
num_episodes = 350
num_exploration_episodes = 100
max_len_episode = 1000
learning_rate = 1e-3
Expand Down

0 comments on commit 6c1e5c4

Please sign in to comment.