def METHOD_NAME(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