class_docstr: Base class for label propagation module.
  
  Parameters
  ----------
  kernel : {'knn', 'rbf', callable}
      String identifier for kernel function to use or the kernel function
      itself. Only 'rbf' and 'knn' strings are valid inputs. The function
      passed should take two inputs, each of shape [n_samples, n_features],
      and return a [n_samples, n_samples] shaped weight matrix
  
  gamma : float
      Parameter for rbf kernel
  
  n_neighbors : integer > 0
      Parameter for knn kernel
  
  alpha : float
      Clamping factor
  
  max_iter : integer
      Change maximum number of iterations allowed
  
  tol : float
      Convergence tolerance: threshold to consider the system at steady
      state
class_docstr_tok: ["Base","class","for","label","propagation","module",".","Parameters","--","--","--","--","--","kernel",":","{","'knn","'",",","'rbf","'",",","callable","}","String","identifier","for","kernel","function","to","use","or","the","kernel","function","itself",".","Only","'rbf","'","and","'knn","'","strings","are","valid","inputs",".","The","function","passed","should","take","two","inputs",",","each","of","shape","[","n_samples",",","n_features","]",",","and","return","a","[","n_samples",",","n_samples","]","shaped","weight","matrix","gamma",":","float","Parameter","for","rbf","kernel","n_neighbors",":","integer",">","0","Parameter","for","knn","kernel","alpha",":","float","Clamping","factor","max_iter",":","integer","Change","maximum","number","of","iterations","allowed","tol",":","float","Convergence","tolerance",":","threshold","to","consider","the","system","at","steady","state"]
docstr: Fit a semi-supervised label propagation model based
  
  All the input data is provided matrix X (labeled and unlabeled)
  and corresponding label matrix y with a dedicated marker value for
  unlabeled samples.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      A {n_samples by n_samples} size matrix will be created from this
  
  y : array_like, shape = [n_samples]
      n_labeled_samples (unlabeled points are marked as -1)
      All unlabeled samples will be transductively assigned labels
  
  Returns
  -------
  self : returns an instance of self.
docstr_tok: ["Fit","a","semi-supervised","label","propagation","model","based","All","the","input","data","is","provided","matrix","X","(","labeled","and","unlabeled",")","and","corresponding","label","matrix","y","with","a","dedicated","marker","value","for","unlabeled","samples",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","A","{","n_samples","by","n_samples","}","size","matrix","will","be","created","from","this","y",":","array_like",",","shape","=","[","n_samples","]","n_labeled_samples","(","unlabeled","points","are","marked","as","-1",")","All","unlabeled","samples","will","be","transductively","assigned","labels","Returns","--","--","--","-","self",":","returns","an","instance","of","self","."]
code: def fit(self, X, y, session=None, run_kwargs=None):
      """Fit a semi-supervised label propagation model based
  
      All the input data is provided matrix X (labeled and unlabeled)
      and corresponding label matrix y with a dedicated marker value for
      unlabeled samples.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          A {n_samples by n_samples} size matrix will be created from this
  
      y : array_like, shape = [n_samples]
          n_labeled_samples (unlabeled points are marked as -1)
          All unlabeled samples will be transductively assigned labels
  
      Returns
      -------
      self : returns an instance of self.
      """
      X, y = check_X_y(X, y)
      self.X_ = X
      to_run = [check_classification_targets(y)]
  
      # actual graph construction (implementations should override this)
      graph_matrix = self._build_graph()
  
      # label construction
      # construct a categorical distribution for classification only
      classes = mt.unique(y, aggregate_size=1).to_numpy(
          session=session, **(run_kwargs or dict())
      )
      classes = classes[classes != -1]
      self.classes_ = classes
  
      n_samples, n_classes = len(y), len(classes)
  
      alpha = self.alpha
      # add check when we support LabelSpreading
      # if self._variant == 'spreading' and \
      #         (alpha is None or alpha <= 0.0 or alpha >= 1.0):
      #     raise ValueError('alpha=%s is invalid: it must be inside '
      #                      'the open interval (0, 1)' % alpha)
      y = mt.asarray(y)
      unlabeled = y == -1
  
      # initialize distributions
      self.label_distributions_ = mt.zeros((n_samples, n_classes))
      for label in classes:
          self.label_distributions_[y == label, classes == label] = 1
  
      y_static = mt.copy(self.label_distributions_)
      if self._variant == "propagation":
          # LabelPropagation
          y_static[unlabeled] = 0
      else:  # pragma: no cover
          # LabelSpreading
          y_static *= 1 - alpha
  
      l_previous = mt.zeros((self.X_.shape[0], n_classes))
  
      unlabeled = unlabeled[:, mt.newaxis]
  
      for self.n_iter_ in range(self.max_iter):
          cond = (
              mt.abs(self.label_distributions_ - l_previous).sum()
              < self.tol
          )
  
          to_run.append(cond)
          ExecutableTuple(to_run).execute(
              session=session, **(run_kwargs or dict())
          )
          # clear
          to_run = []
  
          if cond.fetch(session=session):
              break
  
          l_previous = self.label_distributions_
          self.label_distributions_ = graph_matrix.dot(
              self.label_distributions_
          )
  
          if self._variant == "propagation":
              normalizer = mt.sum(self.label_distributions_, axis=1)[
                  :, mt.newaxis
              ]
              self.label_distributions_ /= normalizer
              self.label_distributions_ = mt.where(
                  unlabeled, self.label_distributions_, y_static
              )
          else:  # pragma: no cover
              # clamp
              self.label_distributions_ = (
                  mt.multiply(alpha, self.label_distributions_)
                  + y_static
              )
  
          to_run.append(self.label_distributions_)
      else:
          warnings.warn(
              f"max_iter={self.max_iter} was reached without convergence.",
              category=ConvergenceWarning,
          )
          self.n_iter_ += 1
  
      normalizer = mt.sum(self.label_distributions_, axis=1)[
          :, mt.newaxis
      ]
      self.label_distributions_ /= normalizer
  
      # set the transduction item
      transduction = mt.tensor(self.classes_)[
          mt.argmax(self.label_distributions_, axis=1)
      ]
      self.transduction_ = transduction.ravel()
      ExecutableTuple(
          [self.label_distributions_, self.transduction_]
      ).execute(session=session, **(run_kwargs or dict()))
      return self
  
imports: import warnings
  from abc import ABCMeta, abstractmethod
  from sklearn.base import BaseEstimator
  from sklearn.exceptions import ConvergenceWarning
  from ...None import tensor
  from ...core import ExecutableTuple
  from ..base import ClassifierMixin
  from ..metrics.pairwise import rbf_kernel
  from ..neighbors.unsupervised import NearestNeighbors
  from ..utils import check_array
  from ..utils.multiclass import check_classification_targets
  from ..utils.validation import check_is_fitted, check_X_y
label_desc: Use image node_id 6 for calling the BaseLabelPropagation obj's underlying member method code with example usage: obj.fit(X, y, session, run_kwargs) and returns: self