Skip to content
Snippets Groups Projects
Commit a9181cf6 authored by Simon Will's avatar Simon Will
Browse files

Use sequence_accuracy as eval_metric

parent b74d47cc
No related branches found
No related tags found
No related merge requests found
......@@ -162,10 +162,10 @@ class JoeyModel:
valid_kwargs = {k: v for k, v in self.test_args.items()
if k not in ['decoding_description', 'tokenizer_info',
'tag_dict_file']}
valid_kwargs['eval_metric'] = ''
valid_kwargs['compute_loss'] = False
valid_kwargs['data'] = dataset
valid_kwargs.update(kwargs)
valid_kwargs['eval_metric'] = 'sequence_accuracy'
(score, loss, ppl, sources, sources_raw, references, hypotheses,
hypotheses_raw, valid_attention_scores) = validate_on_data(
......
......@@ -170,10 +170,11 @@ def train_n_rounds(config_basename, min_rounds=10):
logging.info('Validating on {} feedback pieces.'
.format(len(dev_set)))
results = model.validate(dev_set)
accuracy = results['score'] / 100
total = len(dev_set)
correct = results['score'] * total
correct = round(accuracy * total)
logging.info('Got validation result: {}/{} = {}.'
.format(correct, total, results['score']))
.format(correct, total, accuracy))
evr = EvaluationResult(label='running_dev', correct=correct,
total=total)
db.session.add(evr)
......@@ -232,10 +233,11 @@ def validate(config_basename):
logging.info('Validating on dev set.')
results = model.validate(dev_set)
accuracy = results['score'] / 100
total = len(dev_set)
correct = results['score'] * total
correct = round(accuracy * total)
logging.info('Got validation result: {}/{} = {}.'
.format(correct, total, results['score']))
.format(correct, total, accuracy))
evr = EvaluationResult(label='file_dev', correct=correct,
total=total)
db.session.add(evr)
......@@ -248,7 +250,3 @@ def validate(config_basename):
db.session.delete(lock)
db.session.commit()
correct = results['score']
total = len(dev_set)
EvaluationResult(label='changing_dev', correct=correct, total=total)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment