1
$\begingroup$

I have found this part of code, but I do not actually know how it works. Because I am new to Tensorflow, I do not know it. Can anybody help me and explain it to me?

init = tf.global_variables_initializer()
steps = 5
epochs = 500


with tf.Session() as sess:

    sess.run(init)
    for j in range(epochs):
        ind = 0
        for i in range(steps):

            x_curr = next_batch(ind)

            _,val,delt,w = sess.run([train,UT,delta,W],feed_dict = {features:x_curr.reshape([price_tick_count+time_steps,1])})
            obj.append(val[0][0])

            ind = ind + price_tick_count + time_steps
    print(val)

I just know this is related to reinforcement learning, but I do not know what the parameters _, val, delt and w are. As what we have in reinforcement learning, we should maximize the amount of value, but how can we justify here in this code?

$\endgroup$
0
$\begingroup$

This is what I got from the manual : The value returned by run() has the same shape as the fetches argument, where the leaves are replaced by the corresponding values returned by TensorFlow.

sess.run(fetches, feed_dict=None, options=None, run_metadata=None)

Example:

python
   a = tf.constant([10, 20])
   b = tf.constant([1.0, 2.0])
   # 'fetches' can be a singleton
   v = session.run(a)
   # v is the numpy array [10, 20]
   # 'fetches' can be a list.
   v = session.run([a, b])
   # v is a Python list with 2 numpy arrays: the 1-D array [10, 20] and the
   # 1-D array [1.0, 2.0]
   # 'fetches' can be arbitrary lists, tuples, namedtuple, dicts:
   MyData = collections.namedtuple('MyData', ['a', 'b'])
   v = session.run({'k1': MyData(a, b), 'k2': [b, a]})
   # v is a dict with
   # v['k1'] is a MyData namedtuple with 'a' (the numpy array [10, 20]) and
   # 'b' (the numpy array [1.0, 2.0])
   # v['k2'] is a list with the numpy array [1.0, 2.0] and the numpy array
   # [10, 20].
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.