class_docstr: Linear Discriminant Analysis Class
  
  Parameters
  ----------
  n_discriminants : int (default: None)
      The number of discrimants for transformation.
      Keeps the original dimensions of the dataset if `None`.
  
  Attributes
  ----------
  w_ : array-like, shape=[n_features, n_discriminants]
      Projection matrix
  e_vals_ : array-like, shape=[n_features]
      Eigenvalues in sorted order.
  e_vecs_ : array-like, shape=[n_features]
     Eigenvectors in sorted order.
  
  Examples
  -----------
  For usage examples, please see
  https://rasbt.github.io/mlxtend/user_guide/feature_extraction/LinearDiscriminantAnalysis/
class_docstr_tok: ["Linear","Discriminant","Analysis","Class","Parameters","--","--","--","--","--","n_discriminants",":","int","(","default",":","None",")","The","number","of","discrimants","for","transformation",".","Keeps","the","original","dimensions","of","the","dataset","if","`","None","`",".","Attributes","--","--","--","--","--","w_",":","array-like",",","shape=","[","n_features",",","n_discriminants","]","Projection","matrix","e_vals_",":","array-like",",","shape=","[","n_features","]","Eigenvalues","in","sorted","order",".","e_vecs_",":","array-like",",","shape=","[","n_features","]","Eigenvectors","in","sorted","order",".","Examples","--","--","--","--","--","-","For","usage","examples",",","please","see","https",":","\/\/rasbt.github.io\/mlxtend\/user_guide\/feature_extraction\/LinearDiscriminantAnalysis\/"]
code: def _fit(self, X, y, n_classes=None):
      if (
          self.n_discriminants is None
          or self.n_discriminants > X.shape[1]
      ):
          n_discriminants = X.shape[1]
      else:
          n_discriminants = self.n_discriminants
  
      if n_classes:
          self._n_classes = n_classes
      else:
          self._n_classes = np.max(y) + 1
      self._n_features = X.shape[1]
  
      mean_vecs = self._mean_vectors(
          X=X, y=y, n_classes=self._n_classes
      )
      within_scatter = self._within_scatter(
          X=X, y=y, n_classes=self._n_classes, mean_vectors=mean_vecs
      )
      between_scatter = self._between_scatter(
          X=X, y=y, mean_vectors=mean_vecs
      )
      self.e_vals_, self.e_vecs_ = self._eigendecom(
          within_scatter=within_scatter, between_scatter=between_scatter
      )
      self.w_ = self._projection_matrix(
          eig_vals=self.e_vals_,
          eig_vecs=self.e_vecs_,
          n_discriminants=n_discriminants,
      )
      return self
  
file_path: mlxtend/mlxtend/feature_extraction/linear_discriminant_analysis.py
imports: import numpy
  from .._base import _BaseModel
label_desc: Use image node_id 3 for calling the LinearDiscriminantAnalysis obj's underlying member method code with example usage: obj._fit(X, y, n_classes) and returns: self