code: def _assert_imperfect_score(scorer: Scorer, abs_tol=1e-5):
      """
      Ensure an imperfect prediction has an error greater than 0
      and a score less than the scorer's optimum for a given scorer.
      """
      y_true = np.array([0, 0, 1])
      y_pred = np.array([1.0, 1.0, 0.0])
      score = scorer(y_true, y_pred)
      assert score == scorer.score(y_true, y_pred)
      error = scorer.error(y_true, y_pred)
      assert error == scorer.convert_score_to_error(score)
      assert isclose(
          score, scorer.convert_error_to_score(error), abs_tol=abs_tol
      )
      assert error > 0
      assert score < scorer.optimum
      assert not isclose(error, 0, abs_tol=abs_tol)
      assert not isclose(score, scorer.optimum, abs_tol=abs_tol)
  
file_path: autogluon/core/tests/unittests/metrics/test_metrics.py
imports: from math import isclose
  import numpy
  import pytest
  import sklearn
  from autogluon.core.constants import BINARY, MULTICLASS, QUANTILE, REGRESSION
  from autogluon.core.metrics import METRICS, Scorer, rmse_func
label_desc: Use image node_id 9 for calling a global function with example usage: _assert_imperfect_score(scorer, abs_tol) without return types