Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deal with inputs outside 0-1 range in tensorflow?

In the example provided at http://www.tensorflow.org/get_started if I multiply the input by 2

x_data = np.float32(np.random.rand(2, 100))*2

I get non-sense output, while I expected to get the same solution.

0 [[ -67.06586456 -109.13352203]] [-7.67297792]
20 [[ nan  nan]] [ nan]
40 [[ nan  nan]] [ nan]
60 [[ nan  nan]] [ nan]
80 [[ nan  nan]] [ nan]
100 [[ nan  nan]] [ nan]
120 [[ nan  nan]] [ nan]
140 [[ nan  nan]] [ nan]
160 [[ nan  nan]] [ nan]
180 [[ nan  nan]] [ nan]
200 [[ nan  nan]] [ nan]

How does tensorflow handle inputs that are not in the 0-1 range?

EDIT: Using AdagradOptimizer works without an issue.

like image 364
Alexandru Avatar asked Jan 07 '23 05:01

Alexandru


1 Answers

The issue is that the example uses a very aggressive learning rate:

optimizer = tf.train.GradientDescentOptimizer(0.5)

This makes learning faster, but stops working if you change the problem a bit. A learning rate of 0.01 would be more typical:

optimizer = tf.train.GradientDescentOptimizer(0.01)

Now your modification works fine. :)

like image 110
colah Avatar answered Jan 17 '23 11:01

colah