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"]
code: def _decision_function(self, X):
      check_is_fitted(self, "classes_")
  
      X = check_array(X)
      norm2 = []
      for i in range(len(self.classes_)):
          R = self.rotations_[i]
          S = self.scalings_[i]
          Xm = X - self.means_[i]
          X2 = np.dot(Xm, R * (S ** (-0.5)))
          norm2.append(np.sum(X2**2, 1))
      norm2 = np.array(norm2).T  # shape = [len(X), n_classes]
      u = np.asarray([np.sum(np.log(s)) for s in self.scalings_])
      return -0.5 * (norm2 + u) + np.log(self.priors_)
  
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 3 for calling the QuadraticDiscriminantAnalysis obj's underlying member method code with example usage: obj._decision_function(X) and returns: unknown