code: def test_expected_calibration_error():
      pp = [0.1, 0.5, 0.8, 0.2]
      ac = [0.1, 0.3, 0.5, 0.8, 0.9]
      co = [0.15, 0.3, 0.55, 0.75, 0.92]
  
      # Test passing invalid parameter values, e.g., type.
      with pytest.raises(ValueError):
          expected_calibration_error(
              prediction_probabilities=pp, accuracy=ac, confidence=co
          )
  
      with pytest.raises(ValueError):
          expected_calibration_error(
              prediction_probabilities=pp,
              accuracy=np.array(ac),
              confidence=np.array(co),
          )
  
      with pytest.raises(ValueError):
          expected_calibration_error(
              prediction_probabilities=np.array(pp),
              accuracy=ac,
              confidence=np.array(co),
          )
  
      with pytest.raises(ValueError):
          expected_calibration_error(
              prediction_probabilities=np.array(pp),
              accuracy=np.array(ac),
              confidence=co,
          )
  
      # test different length for accuracy and confidence parameter
      with pytest.raises(ValueError):
          expected_calibration_error(
              prediction_probabilities=np.array(pp),
              accuracy=np.array([0.2, 0.5]),
              confidence=np.array([0.3, 0.5, 0.8]),
          )
  
      ece = expected_calibration_error(
          prediction_probabilities=np.array(pp),
          accuracy=np.array(ac),
          confidence=np.array(co),
      )
  
      assert ece > 0
  
file_path: stellargraph/tests/test_calibration.py
imports: import pytest
  import numpy
  from stellargraph.calibration import *
label_desc: Use image node_id 5 for calling a global function with example usage: test_expected_calibration_error() without return types