def _produceSamples(self): """ Append batch size new samples and evaluate them. """ reuseindices = [] if self.numLearningSteps == 0 or not self.importanceMixing: [ self._oneEvaluation(self._sample2base(self._produceSample())) for _ in range(self.batchSize) ] self._pointers = list( range( len(self._allEvaluated) - self.batchSize, len(self._allEvaluated))) else: reuseindices, newpoints = importanceMixing( list(map(self._base2sample, self._currentEvaluations)), self._oldpdf, self._newpdf, self._produceSample, self.forcedRefresh) [self._oneEvaluation(self._sample2base(s)) for s in newpoints] self._pointers = ([self._pointers[i] for i in reuseindices] + list( range( len(self._allEvaluated) - self.batchSize + len(reuseindices), len(self._allEvaluated)))) self._allGenSteps.append(self._allGenSteps[-1] + self.batchSize - len(reuseindices)) self._allPointers.append(self._pointers)
def _produceSamples(self): """ Append batch size new samples and evaluate them. """ reuseindices = [] if self.numLearningSteps == 0 or not self.importanceMixing: [self._oneEvaluation(self._sample2base(self._produceSample())) for _ in range(self.batchSize)] self._pointers = list(range(len(self._allEvaluated)-self.batchSize, len(self._allEvaluated))) else: reuseindices, newpoints = importanceMixing(map(self._base2sample, self._currentEvaluations), self._oldpdf, self._newpdf, self._produceSample, self.forcedRefresh) [self._oneEvaluation(self._sample2base(s)) for s in newpoints] self._pointers = ([self._pointers[i] for i in reuseindices]+ range(len(self._allEvaluated)-self.batchSize+len(reuseindices), len(self._allEvaluated))) self._allGenSteps.append(self._allGenSteps[-1]+self.batchSize-len(reuseindices)) self._allPointers.append(self._pointers)