Using Tensorflow, I am trying to optimize the shape parameter of Weillbull distribution. The shape parameter should be always more than zero.
What is a nice way to define a positive variable in TensorFlow?
Using Tensorflow, I am trying to optimize the shape parameter of Weillbull distribution. The shape parameter should be always more than zero.
What is a nice way to define a positive variable in TensorFlow?
I see two ways of doing this:
tf.Variable, you can use the constraint parameter (get_variable has it as well). This needs to be a function that basically projects the variable into the allowed space. E.g. you could pass tf.nn.relu here, which would map any negative values to 0 should they occur.tf.exp. E.g. if your variable is x, you pass tf.exp(x) as the parameter to the Weibull distribution. Then x represents the log of the parameter.