code: def test_predict_predict_proba(self, net, data, threshold):
      X, y = data
      net.threshold = threshold
      net.fit(X, y)
  
      y_pred_proba = net.predict_proba(X)
      assert y_pred_proba.shape == (X.shape[0], 2)
  
      # The tests below check that we don't accidentally apply sigmoid twice,
      # which would result in probabilities constrained to [expit(-1),
      # expit(1)]. The lower bound is not expit(0), as one may think at first,
      # because we create the probabilities as:
      # torch.stack((1 - prob, prob), 1)
      # So the lowest value that could be achieved by applying sigmoid twice
      # is 1 - expit(1), which is equal to expit(-1).
      prob_min, prob_max = expit(-1), expit(1)
      assert (y_pred_proba < prob_min).any()
      assert (y_pred_proba > prob_max).any()
  
      y_pred_exp = (y_pred_proba[:, 1] > threshold).astype("uint8")
  
      y_pred_actual = net.predict(X)
      assert np.allclose(y_pred_exp, y_pred_actual)
  
imports: from unittest.mock import Mock
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.base import clone
  from torch import nn
  from skorch.tests.conftest import INFERENCE_METHODS
label_desc: Use image node_id 12 for calling the TestNeuralNetBinaryClassifier obj's underlying member method code with example usage: obj.test_predict_predict_proba(net, data, threshold) without return types