class_docstr: Label Propagation classifier
  
  Read more in the :ref:`User Guide <label_propagation>`.
  
  Parameters
  ----------
  kernel : {'knn', 'rbf'}
      String identifier for kernel function to use.
      Only 'rbf' and 'knn' kernels are currently supported..
  
  gamma : float
      Parameter for rbf kernel
  
  n_neighbors : integer > 0
      Parameter for knn kernel
  
  alpha : float
      Clamping factor
  
  max_iter : float
      Change maximum number of iterations allowed
  
  tol : float
      Convergence tolerance: threshold to consider the system at steady
      state
  
  Attributes
  ----------
  X_ : array, shape = [n_samples, n_features]
      Input array.
  
  classes_ : array, shape = [n_classes]
      The distinct labels used in classifying instances.
  
  label_distributions_ : array, shape = [n_samples, n_classes]
      Categorical distribution for each item.
  
  transduction_ : array, shape = [n_samples]
      Label assigned to each item via the transduction.
  
  n_iter_ : int
      Number of iterations run.
  
  Examples
  --------
  >>> from sklearn import datasets
  >>> from sklearn.semi_supervised import LabelPropagation
  >>> label_prop_model = LabelPropagation()
  >>> iris = datasets.load_iris()
  >>> random_unlabeled_points = np.where(np.random.randint(0, 2,
  ...    size=len(iris.target)))
  >>> labels = np.copy(iris.target)
  >>> labels[random_unlabeled_points] = -1
  >>> label_prop_model.fit(iris.data, labels)
  ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
  LabelPropagation(...)
  
  References
  ----------
  Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data
  with label propagation. Technical Report CMU-CALD-02-107, Carnegie Mellon
  University, 2002 http://pages.cs.wisc.edu/~jerryzhu/pub/CMU-CALD-02-107.pdf
  
  See Also
  --------
  LabelSpreading : Alternate label propagation strategy more robust to noise
class_docstr_tok: ["Label","Propagation","classifier","Read","more","in","the",":","ref",":","`","User","Guide","<","label_propagation",">","`",".","Parameters","--","--","--","--","--","kernel",":","{","'knn","'",",","'rbf","'","}","String","identifier","for","kernel","function","to","use",".","Only","'rbf","'","and","'knn","'","kernels","are","currently","supported","..","gamma",":","float","Parameter","for","rbf","kernel","n_neighbors",":","integer",">","0","Parameter","for","knn","kernel","alpha",":","float","Clamping","factor","max_iter",":","float","Change","maximum","number","of","iterations","allowed","tol",":","float","Convergence","tolerance",":","threshold","to","consider","the","system","at","steady","state","Attributes","--","--","--","--","--","X_",":","array",",","shape","=","[","n_samples",",","n_features","]","Input","array",".","classes_",":","array",",","shape","=","[","n_classes","]","The","distinct","labels","used","in","classifying","instances",".","label_distributions_",":","array",",","shape","=","[","n_samples",",","n_classes","]","Categorical","distribution","for","each","item",".","transduction_",":","array",",","shape","=","[","n_samples","]","Label","assigned","to","each","item","via","the","transduction",".","n_iter_",":","int","Number","of","iterations","run",".","Examples","--","--","--","--",">",">",">","from","sklearn","import","datasets",">",">",">","from","sklearn.semi_supervised","import","LabelPropagation",">",">",">","label_prop_model","=","LabelPropagation","(",")",">",">",">","iris","=","datasets.load_iris","(",")",">",">",">","random_unlabeled_points","=","np.where","(","np.random.randint","(","0",",","2",",","...","size=len","(","iris.target",")",")",")",">",">",">","labels","=","np.copy","(","iris.target",")",">",">",">","labels","[","random_unlabeled_points","]","=","-1",">",">",">","label_prop_model.fit","(","iris.data",",","labels",")","...","#","doctest",":","+NORMALIZE_WHITESPACE","+ELLIPSIS","LabelPropagation","(","...",")","References","--","--","--","--","--","Xiaojin","Zhu","and","Zoubin","Ghahramani",".","Learning","from","labeled","and","unlabeled","data","with","label","propagation",".","Technical","Report","CMU-CALD-02-107",",","Carnegie","Mellon","University",",","2002","http",":","\/\/pages.cs.wisc.edu\/~jerryzhu\/pub\/CMU-CALD-02-107.pdf","See","Also","--","--","--","--","LabelSpreading",":","Alternate","label","propagation","strategy","more","robust","to","noise"]
docstr: Matrix representing a fully connected graph between each sample
  
  This basic implementation creates a non-stochastic affinity matrix, so
  class distributions will exceed 1 (normalization may be desired).
docstr_tok: ["Matrix","representing","a","fully","connected","graph","between","each","sample","This","basic","implementation","creates","a","non-stochastic","affinity","matrix",",","so","class","distributions","will","exceed","1","(","normalization","may","be","desired",")","."]
code: def _build_graph(self):
      """Matrix representing a fully connected graph between each sample
  
      This basic implementation creates a non-stochastic affinity matrix, so
      class distributions will exceed 1 (normalization may be desired).
      """
      if self.kernel == "knn":
          self.nn_fit = None
      affinity_matrix = self._get_kernel(self.X_)
      normalizer = affinity_matrix.sum(axis=0)
      if sparse.isspmatrix(affinity_matrix):
          affinity_matrix.data /= np.diag(np.array(normalizer))
      else:
          affinity_matrix /= normalizer[:, np.newaxis]
      return affinity_matrix
  
imports: from abc import ABCMeta, abstractmethod
  import numpy
  from scipy import sparse
  from ..base import BaseEstimator, ClassifierMixin
  from ..externals import six
  from ..metrics.pairwise import rbf_kernel
  from ..neighbors.unsupervised import NearestNeighbors
  from ..utils.extmath import safe_sparse_dot
  from ..utils.graph import graph_laplacian
  from ..utils.multiclass import check_classification_targets
  from ..utils.validation import check_X_y, check_is_fitted, check_array
label_desc: Use image node_id 1 for calling the LabelPropagation obj's underlying member method code with example usage: obj._build_graph() and returns: affinity_matrix