def __call__(self, model, train, algorithm): if (model.batches_seen % self.ais_interval) != 0: return (train_ll, test_ll, logz) = ais.estimate_likelihood(model, self.trainset, self.testset, large_ais=False) self.log(model, train_ll, test_ll, logz) if model.jobman_channel: model.jobman_channel.save()
def __call__(self, model, train, algorithm): if self.switch_at and (not self.has_switched) and model.epochs >= self.switch_at: self.switch_to_full_natural(model) # measure AIS periodically if (model.epochs % self.ais_interval) == 0: (train_ll, test_ll, logz) = ais.estimate_likelihood(model, self.trainset, self.testset, large_ais=False) if self.switch_threshold and model.epochs > 0 and (not self.has_switched): improv = train_ll - self.jobman_results['train_ll'] if improv < abs(self.switch_threshold * self.jobman_results['train_ll']): self.switch_to_full_natural(model) self.log(model, train_ll, test_ll, logz) if model.jobman_channel: model.jobman_channel.save()