code: def test_binary_threshold_predictions():
      """Check prediction thresholding works correctly."""
      # Construct a random class probability matrix
      y = np.random.rand(10, 2)
      y_sums = np.sum(y, axis=1)
      y = y / y_sums[:, None]
      y_out = dc.metrics.threshold_predictions(y, threshold=0.3)
      assert y_out.shape == (10,)
      assert np.allclose(
          y_out, np.where(y[:, 1] >= 0.3, np.ones(10), np.zeros(10))
      )
  
imports: import pytest
  import deepchem
  import numpy
  import sklearn
  from deepchem.utils.evaluate import Evaluator
  from deepchem.utils.evaluate import GeneratorEvaluator
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_threshold_predictions() without return types