class_docstr: Implements the Birch clustering algorithm.
  
  Every new sample is inserted into the root of the Clustering Feature
  Tree. It is then clubbed together with the subcluster that has the
  centroid closest to the new sample. This is done recursively till it
  ends up at the subcluster of the leaf of the tree has the closest centroid.
  
  Read more in the :ref:`User Guide <birch>`.
  
  Parameters
  ----------
  threshold : float, default 0.5
      The radius of the subcluster obtained by merging a new sample and the
      closest subcluster should be lesser than the threshold. Otherwise a new
      subcluster is started.
  
  branching_factor : int, default 50
      Maximum number of CF subclusters in each node. If a new samples enters
      such that the number of subclusters exceed the branching_factor then
      the node has to be split. The corresponding parent also has to be
      split and if the number of subclusters in the parent is greater than
      the branching factor, then it has to be split recursively.
  
  n_clusters : int, instance of sklearn.cluster model, default 3
      Number of clusters after the final clustering step, which treats the
      subclusters from the leaves as new samples. If None, this final
      clustering step is not performed and the subclusters are returned
      as they are. If a model is provided, the model is fit treating
      the subclusters as new samples and the initial data is mapped to the
      label of the closest subcluster. If an int is provided, the model
      fit is AgglomerativeClustering with n_clusters set to the int.
  
  compute_labels : bool, default True
      Whether or not to compute labels for each fit.
  
  copy : bool, default True
      Whether or not to make a copy of the given data. If set to False,
      the initial data will be overwritten.
  
  Attributes
  ----------
  root_ : _CFNode
      Root of the CFTree.
  
  dummy_leaf_ : _CFNode
      Start pointer to all the leaves.
  
  subcluster_centers_ : ndarray,
      Centroids of all subclusters read directly from the leaves.
  
  subcluster_labels_ : ndarray,
      Labels assigned to the centroids of the subclusters after
      they are clustered globally.
  
  labels_ : ndarray, shape (n_samples,)
      Array of labels assigned to the input data.
      if partial_fit is used instead of fit, they are assigned to the
      last batch of data.
  
  Examples
  --------
  >>> from sklearn.cluster import Birch
  >>> X = [[0, 1], [0.3, 1], [-0.3, 1], [0, -1], [0.3, -1], [-0.3, -1]]
  >>> brc = Birch(branching_factor=50, n_clusters=None, threshold=0.5,
  ... compute_labels=True)
  >>> brc.fit(X)
  Birch(branching_factor=50, compute_labels=True, copy=True, n_clusters=None,
     threshold=0.5)
  >>> brc.predict(X)
  array([0, 0, 0, 1, 1, 1])
  
  References
  ----------
  * Tian Zhang, Raghu Ramakrishnan, Maron Livny
    BIRCH: An efficient data clustering method for large databases.
    http://www.cs.sfu.ca/CourseCentral/459/han/papers/zhang96.pdf
  
  * Roberto Perdisci
    JBirch - Java implementation of BIRCH clustering algorithm
    https://code.google.com/archive/p/jbirch
class_docstr_tok: ["Implements","the","Birch","clustering","algorithm",".","Every","new","sample","is","inserted","into","the","root","of","the","Clustering","Feature","Tree",".","It","is","then","clubbed","together","with","the","subcluster","that","has","the","centroid","closest","to","the","new","sample",".","This","is","done","recursively","till","it","ends","up","at","the","subcluster","of","the","leaf","of","the","tree","has","the","closest","centroid",".","Read","more","in","the",":","ref",":","`","User","Guide","<","birch",">","`",".","Parameters","--","--","--","--","--","threshold",":","float",",","default","0.5","The","radius","of","the","subcluster","obtained","by","merging","a","new","sample","and","the","closest","subcluster","should","be","lesser","than","the","threshold",".","Otherwise","a","new","subcluster","is","started",".","branching_factor",":","int",",","default","50","Maximum","number","of","CF","subclusters","in","each","node",".","If","a","new","samples","enters","such","that","the","number","of","subclusters","exceed","the","branching_factor","then","the","node","has","to","be","split",".","The","corresponding","parent","also","has","to","be","split","and","if","the","number","of","subclusters","in","the","parent","is","greater","than","the","branching","factor",",","then","it","has","to","be","split","recursively",".","n_clusters",":","int",",","instance","of","sklearn.cluster","model",",","default","3","Number","of","clusters","after","the","final","clustering","step",",","which","treats","the","subclusters","from","the","leaves","as","new","samples",".","If","None",",","this","final","clustering","step","is","not","performed","and","the","subclusters","are","returned","as","they","are",".","If","a","model","is","provided",",","the","model","is","fit","treating","the","subclusters","as","new","samples","and","the","initial","data","is","mapped","to","the","label","of","the","closest","subcluster",".","If","an","int","is","provided",",","the","model","fit","is","AgglomerativeClustering","with","n_clusters","set","to","the","int",".","compute_labels",":","bool",",","default","True","Whether","or","not","to","compute","labels","for","each","fit",".","copy",":","bool",",","default","True","Whether","or","not","to","make","a","copy","of","the","given","data",".","If","set","to","False",",","the","initial","data","will","be","overwritten",".","Attributes","--","--","--","--","--","root_",":","_CFNode","Root","of","the","CFTree",".","dummy_leaf_",":","_CFNode","Start","pointer","to","all","the","leaves",".","subcluster_centers_",":","ndarray",",","Centroids","of","all","subclusters","read","directly","from","the","leaves",".","subcluster_labels_",":","ndarray",",","Labels","assigned","to","the","centroids","of","the","subclusters","after","they","are","clustered","globally",".","labels_",":","ndarray",",","shape","(","n_samples",",",")","Array","of","labels","assigned","to","the","input","data",".","if","partial_fit","is","used","instead","of","fit",",","they","are","assigned","to","the","last","batch","of","data",".","Examples","--","--","--","--",">",">",">","from","sklearn.cluster","import","Birch",">",">",">","X","=","[","[","0",",","1","]",",","[","0.3",",","1","]",",","[","-0.3",",","1","]",",","[","0",",","-1","]",",","[","0.3",",","-1","]",",","[","-0.3",",","-1","]","]",">",">",">","brc","=","Birch","(","branching_factor=50",",","n_clusters=None",",","threshold=0.5",",","...","compute_labels=True",")",">",">",">","brc.fit","(","X",")","Birch","(","branching_factor=50",",","compute_labels=True",",","copy=True",",","n_clusters=None",",","threshold=0.5",")",">",">",">","brc.predict","(","X",")","array","(","[","0",",","0",",","0",",","1",",","1",",","1","]",")","References","--","--","--","--","--","*","Tian","Zhang",",","Raghu","Ramakrishnan",",","Maron","Livny","BIRCH",":","An","efficient","data","clustering","method","for","large","databases",".","http",":","\/\/www.cs.sfu.ca\/CourseCentral\/459\/han\/papers\/zhang96.pdf","*","Roberto","Perdisci","JBirch","-","Java","implementation","of","BIRCH","clustering","algorithm","https",":","\/\/code.google.com\/archive\/p\/jbirch"]
docstr: Predict data using the ``centroids_`` of subclusters.
  
  Avoid computation of the row norms of X.
  
  Parameters
  ----------
  X : {array-like, sparse matrix}, shape (n_samples, n_features)
      Input data.
  
  Returns
  -------
  labels: ndarray, shape(n_samples)
      Labelled data.
docstr_tok: ["Predict","data","using","the","``","centroids_","``","of","subclusters",".","Avoid","computation","of","the","row","norms","of","X.","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}",",","shape","(","n_samples",",","n_features",")","Input","data",".","Returns","--","--","--","-","labels",":","ndarray",",","shape","(","n_samples",")","Labelled","data","."]
code: def predict(self, X):
      """
      Predict data using the ``centroids_`` of subclusters.
  
      Avoid computation of the row norms of X.
  
      Parameters
      ----------
      X : {array-like, sparse matrix}, shape (n_samples, n_features)
          Input data.
  
      Returns
      -------
      labels: ndarray, shape(n_samples)
          Labelled data.
      """
      X = check_array(X, accept_sparse="csr")
      self._check_fit(X)
      reduced_distance = safe_sparse_dot(X, self.subcluster_centers_.T)
      reduced_distance *= -2
      reduced_distance += self._subcluster_norms
      return self.subcluster_labels_[
          np.argmin(reduced_distance, axis=1)
      ]
  
imports: from __future__ import division
  import warnings
  import numpy
  from scipy import sparse
  from math import sqrt
  from ..metrics.pairwise import euclidean_distances
  from ..base import TransformerMixin, ClusterMixin, BaseEstimator
  from ..externals.six.moves import xrange
  from ..utils import check_array
  from ..utils.extmath import row_norms, safe_sparse_dot
  from ..utils.validation import check_is_fitted
  from ..exceptions import NotFittedError
  from .hierarchical import AgglomerativeClustering
label_desc: Use image node_id 7 for calling the Birch obj's underlying member method code with example usage: obj.predict(X) and returns: self