摘要:
import random import gym import torch import numpy as np from matplotlib import pyplot as plt from IPython import display env = gym.make("CartPole-v0" 阅读全文
posted @ 2022-11-13 18:38
今夜无风
阅读(442)
评论(0)
推荐(0)
摘要:
现在我们想在类似车杆的环境中得到动作价值函数,由于状态每一维度的值都是连续的,无法使用表格记录,因此一个常见的解决方法便是使用函数拟合(function approximation)的思想。由于神经网络具有强大的表达能力,因此我们可以用一个神经网络来表示函数。 import random impor 阅读全文
posted @ 2022-11-13 11:09
今夜无风
阅读(241)
评论(0)
推荐(0)
摘要:
基于Q-learning,加入数据反刍机制,更多地利用已有样本,温故而知新(离线学习) import numpy as np import random # 获取一个格子的状态 def get_state(row, col): if row!=3: return 'ground' if row == 阅读全文
posted @ 2022-11-11 18:15
今夜无风
阅读(222)
评论(0)
推荐(0)
摘要:
On-policy 和 Off-policy 差异,更新量方式不同 Q-learning是srasa的改进版,效果要更好更实用,从悬崖问题中看出,Q-learning智能体可以贴着悬崖达到目标点(而saras总是离悬崖最远走) 离线策略所需的训练数据并不一定是当前策略采样得到,离线策略算法能够重复使 阅读全文
posted @ 2022-11-11 16:05
今夜无风
阅读(195)
评论(0)
推荐(0)
摘要:
import numpy as np import random # 获取一个格子的状态 def get_state(row, col): if row != 3: return 'ground' if row == 3 and col == 0: return 'ground' if row == 阅读全文
posted @ 2022-11-11 15:18
今夜无风
阅读(117)
评论(0)
推荐(0)
摘要:
import numpy as np import random # 获取一个格子的状态 def get_state(row, col): if row!=3: return 'ground' if row == 3 and col == 11: return 'terminal' if row = 阅读全文
posted @ 2022-11-10 18:22
今夜无风
阅读(145)
评论(0)
推荐(0)
摘要:
import os import gym import numpy as np from matplotlib import pyplot as plt env = gym.make('FrozenLake-v1', is_slippery=False, map_name='4x4', desc=[ 阅读全文
posted @ 2022-11-10 14:54
今夜无风
阅读(355)
评论(0)
推荐(0)
摘要:
# 获取一个格子的状态 def get_state(row, col): if row!=3: return 'ground' if row == 3 and col == 11: return 'terminal' if row == 3 and col == 0: return 'ground' 阅读全文
posted @ 2022-11-09 17:14
今夜无风
阅读(174)
评论(0)
推荐(0)
摘要:
# 获取一个格子的状态 def get_state(row, col): if row!=3: return 'ground' if row == 3 and col == 11: return 'terminal' if row == 3 and col == 0: return 'ground' 阅读全文
posted @ 2022-11-09 16:52
今夜无风
阅读(136)
评论(0)
推荐(0)
摘要:
import numpy as np # 状态转移概率矩阵 P = np.array([ [0.9, 0.1, 0.0, 0.0, 0.0, 0.0], [0.5, 0.0, 0.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.6, 0.0, 0.4], [0.0, 0.0 阅读全文
posted @ 2022-11-08 22:31
今夜无风
阅读(125)
评论(0)
推荐(0)
浙公网安备 33010602011771号