code: def test_metric(self):
      # metric not in XGB_METRIC_NAME but in Evaluator.metrics_func.keys()
      self.model.fit_eval(
          data=(self.x, self.y),
          validation_data=[(self.val_x, self.val_y)],
          metric="mse",
      )
      # metric in XGB_METRIC_NAME
      self.model.fit_eval(
          data=(self.x, self.y),
          validation_data=[(self.val_x, self.val_y)],
          metric="rmsle",
      )
  
      with pytest.raises(RuntimeError):
          self.model.fit_eval(
              data=(self.x, self.y),
              validation_data=[(self.val_x, self.val_y)],
              metric="wrong_metric",
          )
  
      # metric func
      def pyrmsle(y_true, y_pred):
          y_pred[y_pred < -1] = -1 + 1e-6
          elements = np.power(np.log1p(y_true) - np.log1p(y_pred), 2)
          return float(np.sqrt(np.sum(elements) / len(y_true)))
  
      result = self.model.fit_eval(
          data=(self.x, self.y),
          validation_data=[(self.val_x, self.val_y)],
          metric_func=pyrmsle,
      )
      assert "pyrmsle" in result
  
file_path: BigDL/python/orca/test/bigdl/orca/automl/xgboost/test_xgbregressor.py
imports: from bigdl.orca.test_zoo_utils import ZooTestCase
  import numpy
  import pandas
  import os
  from numpy.testing import assert_array_almost_equal
  from bigdl.orca.automl.xgboost.XGBoost import XGBoost, XGBoostModelBuilder
  import pytest
label_desc: Use image node_id 5 for calling the TestXgbregressor obj's underlying member method code with example usage: obj.test_metric() and returns: float