def __init__(self, opt, shared=None):
"""Initialize the parameters of the DefaultTeacher"""
assert opt['train_part'] + opt['test_part'] + opt['valid_part'] == 1
self.parts = [opt['train_part'], opt['valid_part'], opt['test_part']]
# store datatype
self.dt = opt['datatype'].split(':')[0]
self.opt = opt
opt['datafile'] = _path(opt)
# store identifier for the teacher in the dialog
self.id = 'ner_teacher'
random_state = random.getstate()
random.seed(opt.get('teacher_seed'))
self.random_state = random.getstate()
random.setstate(random_state)
if shared and shared.get('metrics'):
self.metrics = shared['metrics']
else:
self.metrics = CoNLLClassificationMetrics(opt['model_file'])
# define standard question, since it doesn't change for this task
super().__init__(opt, shared)
评论列表
文章目录