code: def test_fit_metric_func(self):
      auto_est = AutoEstimator.from_keras(
          model_creator=model_creator,
          logs_dir="/tmp/zoo_automl_logs",
          resources_per_trial={"cpu": 2},
          name="test_fit",
      )
  
      data, validation_data = get_train_val_data()
  
      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)))
  
      with pytest.raises(RuntimeError) as exeinfo:
          auto_est.fit(
              data=data,
              validation_data=validation_data,
              search_space=create_linear_search_space(),
              n_sampling=2,
              epochs=2,
              metric=pyrmsle,
          )
      assert "metric_mode" in str(exeinfo)
  
      auto_est.fit(
          data=data,
          validation_data=validation_data,
          search_space=create_linear_search_space(),
          n_sampling=2,
          epochs=2,
          metric=pyrmsle,
          metric_mode="min",
      )
  
imports: import tensorflow
  import numpy
  from unittest import TestCase
  from bigdl.orca.automl.auto_estimator import AutoEstimator
  import pytest
label_desc: Use image node_id 7 for calling the TestTFKerasAutoEstimator obj's underlying member method code with example usage: obj.test_fit_metric_func() and returns: float