code: def __call__(cls, **kwargs):
      metric_obj = cls.__new__(cls)
      params = {k: v for k, v in cls._valid_params.items()}
      param_is_set = {
          param: not mandatory
          for param, mandatory in cls._is_mandatory_param.items()
      }
  
      # Overwrite default parameters and check that all passed parameters are valid.
      for param, value in kwargs.items():
          if param not in cls._valid_params:
              raise ValueError("Unexpected parameter {}".format(param))
          params[param] = value
          param_is_set[param] = True
  
      # Check that no parameters are left unset.
      for param, is_set in param_is_set.items():
          if not is_set:
              raise ValueError(
                  "Parameter {} is mandatory and must be specified.".format(
                      param
                  )
              )
  
      for param, value in params.items():
          _set_param(metric_obj, value, param)
      metric_obj._params = list(params.keys())
  
      return metric_obj
  
imports: from functools import partial
  import numpy
  from .None import _catboost
label_desc: Use image node_id 2 for calling the _MetricGenerator obj's underlying member method code with example usage: obj.__call__(cls) and returns: metric_obj