confusing selection of evaluator
Created by: pengwangucla
I want to write new evaluator for my project.
I check this example that run evaluator during training:
def event_handler(event):
if isinstance(event, paddle.event.EndIteration):
if event.batch_id % 1000 == 0:
print "Pass %d, Batch %d, Cost %f, %s" % (
event.pass_id, event.batch_id, event.cost, event.metrics)
with gzip.open('params.tar.gz', 'w') as f:
parameters.to_tar(f)
elif isinstance(event, paddle.event.EndPass):
result = trainer.test(reader=paddle.batch(
paddle.dataset.mnist.test(), batch_size=128))
print "Test with Pass %d, Cost %f, %s\n" % (
event.pass_id, result.cost, result.metrics)
lists.append((event.pass_id, result.cost,
result.metrics['classification_error_evaluator']))
I found it is confusing that the evaluation method is select after result is returned. Is it correct that the method of evaluation should be selected in trainer.test(...) ? So that the network return the correct metric.
Can someone explain or better organize the arguments ?
@reyoung @luotao1 @lcy-seso