Table Of Contents
Table Of Contents, name=None, allow_extra_outputs=False)[source]

Creates a custom evaluation metric that receives its inputs as numpy arrays.

  • numpy_feval (callable(label, pred)) – Custom evaluation function that receives labels and predictions for a minibatch as numpy arrays and returns the corresponding custom metric as a floating point number.

  • name (str, optional) – Name of the custom metric.

  • allow_extra_outputs (bool, optional) – Whether prediction output is allowed to have extra outputs. This is useful in cases like RNN where states are also part of output which can then be fed back to the RNN in the next step. By default, extra outputs are not allowed.


Custom metric corresponding to the provided labels and predictions.

Return type



>>> def custom_metric(label, pred):
...     return np.mean(np.abs(label-pred))
>>> metric =