def __call__(self): for index, epoch in make_prod(self.config): base_dir = make_base_dir(index, self.dataset, 'valid', epoch) base_dir.mkdir(parents=True, exist_ok=True) checkpoint_path = get_checkpoint_path(index, epoch) self.write(base_dir, checkpoint_path, self.buffer_size, self.source)
def __call__(self): for result in self.make_result_table().maximum_list(): base_dir = make_base_dir(result.index, self.dataset, 'test', result.epoch) base_dir.mkdir(parents=True, exist_ok=True) checkpoint_path = get_checkpoint_path(result.index, result.epoch) self.write(base_dir, checkpoint_path, self.buffer_size, self.source)
def test_single_errant_result(dataset): valid_tab = ErrantCat2ResultTable(dataset, 'valid') test_lst = [] for valid_result in valid_tab.maximum_list(): result_path = make_base_dir(valid_result.index, dataset, 'test', valid_result.epoch) / 'result.cat2' if result_path.exists(): test_lst.append(ErrantCat2Result(valid_result.index, valid_result.epoch, result_path)) lst = [result.cat_score() for result in test_lst] lst = [np.mean(tup) for tup in zip(*lst)] return lst
def show_test_single_results(dataset, valid_result_table_class, test_result_class): valid_result_table = valid_result_table_class(dataset, 'valid') test_result_list = [] for valid_result in valid_result_table.maximum_list(): base_dir = make_base_dir(valid_result.index, dataset, 'test', valid_result.epoch) result_path = base_dir / 'result.res' if result_path.exists(): test_result = test_result_class(valid_result.index, valid_result.epoch, result_path) test_result_list.append(test_result) print('index {}: {} ({})'.format(test_result.index, test_result.gleu, test_result.epoch)) if len(test_result_list) > 0: ave = np.mean([result.gleu for result in test_result_list]) print('average: {}'.format(ave))
def show_test_single_results(dataset, valid_result_table_class, test_result_class): valid_result_table = valid_result_table_class(dataset, 'valid') test_result_list = [] for valid_result in valid_result_table.maximum_list(): base_dir = make_base_dir(valid_result.index, dataset, 'test', valid_result.epoch) result_path = base_dir / 'result.res' if result_path.exists(): try: test_result = test_result_class(valid_result.index, valid_result.epoch, result_path) test_result_list.append(test_result) print('index {}: {} ({}, {}, {})'.format( test_result.index, test_result.f, test_result.p, test_result.r, test_result.epoch)) except IndexError: pass if len(test_result_list) > 0: ave_p, ave_r, ave_f = list_average_score(test_result_list) print('average: {} ({}, {})'.format(ave_f, ave_p, ave_r))
def __call__(self): for result in self.make_result_table().maximum_list(): self.write( make_base_dir(result.index, self.dataset, 'test', result.epoch))
def __call__(self): for index, epoch in make_prod(self.config): self.write(make_base_dir(index, self.dataset, 'valid', epoch))
def make(self): for result in self.make_result_table().maximum_list(): self.append_command(make_base_dir(result.index, self.dataset, self.stage, result.epoch))
def make(self): for index, epoch in make_prod(self.config): self.append_command(make_base_dir(index, self.dataset, self.stage, epoch))
def make(self): for epoch in make_epoch_list(self.config): base_dir = make_base_dir(self.index, self.dataset, self.stage, epoch) self.add(epoch, base_dir / 'result.cat2')