code: def test_classification_binary():
      """
      Expects
      -------
      * Correct scores from CLASSIFICATION_METRICS for binary classification.
      """
      for (
          metric,
          scorer,
      ) in autosklearn.metrics.CLASSIFICATION_METRICS.items():
          # Skip functions not applicable for binary classification.
          # TODO: Average precision should work for binary classification,
          # TODO: but its behavior is not right. When y_pred is completely
          # TODO: wrong, it does return 0.5, but when it is not completely
          # TODO: wrong, it returns value smaller than 0.5.
          if metric in [
              "average_precision",
              "precision_samples",
              "recall_samples",
              "f1_samples",
          ]:
              continue
  
          y_true = np.array([1.0, 1.0, 1.0, 0.0, 0.0, 0.0])
  
          y_pred_list = [
              np.array(
                  [
                      [0.0, 1.0],
                      [0.0, 1.0],
                      [0.0, 1.0],
                      [1.0, 0.0],
                      [1.0, 0.0],
                      [1.0, 0.0],
                  ]
              ),
              np.array(
                  [
                      [0.0, 1.0],
                      [1.0, 0.0],
                      [0.0, 1.0],
                      [1.0, 0.0],
                      [0.0, 1.0],
                      [1.0, 0.0],
                  ]
              ),
              np.array(
                  [
                      [0.0, 1.0],
                      [1.0, 0.0],
                      [1.0, 0.0],
                      [0.0, 1.0],
                      [0.0, 1.0],
                      [0.0, 1.0],
                  ]
              ),
              np.array(
                  [
                      [1.0, 0.0],
                      [1.0, 0.0],
                      [1.0, 0.0],
                      [0.0, 1.0],
                      [0.0, 1.0],
                      [0.0, 1.0],
                  ]
              ),
          ]
  
          score_list = [
              scorer(y_true, y_pred) for y_pred in y_pred_list
          ]
  
          assert scorer._optimum == pytest.approx(score_list[0])
          assert score_list == sorted(score_list, reverse=True)
  
imports: import warnings
  import numpy
  import sklearn.metrics
  import autosklearn.metrics
  from autosklearn.constants import BINARY_CLASSIFICATION, REGRESSION
  from autosklearn.metrics import calculate_losses, calculate_scores, compute_single_metric
  import pytest
  import unittest
label_desc: Use image node_id 6 for calling a global function with example usage: test_classification_binary() without return types