def init(self, init_points, return_log):
'''A function to perform all initialization and clear the optimize methods - To be constructed'''
if self.randomstate != None:
numpy.random.seed(self.randomstate)
print('Optimization procedure is initializing at %i random points.' % init_points)
#Sampling some points are random to define xtrain.
xtrain = numpy.asarray([numpy.random.uniform(x[0], x[1], size = init_points) for x in self.log_bounds]).T
ytrain = []
for x in xtrain :
ytrain.append(self.f(dict(zip(self.keys, return_log(x)))))
print('%d points initialized.' % len(ytrain))
ytrain = numpy.asarray(ytrain)
print('Optimization procedure is done initializing.')
return xtrain, ytrain
# ----------------------- // ----------------------- # ----------------------- // ----------------------- #
评论列表
文章目录