import abc


class BaseMetric(abc.ABC):
    ALIAS = 'base_metric'

    @abc.abstractmethod
    def __call__(self, y_true, y_pred):
        """"""

    def __repr__(self):
        return self.ALIAS

@@ -190,8 +190,398 @@
 f.ALIAS%0A
+%0A%0Adef parse_metric(metric):%0A    if isinstance(metric, BaseMetric):%0A        return metric%0A    elif isinstance(metric, str):%0A        for subclass in BaseMetric.__subclasses__():%0A            if metric == subclass.ALIAS or metric in subclass.ALIAS:%0A                return subclass()%0A        return metric  # keras native metrics%0A    elif issubclass(metric, BaseMetric):%0A        return metric()%0A

Add metric parser