I am new to hyperopt. To me, it appears to be trying random values, instead of choosing values so as to converge on an optimal, loss-driven result. It looks as if it continues searching after stumbling on the right solution. Is this how TPE is supposed to work? Consider this code, and simple function x**2:
from hyperopt import fmin, tpe, hp
MINX, MINL=0.0, 10000.0
def minfunc(x):
global MINX, MINL
loss = x**2.
nms = ""
if loss<MINL:
nms="<<<MIN"
MINL = loss
MINX = x
print("x, loss =, %8.4f, %8.3f, %s" % (x,loss,nms))
nms = ""
return loss
best = fmin(fn=minfunc,
space=hp.uniform('x', -10, 10),
algo=tpe.suggest,
max_evals=100)
If you plot the specific x's being tried, it appears to be random. Further, the minimums appear to be spread out. In a gradient descent algorithm, the minimums would occur one right after the other, until the algorithm stopped. (That is my second problem with hyperopt - it appears to use all max_evals instead of stopping when it finds a minimum.)
Am I doing something wrong, or is this just how TPE is supposed to work (e.g., deliberately trying other values to avoid the local minima problem)?
Thanks,
Russ