Tuesday, 5 June 2018

Escaping local minimum with tensorflow

I am solving this system of equations with tensorflow:

f1 = y - x*x = 0
f2 = x - (y - 2)*(y - 2) + 1.1 = 0

enter image description here

If I choose bad starting point (x,y)=(-1.3,2), then I get into local minima optimising f1^2+f2^2 with this code:

f1 = y - x*x
f2 = x - (y - 2)*(y - 2) + 1.1
sq=f1*f1+f2*f2
o = tf.train.AdamOptimizer(1e-1).minimize(sq)
with tf.Session() as sess:
    init = tf.global_variables_initializer()
    sess.run([init])
    for i in range(50):
        sess.run([o])
        r=sess.run([x,y,f1,f2])
        print("x",r)

How can I escape this local minima with built-in tensorflow tools? May be there is any other TF approach I can use to solve this equation starting from this bad point?



from Escaping local minimum with tensorflow

No comments:

Post a Comment