code: def test_evaluate_regression_optimiser():
      """Test evaluate method of Optimiser class for regression."""
      reader = Reader(sep=",")
      dict = reader.train_test_split(
          Lpath=[
              "data_for_tests/train_regression.csv",
              "data_for_tests/test_regression.csv",
          ],
          target_name="SalePrice",
      )
      drift_thresholder = Drift_thresholder()
      drift_thresholder = drift_thresholder.fit_transform(dict)
  
      mape = make_scorer(
          lambda y_true, y_pred: 100
          * np.sum(np.abs(y_true - y_pred) / y_true)
          / len(y_true),
          greater_is_better=False,
          needs_proba=False,
      )
      with pytest.warns(UserWarning) as record:
          opt = Optimiser(scoring=mape, n_folds=3)
      assert len(record) == 1
      score = opt.evaluate(None, dict)
      assert -np.Inf <= score
  
      with pytest.warns(UserWarning) as record:
          opt = Optimiser(scoring=None, n_folds=3)
      assert len(record) == 1
      score = opt.evaluate(None, dict)
      assert -np.Inf <= score
  
      with pytest.warns(UserWarning) as record:
          opt = Optimiser(scoring="wrong_scoring", n_folds=3)
      assert len(record) == 1
      with pytest.warns(UserWarning) as record:
          score = opt.evaluate(None, dict)
      assert -np.Inf <= score
  
file_path: MLBox/tests/test_optimiser.py
imports: import pytest
  import numpy
  from mlbox.optimisation.optimiser import Optimiser
  from mlbox.preprocessing.drift_thresholder import Drift_thresholder
  from mlbox.preprocessing.reader import Reader
  from mlbox.optimisation import make_scorer
label_desc: Use image node_id 5 for calling a global function with example usage: test_evaluate_regression_optimiser() without return types