mindspore.train.get_metric_fn

mindspore.train.get_metric_fn(name, *args, **kwargs)[source]

Gets the metric method based on the input name.

Parameters
  • name (str) – The name of metric method. Names can be obtained by mindspore.train.names() . object for the currently supported metrics.

  • args – Arguments for the metric function.

  • kwargs – Keyword arguments for the metric function.

Returns

Metric object, class instance of the metric method.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore.train import get_metric_fn
>>> metric = get_metric_fn('precision', eval_type='classification')