evaluator.py 847 字节
Newer Older
武毅 已提交
1 2 3 4 5
import paddle.v2.framework.op as op
import numpy as np
import paddle.v2.framework.core as core


D
Dong Zhihong 已提交
6 7 8 9
class Evaluator(object):
    """
    Evalutor Base class.
    """
武毅 已提交
10

D
Dong Zhihong 已提交
11 12 13 14 15
    def __init__(self):
        """
       create metric states and append to block
       """
        pass
武毅 已提交
16

D
Dong Zhihong 已提交
17
    def _clear_state(self):
武毅 已提交
18
        """
D
Dong Zhihong 已提交
19 20 21
      clear metric states at the begin of each pass
      """
        pass
武毅 已提交
22

D
Dong Zhihong 已提交
23
    def _append_evalutor_op(self):
武毅 已提交
24
        """
D
Dong Zhihong 已提交
25 26 27 28
      add mini-batch caculate operators to block
      add increment operator to accumulate the metric state
      """
        pass
武毅 已提交
29

D
Dong Zhihong 已提交
30 31 32 33 34 35 36 37 38 39 40 41
    def _merge(self):
        """
      Merge the mini-batch statistics to form the evaluation result for multiple mini-batches.
      """
        pass

    def evaluate(self):
        """
      only one exported interface
      user calculate the result
      """
        pass