class_docstr: Discrete Fourier Transform.
  
  Parameters
  ----------
  n_coefs : None, int or float (default = None)
      The number of Fourier coefficients to keep. If None, all the Fourier
      coeeficients are kept. If an integer, the ``n_coefs`` most significant
      Fourier coefficients are returned if ``anova=True``, otherwise the
      first ``n_coefs`` Fourier coefficients are returned. If a float, it
      represents a percentage of the size of each time series and must be
      between 0 and 1. The number of coefficients will be computed as
      ``ceil(n_coefs * (n_timestamps - 1))`` if ``drop_sum=True`` and
      ``ceil(n_coefs * n_timestamps)`` if ``drop_sum=False``.
  
  drop_sum : bool (default = False)
      If True, the first Fourier coefficient (i.e. the sum of the subseries)
      is dropped. Otherwise, it is kept.
  
  anova : bool (default = False)
      If True, the Fourier coefficient selection is done via a one-way
      ANOVA test. If False, the first Fourier coefficients are selected.
  
  norm_mean : bool (default = False)
      If True, center each time series before scaling.
  
  norm_std : bool (default = False)
      If True, scale each time series to unit variance.
  
  Attributes
  ----------
  support_ : array, shape = (n_coefs,)
      Indices of the kept Fourier coefficients.
  
  References
  ----------
  .. [1] P. Schäfer, and M. Högqvist, "SFA: A Symbolic Fourier Approximation
         and Index for Similarity Search in High Dimensional Datasets",
         International Conference on Extending Database Technology,
         15, 516-527 (2012).
  
  Examples
  --------
  >>> from pyts.approximation import DiscreteFourierTransform
  >>> from pyts.datasets import load_gunpoint
  >>> X, _, _, _ = load_gunpoint(return_X_y=True)
  >>> transformer = DiscreteFourierTransform(n_coefs=4)
  >>> X_new = transformer.fit_transform(X)
  >>> X_new.shape
  (50, 4)
class_docstr_tok: ["Discrete","Fourier","Transform",".","Parameters","--","--","--","--","--","n_coefs",":","None",",","int","or","float","(","default","=","None",")","The","number","of","Fourier","coefficients","to","keep",".","If","None",",","all","the","Fourier","coeeficients","are","kept",".","If","an","integer",",","the","``","n_coefs","``","most","significant","Fourier","coefficients","are","returned","if","``","anova=True","``",",","otherwise","the","first","``","n_coefs","``","Fourier","coefficients","are","returned",".","If","a","float",",","it","represents","a","percentage","of","the","size","of","each","time","series","and","must","be","between","0","and","1",".","The","number","of","coefficients","will","be","computed","as","``","ceil","(","n_coefs","*","(","n_timestamps","-","1",")",")","``","if","``","drop_sum=True","``","and","``","ceil","(","n_coefs","*","n_timestamps",")","``","if","``","drop_sum=False","``",".","drop_sum",":","bool","(","default","=","False",")","If","True",",","the","first","Fourier","coefficient","(","i.e",".","the","sum","of","the","subseries",")","is","dropped",".","Otherwise",",","it","is","kept",".","anova",":","bool","(","default","=","False",")","If","True",",","the","Fourier","coefficient","selection","is","done","via","a","one-way","ANOVA","test",".","If","False",",","the","first","Fourier","coefficients","are","selected",".","norm_mean",":","bool","(","default","=","False",")","If","True",",","center","each","time","series","before","scaling",".","norm_std",":","bool","(","default","=","False",")","If","True",",","scale","each","time","series","to","unit","variance",".","Attributes","--","--","--","--","--","support_",":","array",",","shape","=","(","n_coefs",",",")","Indices","of","the","kept","Fourier","coefficients",".","References","--","--","--","--","--","..","[","1","]","P.","Sch\u00e4fer",",","and","M.","H\u00f6gqvist",",","``","SFA",":","A","Symbolic","Fourier","Approximation","and","Index","for","Similarity","Search","in","High","Dimensional","Datasets","''",",","International","Conference","on","Extending","Database","Technology",",","15",",","516-527","(","2012",")",".","Examples","--","--","--","--",">",">",">","from","pyts.approximation","import","DiscreteFourierTransform",">",">",">","from","pyts.datasets","import","load_gunpoint",">",">",">","X",",","_",",","_",",","_","=","load_gunpoint","(","return_X_y=True",")",">",">",">","transformer","=","DiscreteFourierTransform","(","n_coefs=4",")",">",">",">","X_new","=","transformer.fit_transform","(","X",")",">",">",">","X_new.shape","(","50",",","4",")"]
code: def _anova(self, X_fft, y, n_coefs, n_timestamps):
      if n_coefs < X_fft.shape[1]:
          non_constant = np.where(
              ~np.isclose(
                  X_fft.var(axis=0), np.zeros_like(X_fft.shape[1])
              )
          )[0]
          if non_constant.size == 0:
              raise ValueError(
                  "All the Fourier coefficients are constant. "
                  "Your input data is weirdly homogeneous."
              )
          elif non_constant.size < n_coefs:
              warn(
                  "The number of non constant Fourier coefficients ({0}) "
                  "is lower than the number of coefficients to keep ({1}). "
                  "The number of coefficients to keep is truncated to {2}"
                  ".".format(
                      non_constant.size, n_coefs, non_constant.size
                  )
              )
              support = non_constant
          else:
              _, p = f_classif(X_fft[:, non_constant], y)
              support = non_constant[np.argsort(p)[:n_coefs]]
      else:
          support = np.arange(n_coefs)
      return support
  
file_path: pyts/pyts/approximation/dft.py
imports: import numpy
  from sklearn.base import BaseEstimator
  from sklearn.feature_selection import f_classif
  from sklearn.utils.validation import check_array, check_is_fitted, check_X_y
  from math import ceil
  from warnings import warn
  from ..base import UnivariateTransformerMixin
  from ..preprocessing import StandardScaler
label_desc: Use image node_id 5 for calling the DiscreteFourierTransform obj's underlying member method code with example usage: obj._anova(X_fft, y, n_coefs, n_timestamps) and returns: support