code: def test_kappa_score():
      y_true = [1, 0, 1, 0]
      y_pred = [0.8, 0.2, 0.3, 0.4]  # [1, 0, 0, 0] with 0.5 threshold
      kappa = dc.metrics.kappa_score(y_true, np.greater(y_pred, 0.5))
      observed_agreement = 3.0 / 4.0
      expected_agreement = ((2 * 1) + (2 * 3)) / 4.0**2
      expected_kappa = np.true_divide(
          observed_agreement - expected_agreement,
          1.0 - expected_agreement,
      )
      np.testing.assert_almost_equal(kappa, expected_kappa)
  
file_path: deepchem/deepchem/metrics/tests/test_metrics.py
imports: import numpy
  import deepchem
label_desc: Use image node_id 1 for calling a global function with example usage: test_kappa_score() without return types