} ############# # get params (x) and cost (z) x, z = xyz.T[:,:-1], xyz.T[:,-1] #HACK: remove any duplicate points by adding noise _x = x + np.random.normal(scale=1e-8, size=x.shape) if len(z) > N: N = max(int(round(len(z)/float(N))),1) print("for speed, sampling {} down to {}".format(len(z),len(z)/N)) x, _x, z = x[::N], _x[::N], z[::N] f = Rbf(*np.vstack((_x.T, z)), **args) f.__doc__ = model.__doc__ # convert to 'model' format (i.e. takes a parameter vector) _model = lambda x: f(*x).tolist() _model.__doc__ = f.__doc__ mz = np.argmin(z) print("min: {}; min@f: {}".format(z[mz], f(*x[mz]))) mz = np.argmax(z) print("max: {}; max@f: {}".format(z[mz], f(*x[mz]))) # print("TOOK: %s" % (time.time() - start)) # plot ############# # specify 2-of-N dim (with bounds) and (N-2) with values axes = (0,1) # axes to plot (specified by user)
} ############# # get params (x) and cost (z) x, z = xyz.T[:,:-1], xyz.T[:,-1] #HACK: remove any duplicate points by adding noise _x = x + np.random.normal(scale=1e-8, size=x.shape) if len(z) > N: N = max(int(round(len(z)/float(N))),1) print "for speed, sampling {} down to {}".format(len(z),len(z)/N) x, _x, z = x[::N], _x[::N], z[::N] f = Rbf(*np.vstack((_x.T, z)), **args) f.__doc__ = model.__doc__ # convert to 'model' format (i.e. takes a parameter vector) _model = lambda x: f(*x).tolist() _model.__doc__ = f.__doc__ mz = np.argmin(z) print "min: {}; min@f: {}".format(z[mz], f(*x[mz])) mz = np.argmax(z) print "max: {}; max@f: {}".format(z[mz], f(*x[mz])) # print "TOOK: %s" % (time.time() - start) # plot ############# # specify 2-of-N dim (with bounds) and (N-2) with values axes = (0,1) # axes to plot (specified by user)