ChunkEvaluator

class paddle.fluid.evaluator. ChunkEvaluator ( input, label, chunk_scheme, num_chunk_types, excluded_chunk_types=None ) [source]

Warning: This would be deprecated in the future. Please use fluid.metrics.ChunkEvaluator instead.

Accumulate counter numbers output by chunk_eval from mini-batches and compute the precision recall and F1-score using the accumulated counter numbers. For some basics of chunking, please refer to ‘Chunking with Support Vector Machines <https://aclanthology.info/pdf/N/N01/N01-1025.pdf>’.

Parameters
  • input (Variable) – prediction output of the network.

  • label (Variable) – label of the test data set.

  • chunk_scheme (str) – can be IOB/IOE/IOBES and IO. See the chunk_eval op for details.

  • num_chunk_types (int) – the number of chunk type.

  • excluded_chunk_types (list) – A list including chunk type ids, indicating chunk types that are not counted.

Returns

tuple containing: precision, recall, f1_score

Return type

tuple

Examples

exe = fluid.executor(place)
evaluator = fluid.Evaluator.ChunkEvaluator(input, label)
for epoch in PASS_NUM:
    evaluator.reset(exe)
    for data in batches:
        loss = exe.run(fetch_list=[cost])
    distance, instance_error = distance_evaluator.eval(exe)
eval ( executor, eval_program=None )

eval

Evaluate the statistics merged by multiple mini-batches. :param executor: a executor for executing the eval_program :type executor: Executor|ParallelExecutor :param eval_program: a single Program for eval process :type eval_program: Program

reset ( executor, reset_program=None )

reset

reset metric states at the begin of each pass/user specified batch

Parameters
  • executor (Executor|ParallelExecutor) – a executor for executing the reset_program

  • reset_program (Program) – a single Program for reset process