tensorflow-rl | deep RL papers and random experimentation | Reinforcement Learning library
kandi X-RAY | tensorflow-rl Summary
kandi X-RAY | tensorflow-rl Summary
Implementations of deep RL papers and random experimentation
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Train the agent
- Save checkpoint variables
- Syncs the network with shared memory
- Rescale reward
- Train the actor
- Compute targets according to the model
- Calculate gradients
- Calculate bootstrap value for given state
- Build the q head
- Return the log probability of a symbol
- Generate the next action
- Build q head
- Run the optimizer
- Build the policy head
- Launch a cluster
- Process the next action
- Look up the q value for the given key
- Calculate softmax and log - softmax
- Perform doubledqn op
- Build the encoder
- Get the configuration
- Train the model
- Sample from the distribution
- Train the network
- Get the next action
- Build qubits
tensorflow-rl Key Features
tensorflow-rl Examples and Code Snippets
Community Discussions
Trending Discussions on tensorflow-rl
QUESTION
I can't wrap my head around question: how exactly negative rewards helps machine to avoid them?
Origin of the question came from google's solution for game Pong. By their logic, once game finished (agent won or lost point), environment returns reward (+1 or -1). Any intermediate states return 0 as reward. That means each win/loose will return either [0,0,0,...,0,1] either [0,0,0,...,0,-1] reward arrays. Then they discount and standardize rewards: ...ANSWER
Answered 2019-Feb-19 at 11:42"Tensorflow optimizer minimize loss by absolute value (doesn't care about sign, perfect loss is always 0). Right?"
Wrong. Minimizing the loss means trying to achieve as small a value as possible. That is, -100 is "better" than 0. Accordingly, -7.2 is better than 7.2. Thus, a value of 0 really carries no special significance, besides the fact that many loss functions are set up such that 0 determines the "optimal" value. However, these loss functions are usually set up to be non-negative, so the question of positive vs. negative values doesn't arise. Examples are cross entropy, squared error etc.
QUESTION
(edited w.r.t. @quirk's answer)
I was reading some tensorflow-code online and saw this statements:
...ANSWER
Answered 2017-Jan-06 at 14:56Umm, RTD(Read the docs)!
tf.select selects elements from positive
or negative
tensors based on the boolness of the elements in the condition
tensor.
tf.select(condition, t, e, name=None)
Selects elements from t or e, depending on condition.
The t, and e tensors must all have the same shape, and the output will also have that shape.
(from the official docs.)
So in your case:
threshold = tf.select(input > RLSA_THRESHOLD, positive, negative)
input > RLSA_THRESHOLD
will be a tensor of bool
or logical values (0
or 1
symbolically), which will help choose a value from either the positive
vector or the negative
vector.
For example, say you have a RLSA_THRESHOLD
of 0.5 and your input
vector is a 4-dimensional vector of real continuous values ranging from 0 to 1. Your positive
and negative
vectors are essentially [1, 1, 1, 1]
and [0, 0, 0, 0]
, respectively. input
is [0.8, 0.2, 0.5, 0.6]
.
threshold
will be [1, 0, 0, 1]
.
NOTE: positive
and negative
could be any kind of tensor as long as the dimensions agree with the condition
tensor. Had positive
and negative
been, say, [2, 4, 6, 8]
and [1, 3, 5, 7]
respectively, your threshold
would have been [2, 3, 5, 8]
.
The code snippet seems reasonably advanced for me to assume that the authors would have just used
input > RLSA_THRESHOLD
if there was no specific reason for thetf.select
.
There is a very good reason for that. input > RLSA_THRESHOLD
would simply return a tensor of logical (boolean) values. Logical values do not mix well with numerical values. You cannot use them for any realistic numerical computation. Had the positive
and/or negative
tensors been real valued, you might have required your threshold
tensor to also have real values, in case you planned to use them further along.
Is the
tf.select
equivalent toinput > RLSA_THRESHOLD
? If not, why not?
No they are not. One is a function, the other is a tensor.
I am going to give you the benefit of doubt and assume you meant to ask:
Is the
threshold
equivalent toinput > RLSA_THRESHOLD
? If not, why not?
No they are not. As explained above, input > RLSA_THRESHOLD
is a logical tensor with a data type of bool
. threshold
, on the other hand, is a tensor with the same data type as positive
and negative
.
NOTE: You can always cast your logical tensors to numerical (or any other supported data type) tensors using any of the casting methods available in tensorflow.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tensorflow-rl
You can use tensorflow-rl like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page