searchers.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:deep_architect 作者: negrinho 项目源码 文件源码
def sample_models(self, nsamples):
        b = self.b_search

        samples = []
        choice_hists = []
        for _ in xrange(nsamples):
            bk = copy.deepcopy(b)
            bk.initialize(self.in_d, Scope())
            hist = []
            while( not bk.is_specified() ):
                name, vals = bk.get_choices()
                #print(name, vals)
                assert len(vals) > 1
                choice_i = np.random.randint(0, len(vals))
                bk.choose(choice_i)
                hist.append(choice_i)

            # keep the sampled model once specified.
            samples.append(bk)
            choice_hists.append(hist)

        return (samples, choice_hists)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号