darch/searchers.py
def sample_new_epoch(self, nsamples):
        """Generates random specified models in the search space and evaluates
        them based on the currect surrogate model.

        The function returns the epoch number, the specified models, and the
        scores output by the surrogate function.

        """

        epoch_i = self.epoch_i
        samples = []
        scores = []
        choice_hists = []

        for _ in xrange(nsamples):
            bk = copy.deepcopy(self.b_search)
            bk.initialize(self.in_d, Scope())
            hist = []

            while( not bk.is_specified() ):
                _, vals = bk.get_choices()
                choice_i = np.random.randint(0, len(vals))
                bk.choose(choice_i)
                hist.append(choice_i)

            sc = self.predict_score(bk)
            samples.append(bk)
            scores.append(sc)
            choice_hists.append( tuple(hist) )

        sorting_inds = np.argsort(scores)[::-1]
        samples = [samples[i] for i in sorting_inds]
        scores = [scores[i] for i in sorting_inds]
        choice_hists = [choice_hists[i] for i in sorting_inds]

        self.sample_hist[epoch_i] = samples
        self.histories[epoch_i] = choice_hists
        self.epoch_i += 1

        return (epoch_i, tuple(samples), tuple(choice_hists), tuple(scores))
Generates random specified models in the search space and evaluates
        them based on the currect surrogate model.

        The function returns the epoch number, the specified models, and the
        scores output by the surrogate function.

        
Generates random specified models in the search space and evaluates
them based on the currect surrogate model.

The function returns the epoch number, the specified models, and the
scores output by the surrogate function.
Generates random specified models in the search space and evaluates them based on the currect surrogate model . The function returns the epoch number the specified models and the scores output by the surrogate function .
def sample_new_epoch(self, nsamples):
        epoch_i = self.epoch_i
        samples = []
        scores = []
        choice_hists = []
        for _ in xrange(nsamples):
            bk = copy.deepcopy(self.b_search)
            bk.initialize(self.in_d, Scope())
            hist = []
            while( not bk.is_specified() ):
                _, vals = bk.get_choices()
                choice_i = np.random.randint(0, len(vals))
                bk.choose(choice_i)
                hist.append(choice_i)
            sc = self.predict_score(bk)
            samples.append(bk)
            scores.append(sc)
            choice_hists.append( tuple(hist) )
        sorting_inds = np.argsort(scores)[::-1]
        samples = [samples[i] for i in sorting_inds]
        scores = [scores[i] for i in sorting_inds]
        choice_hists = [choice_hists[i] for i in sorting_inds]
        self.sample_hist[epoch_i] = samples
        self.histories[epoch_i] = choice_hists
        self.epoch_i += 1
        return (epoch_i, tuple(samples), tuple(choice_hists), tuple(scores))
def sample_new_epoch ( self , nsamples ) : epoch_i = self . epoch_i samples = [ ] scores = [ ] choice_hists = [ ] for _ in xrange ( nsamples ) : bk = copy . deepcopy ( self . b_search ) bk . initialize ( self . in_d , Scope ( ) ) hist = [ ] while ( not bk . is_specified ( ) ) : _ , vals = bk . get_choices ( ) choice_i = np . random . randint ( 0 , len ( vals ) ) bk . choose ( choice_i ) hist . append ( choice_i ) sc = self . predict_score ( bk ) samples . append ( bk ) scores . append ( sc ) choice_hists . append ( tuple ( hist ) ) sorting_inds = np . argsort ( scores ) [ : : - 1 ] samples = [ samples [ i ] for i in sorting_inds ] scores = [ scores [ i ] for i in sorting_inds ] choice_hists = [ choice_hists [ i ] for i in sorting_inds ] self . sample_hist [ epoch_i ] = samples self . histories [ epoch_i ] = choice_hists self . epoch_i += 1 return ( epoch_i , tuple ( samples ) , tuple ( choice_hists ) , tuple ( scores ) )
Generates random specified models in the search space and evaluates
them based on the currect surrogate model.
Generates random specified models in the search space and evaluates them based on the currect surrogate model .
"""Generates random specified models in the search space and evaluates
        them based on the currect surrogate model.

        The function returns the epoch number, the specified models, and the
        scores output by the surrogate function.

        """
self
nsamples