【发布时间】:2018-08-01 01:53:27
【问题描述】:
提高深度 Q 学习任务稳定性的一种方法是为网络维护一组目标权重,这些权重更新缓慢并用于计算 Q 值目标。因此,在学习过程的不同时间,前向传递中使用了两组不同的权重。对于普通的 DQN,这并不难实现,因为权重是可以在 feed_dict 中设置的张量流变量,即:
sess = tf.Session()
input = tf.placeholder(tf.float32, shape=[None, 5])
weights = tf.Variable(tf.random_normal(shape=[5,4], stddev=0.1)
bias = tf.Variable(tf.constant(0.1, shape=[4])
output = tf.matmul(input, weights) + bias
target = tf.placeholder(tf.float32, [None, 4])
loss = ...
...
#Here we explicitly set weights to be the slowly updated target weights
sess.run(output, feed_dict={input: states, weights: target_weights, bias: target_bias})
# Targets for the learning procedure are computed using this output.
....
#Now we run the learning procedure, using the most up to date weights,
#as well as the previously computed targets
sess.run(loss, feed_dict={input: states, target: targets})
我想在 DQN 的循环版本中使用这种目标网络技术,但我不知道如何访问和设置循环单元内使用的权重。具体来说,我使用的是 tf.nn.rnn_cell.BasicLSTMCell,但我想知道如何对任何类型的循环单元执行此操作。
【问题讨论】:
标签: python machine-learning tensorflow reinforcement-learning