code: def test_ovr_decision_function():
      # test properties for ovr decision function
  
      predictions = np.array(
          [[0, 1, 1], [0, 1, 0], [0, 1, 1], [0, 1, 1]]
      )
  
      confidences = np.array(
          [
              [-1e16, 0, -1e16],
              [1.0, 2.0, -3.0],
              [-5.0, 2.0, 5.0],
              [-0.5, 0.2, 0.5],
          ]
      )
  
      n_classes = 3
  
      dec_values = _ovr_decision_function(
          predictions, confidences, n_classes
      )
  
      # check that the decision values are within 0.5 range of the votes
      votes = np.array([[1, 0, 2], [1, 1, 1], [1, 0, 2], [1, 0, 2]])
  
      assert_allclose(votes, dec_values, atol=0.5)
  
      # check that the prediction are what we expect
      # highest vote or highest confidence if there is a tie.
      # for the second sample we have a tie (should be won by 1)
      expected_prediction = np.array([2, 1, 2, 2])
      assert_array_equal(
          np.argmax(dec_values, axis=1), expected_prediction
      )
  
      # third and fourth sample have the same vote but third sample
      # has higher confidence, this should reflect on the decision values
      assert dec_values[2, 2] > dec_values[3, 2]
  
      # assert subset invariance.
      dec_values_one = [
          _ovr_decision_function(
              np.array([predictions[i]]),
              np.array([confidences[i]]),
              n_classes,
          )[0]
          for i in range(4)
      ]
  
      assert_allclose(dec_values, dec_values_one, atol=1e-6)
  
imports: from itertools import product
  import numpy
  import pytest
  from scipy.sparse import issparse
  from sklearn import config_context, datasets
  from sklearn.model_selection import ShuffleSplit
  from sklearn.svm import SVC
  from sklearn.utils._array_api import yield_namespace_device_dtype_combinations
  from sklearn.utils._testing import _array_api_for_tests, assert_allclose, assert_array_almost_equal, assert_array_equal
  from sklearn.utils.estimator_checks import _NotAnArray
  from sklearn.utils.fixes import COO_CONTAINERS, CSC_CONTAINERS, CSR_CONTAINERS, DOK_CONTAINERS, LIL_CONTAINERS
  from sklearn.utils.metaestimators import _safe_split
  from sklearn.utils.multiclass import _ovr_decision_function, check_classification_targets, class_distribution, is_multilabel, type_of_target, unique_labels
label_desc: Use image node_id 14 for calling a global function with example usage: test_ovr_decision_function() without return types