CompositeMetric¶
-
class
paddle.fluid.metrics.
CompositeMetric
( name=None ) [source] -
This op creates a container that contains the union of all the added metrics. After the metrics added in, calling eval() method will compute all the contained metrics automatically. CAUTION: only metrics with the SAME argument list can be added in a CompositeMetric instance.
Inherit from: MetricBase
- Parameters
-
name (str, optional) – Metric name. For details, please refer to Name. Default is None.
Examples
-
add_metric
( metric ) -
Add a new metric to container. Noted that the argument list of the added one should be consistent with existed ones.
- Parameters
-
metric (MetricBase) – a instance of MetricBase
-
update
( preds, labels ) -
Update the metrics of this container.
- Parameters
-
preds (numpy.array) – predicted results of current mini-batch, the shape and dtype of which should meet the requirements of the corresponded metric.
labels (numpy.array) – ground truth of current mini-batch, the shape and dtype of which should meet the requirements of the corresponded metric.
-
eval
( ) -
Calculate the results of all metrics sequentially.
- Returns
-
results of all added metrics. The shape and dtype of each result depend on the definition of its metric.
- Return type
-
list
-
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 function empties the evaluation memory for previous mini-batches.
- Parameters
-
None –
- Returns
-
None
- Return types:
-
None