code: def _compute_predictions(pred_method, method_name, X, n_classes):
      """Return predictions for `X` and reshape binary outputs to shape
      (n_samples, 1).
  
      Parameters
      ----------
      pred_method : callable
          Prediction method.
  
      method_name: str
          Name of the prediction method
  
      X : array-like or None
          Data used to obtain predictions.
  
      n_classes : int
          Number of classes present.
  
      Returns
      -------
      predictions : array-like, shape (X.shape[0], len(clf.classes_))
          The predictions. Note if there are 2 classes, array is of shape
          (X.shape[0], 1).
      """
      predictions = pred_method(X=X)
  
      if method_name == "decision_function":
          if predictions.ndim == 1:
              predictions = predictions[:, np.newaxis]
      elif method_name == "predict_proba":
          if n_classes == 2:
              predictions = predictions[:, 1:]
      else:  # pragma: no cover
          # this branch should be unreachable.
          raise ValueError(f"Invalid prediction method: {method_name}")
      return predictions
  
imports: import warnings
  from functools import partial
  from inspect import signature
  from math import log
  from numbers import Integral, Real
  import numpy
  from scipy.optimize import fmin_bfgs
  from scipy.special import expit, xlogy
  from sklearn.utils import Bunch
  from .base import BaseEstimator, ClassifierMixin, MetaEstimatorMixin, RegressorMixin, _fit_context, clone
  from .isotonic import IsotonicRegression
  from .model_selection import check_cv, cross_val_predict
  from .preprocessing import LabelEncoder, label_binarize
  from .svm import LinearSVC
  from .utils import _safe_indexing, column_or_1d, indexable
  from .utils._param_validation import HasMethods, Hidden, Interval, StrOptions, validate_params
  from .utils._plotting import _BinaryClassifierCurveDisplayMixin
  from .utils.metadata_routing import MetadataRouter, MethodMapping, _routing_enabled, process_routing
  from .utils.multiclass import check_classification_targets
  from .utils.parallel import Parallel, delayed
  from .utils.validation import _check_fit_params, _check_pos_label_consistency, _check_sample_weight, _num_samples, check_consistent_length, check_is_fitted
label_desc: Use image node_id 3 for calling a global function with example usage: _compute_predictions(pred_method, method_name, X, n_classes) and returns: predictions