def update(self, member_i, grid_i, score): """ Update the model with the `score` obtained for `member_i` at index `grid_i` in the member's subspace.""" self.scores.append(score) self.members[member_i].add_data(self.grids[member_i][grid_i], score) # Optimize the model optimization.optimize_random_start(self.members[member_i], self.gp_priors)
def next(self): '''Return the next point to evaluate according to acquisition function. Returns a subspace index, the index in the given subspace and the corresponding learner parameters in a dict which is directly unpackable. ''' if self.gp.ndata < 2: # not enough points pick random parameters grid_i = np.random.choice(len(self.space)) else: # optimize the model optimization.optimize_random_start(self.gp, self.gp_priors) # pick the parameters maximizing the acquisition function mu, var = self.gp.posterior(self.space) acq = ei.expected_improvement(mu, var, self.gp.data[1]) grid_i = util.eq_rand_idx(acq, np.max(acq)) learner_i, learner_params = self.raw_to_learner_params( self.space[grid_i]) return grid_i, learner_i, learner_params