class_docstr: Quadratic Discriminant Analysis
  
  A classifier with a quadratic decision boundary, generated
  by fitting class conditional densities to the data
  and using Bayes' rule.
  
  The model fits a Gaussian density to each class.
  
  .. versionadded:: 0.17
     *QuadraticDiscriminantAnalysis*
  
  Read more in the :ref:`User Guide <lda_qda>`.
  
  Parameters
  ----------
  priors : array, optional, shape = [n_classes]
      Priors on classes
  
  reg_param : float, optional
      Regularizes the covariance estimate as
      ``(1-reg_param)*Sigma + reg_param*np.eye(n_features)``
  
  Attributes
  ----------
  covariances_ : list of array-like, shape = [n_features, n_features]
      Covariance matrices of each class.
  
  means_ : array-like, shape = [n_classes, n_features]
      Class means.
  
  priors_ : array-like, shape = [n_classes]
      Class priors (sum to 1).
  
  rotations_ : list of arrays
      For each class k an array of shape [n_features, n_k], with
      ``n_k = min(n_features, number of elements in class k)``
      It is the rotation of the Gaussian distribution, i.e. its
      principal axis.
  
  scalings_ : list of arrays
      For each class k an array of shape [n_k]. It contains the scaling
      of the Gaussian distributions along its principal axes, i.e. the
      variance in the rotated coordinate system.
  
  store_covariances : boolean
      If True the covariance matrices are computed and stored in the
      `self.covariances_` attribute.
  
      .. versionadded:: 0.17
  
  tol : float, optional, default 1.0e-4
      Threshold used for rank estimation.
  
      .. versionadded:: 0.17
  
  Examples
  --------
  >>> from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
  >>> import numpy as np
  >>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
  >>> y = np.array([1, 1, 1, 2, 2, 2])
  >>> clf = QuadraticDiscriminantAnalysis()
  >>> clf.fit(X, y)
  ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
  QuadraticDiscriminantAnalysis(priors=None, reg_param=0.0,
                                store_covariances=False, tol=0.0001)
  >>> print(clf.predict([[-0.8, -1]]))
  [1]
  
  See also
  --------
  sklearn.discriminant_analysis.LinearDiscriminantAnalysis: Linear
      Discriminant Analysis
class_docstr_tok: ["Quadratic","Discriminant","Analysis","A","classifier","with","a","quadratic","decision","boundary",",","generated","by","fitting","class","conditional","densities","to","the","data","and","using","Bayes","'","rule",".","The","model","fits","a","Gaussian","density","to","each","class",".","..","versionadded",":",":","0.17","*","QuadraticDiscriminantAnalysis","*","Read","more","in","the",":","ref",":","`","User","Guide","<","lda_qda",">","`",".","Parameters","--","--","--","--","--","priors",":","array",",","optional",",","shape","=","[","n_classes","]","Priors","on","classes","reg_param",":","float",",","optional","Regularizes","the","covariance","estimate","as","``","(","1-reg_param",")","*","Sigma","+","reg_param","*","np.eye","(","n_features",")","``","Attributes","--","--","--","--","--","covariances_",":","list","of","array-like",",","shape","=","[","n_features",",","n_features","]","Covariance","matrices","of","each","class",".","means_",":","array-like",",","shape","=","[","n_classes",",","n_features","]","Class","means",".","priors_",":","array-like",",","shape","=","[","n_classes","]","Class","priors","(","sum","to","1",")",".","rotations_",":","list","of","arrays","For","each","class","k","an","array","of","shape","[","n_features",",","n_k","]",",","with","``","n_k","=","min","(","n_features",",","number","of","elements","in","class","k",")","``","It","is","the","rotation","of","the","Gaussian","distribution",",","i.e",".","its","principal","axis",".","scalings_",":","list","of","arrays","For","each","class","k","an","array","of","shape","[","n_k","]",".","It","contains","the","scaling","of","the","Gaussian","distributions","along","its","principal","axes",",","i.e",".","the","variance","in","the","rotated","coordinate","system",".","store_covariances",":","boolean","If","True","the","covariance","matrices","are","computed","and","stored","in","the","`","self.covariances_","`","attribute",".","..","versionadded",":",":","0.17","tol",":","float",",","optional",",","default","1.0e-4","Threshold","used","for","rank","estimation",".","..","versionadded",":",":","0.17","Examples","--","--","--","--",">",">",">","from","sklearn.discriminant_analysis","import","QuadraticDiscriminantAnalysis",">",">",">","import","numpy","as","np",">",">",">","X","=","np.array","(","[","[","-1",",","-1","]",",","[","-2",",","-1","]",",","[","-3",",","-2","]",",","[","1",",","1","]",",","[","2",",","1","]",",","[","3",",","2","]","]",")",">",">",">","y","=","np.array","(","[","1",",","1",",","1",",","2",",","2",",","2","]",")",">",">",">","clf","=","QuadraticDiscriminantAnalysis","(",")",">",">",">","clf.fit","(","X",",","y",")","...","#","doctest",":","+ELLIPSIS",",","+NORMALIZE_WHITESPACE","QuadraticDiscriminantAnalysis","(","priors=None",",","reg_param=0.0",",","store_covariances=False",",","tol=0.0001",")",">",">",">","print","(","clf.predict","(","[","[","-0.8",",","-1","]","]",")",")","[","1","]","See","also","--","--","--","--","sklearn.discriminant_analysis.LinearDiscriminantAnalysis",":","Linear","Discriminant","Analysis"]
docstr: Fit the model according to the given training data and parameters.
  
      .. versionchanged:: 0.17
         Deprecated *store_covariance* have been moved to main constructor.
  
      .. versionchanged:: 0.17
         Deprecated *tol* have been moved to main constructor.
  
  Parameters
  ----------
  X : array-like, shape = [n_samples, n_features]
      Training vector, where n_samples in the number of samples and
      n_features is the number of features.
  
  y : array, shape = [n_samples]
      Target values (integers)
docstr_tok: ["Fit","the","model","according","to","the","given","training","data","and","parameters",".","..","versionchanged",":",":","0.17","Deprecated","*","store_covariance","*","have","been","moved","to","main","constructor",".","..","versionchanged",":",":","0.17","Deprecated","*","tol","*","have","been","moved","to","main","constructor",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","[","n_samples",",","n_features","]","Training","vector",",","where","n_samples","in","the","number","of","samples","and","n_features","is","the","number","of","features",".","y",":","array",",","shape","=","[","n_samples","]","Target","values","(","integers",")"]
code: def fit(self, X, y, store_covariances=None, tol=None):
      """Fit the model according to the given training data and parameters.
  
          .. versionchanged:: 0.17
             Deprecated *store_covariance* have been moved to main constructor.
  
          .. versionchanged:: 0.17
             Deprecated *tol* have been moved to main constructor.
  
      Parameters
      ----------
      X : array-like, shape = [n_samples, n_features]
          Training vector, where n_samples in the number of samples and
          n_features is the number of features.
  
      y : array, shape = [n_samples]
          Target values (integers)
      """
      if store_covariances:
          warnings.warn(
              "The parameter 'store_covariances' is deprecated as "
              "of version 0.17 and will be removed in 0.19. The "
              "parameter is no longer necessary because the value "
              "is set via the estimator initialisation or "
              "set_params method.",
              DeprecationWarning,
          )
          self.store_covariances = store_covariances
      if tol:
          warnings.warn(
              "The parameter 'tol' is deprecated as of version "
              "0.17 and will be removed in 0.19. The parameter is "
              "no longer necessary because the value is set via "
              "the estimator initialisation or set_params method.",
              DeprecationWarning,
          )
          self.tol = tol
      X, y = check_X_y(X, y)
      check_classification_targets(y)
      self.classes_, y = np.unique(y, return_inverse=True)
      n_samples, n_features = X.shape
      n_classes = len(self.classes_)
      if n_classes < 2:
          raise ValueError("y has less than 2 classes")
      if self.priors is None:
          self.priors_ = bincount(y) / float(n_samples)
      else:
          self.priors_ = self.priors
  
      cov = None
      if self.store_covariances:
          cov = []
      means = []
      scalings = []
      rotations = []
      for ind in xrange(n_classes):
          Xg = X[y == ind, :]
          meang = Xg.mean(0)
          means.append(meang)
          if len(Xg) == 1:
              raise ValueError(
                  "y has only 1 sample in class %s, covariance "
                  "is ill defined." % str(self.classes_[ind])
              )
          Xgc = Xg - meang
          # Xgc = U * S * V.T
          U, S, Vt = np.linalg.svd(Xgc, full_matrices=False)
          rank = np.sum(S > self.tol)
          if rank < n_features:
              warnings.warn("Variables are collinear")
          S2 = (S**2) / (len(Xg) - 1)
          S2 = ((1 - self.reg_param) * S2) + self.reg_param
          if self.store_covariances:
              # cov = V * (S^2 / (n-1)) * V.T
              cov.append(np.dot(S2 * Vt.T, Vt))
          scalings.append(S2)
          rotations.append(Vt.T)
      if self.store_covariances:
          self.covariances_ = cov
      self.means_ = np.asarray(means)
      self.scalings_ = scalings
      self.rotations_ = rotations
      return self
  
imports: from __future__ import print_function
  import warnings
  import numpy
  from scipy import linalg
  from .externals.six import string_types
  from .externals.six.moves import xrange
  from .base import BaseEstimator, TransformerMixin, ClassifierMixin
  from .linear_model.base import LinearClassifierMixin
  from .covariance import ledoit_wolf, empirical_covariance, shrunk_covariance
  from .utils.multiclass import unique_labels
  from .utils import check_array, check_X_y
  from .utils.validation import check_is_fitted
  from .utils.fixes import bincount
  from .utils.multiclass import check_classification_targets
  from .preprocessing import StandardScaler
label_desc: Use image node_id 2 for calling the QuadraticDiscriminantAnalysis obj's underlying member method code with example usage: obj.fit(X, y, store_covariances, tol) and returns: self