code: def _sigmoid_calibration(df, y, sample_weight=None):
      """Probability Calibration with sigmoid method (Platt 2000)
  
      Parameters
      ----------
      df : ndarray, shape (n_samples,)
          The decision function or predict proba for the samples.
  
      y : ndarray, shape (n_samples,)
          The targets.
  
      sample_weight : array-like, shape = [n_samples] or None
          Sample weights. If None, then samples are equally weighted.
  
      Returns
      -------
      a : float
          The slope.
  
      b : float
          The intercept.
  
      References
      ----------
      Platt, "Probabilistic Outputs for Support Vector Machines"
      """
      df = column_or_1d(df)
      y = column_or_1d(y)
  
      F = df  # F follows Platt's notations
      tiny = np.finfo(np.float).tiny  # to avoid division by 0 warning
  
      # Bayesian priors (see Platt end of section 2.2)
      prior0 = float(np.sum(y <= 0))
      prior1 = y.shape[0] - prior0
      T = np.zeros(y.shape)
      T[y > 0] = (prior1 + 1.0) / (prior1 + 2.0)
      T[y <= 0] = 1.0 / (prior0 + 2.0)
      T1 = 1.0 - T
  
      def objective(AB):
          # From Platt (beginning of Section 2.2)
          E = np.exp(AB[0] * F + AB[1])
          P = 1.0 / (1.0 + E)
          l = -(T * np.log(P + tiny) + T1 * np.log(1.0 - P + tiny))
          if sample_weight is not None:
              return (sample_weight * l).sum()
          else:
              return l.sum()
  
      def grad(AB):
          # gradient of the objective function
          E = np.exp(AB[0] * F + AB[1])
          P = 1.0 / (1.0 + E)
          TEP_minus_T1P = P * (T * E - T1)
          if sample_weight is not None:
              TEP_minus_T1P *= sample_weight
          dA = np.dot(TEP_minus_T1P, F)
          dB = np.sum(TEP_minus_T1P)
          return np.array([dA, dB])
  
      AB0 = np.array([0.0, log((prior0 + 1.0) / (prior1 + 1.0))])
      AB_ = fmin_bfgs(objective, AB0, fprime=grad, disp=False)
      return AB_[0], AB_[1]
  
imports: from __future__ import division
  import warnings
  from math import log
  import numpy
  from scipy.optimize import fmin_bfgs
  from sklearn.preprocessing import LabelEncoder
  from .base import BaseEstimator, ClassifierMixin, RegressorMixin, clone
  from .preprocessing import label_binarize, LabelBinarizer
  from .utils import check_X_y, check_array, indexable, column_or_1d
  from .utils.validation import check_is_fitted
  from .utils.fixes import signature
  from .isotonic import IsotonicRegression
  from .svm import LinearSVC
  from .model_selection import check_cv
  from .metrics.classification import _check_binary_probabilistic_predictions
label_desc: Use image node_id 1 for calling a global function with example usage: _sigmoid_calibration(df, y, sample_weight) and returns: AB_,  AB_, np, unknown, l