Recall¶
- class paddle.fluid.metrics. Recall ( name=None ) [source]
- 
         Recall (also known as sensitivity) is the fraction of relevant instances that have been retrieved over the total amount of relevant instances Refer to: https://en.wikipedia.org/wiki/Precision_and_recall Noted that this class manages the recall score only for binary classification task. - Parameters
- 
           name (str, optional) – Metric name. For details, please refer to Name. Default is None. 
 Examples import paddle.fluid as fluid import numpy as np metric = fluid.metrics.Recall() # generate the preds and labels preds = [[0.1], [0.7], [0.8], [0.9], [0.2], [0.2], [0.3], [0.5], [0.8], [0.6]] labels = [[0], [1], [1], [1], [1], [0], [0], [0], [0], [0]] preds = np.array(preds) labels = np.array(labels) metric.update(preds=preds, labels=labels) numpy_recall = metric.eval() print("expect recall: %.2f and got %.2f" % ( 3.0 / 4.0, numpy_recall)) - 
            
           update
           (
           preds, 
           labels
           )
           update¶
- 
           Update the recall based on the current mini-batch prediction results. - Parameters
- 
             - preds (numpy.array) – prediction results of current mini-batch, the output of two-class sigmoid function. Shape: [batch_size, 1]. Dtype: ‘float64’ or ‘float32’. 
- labels (numpy.array) – ground truth (labels) of current mini-batch, the shape should keep the same as preds. Shape: [batch_size, 1], Dtype: ‘int32’ or ‘int64’. 
 
 
 - 
            
           eval
           (
           )
           eval¶
- 
           Calculate the final recall. - Returns
- 
             results of the calculated Recall. Scalar output with float dtype. 
- Return type
- 
             float 
 
 - 
            
           get_config
           (
           )
           get_config¶
- 
           Get the metric and current states. The states are the members who do not has “_” prefix. - Parameters
- 
             None – 
- Returns
- 
             a python dict, which contains the inner states of the metric instance 
 - Return types:
- 
             a python dict 
 
 - 
            
           reset
           (
           )
           reset¶
- 
           reset function empties the evaluation memory for previous mini-batches. - Parameters
- 
             None – 
- Returns
- 
             None 
 - Return types:
- 
             None 
 
 
