class_docstr: A frequency distribution tells us the frequency of each vocabulary
  item in the text. In general, it could count any kind of observable
  event. It is a distribution because it tells us how the total
  number of word tokens in the text are distributed across the
  vocabulary items.
  
  
  Parameters
  ----------
  features : list, default: None
      The list of feature names from the vectorizer, ordered by index. E.g.
      a lexicon that specifies the unique vocabulary of the corpus. This
      can be typically fetched using the ``get_feature_names()`` method of
      the transformer in Scikit-Learn.
  
  ax : matplotlib axes, default: None
      The axes to plot the figure on.
  
  n: integer, default: 50
      Top N tokens to be plotted.
  
  orient : 'h' or 'v', default: 'h'
      Specifies a horizontal or vertical bar chart.
  
  color : string
      Specify color for bars
  
  kwargs : dict
      Pass any additional keyword arguments to the super class.
  
  These parameters can be influenced later on in the visualization
  process, but can and should be set as early as possible.
class_docstr_tok: ["A","frequency","distribution","tells","us","the","frequency","of","each","vocabulary","item","in","the","text",".","In","general",",","it","could","count","any","kind","of","observable","event",".","It","is","a","distribution","because","it","tells","us","how","the","total","number","of","word","tokens","in","the","text","are","distributed","across","the","vocabulary","items",".","Parameters","--","--","--","--","--","features",":","list",",","default",":","None","The","list","of","feature","names","from","the","vectorizer",",","ordered","by","index",".","E.g",".","a","lexicon","that","specifies","the","unique","vocabulary","of","the","corpus",".","This","can","be","typically","fetched","using","the","``","get_feature_names","(",")","``","method","of","the","transformer","in","Scikit-Learn",".","ax",":","matplotlib","axes",",","default",":","None","The","axes","to","plot","the","figure","on",".","n",":","integer",",","default",":","50","Top","N","tokens","to","be","plotted",".","orient",":","'","h","'","or","'","v","'",",","default",":","'","h'","Specifies","a","horizontal","or","vertical","bar","chart",".","color",":","string","Specify","color","for","bars","kwargs",":","dict","Pass","any","additional","keyword","arguments","to","the","super","class",".","These","parameters","can","be","influenced","later","on","in","the","visualization","process",",","but","can","and","should","be","set","as","early","as","possible","."]
docstr: The fit method is the primary drawing input for the frequency
  distribution visualization. It requires vectorized lists of
  documents and a list of features, which are the actual words
  from the original corpus (needed to label the x-axis ticks).
  
  Parameters
  ----------
  X : ndarray or DataFrame of shape n x m
      A matrix of n instances with m features representing the corpus
      of frequency vectorized documents.
  
  y : ndarray or DataFrame of shape n
      Labels for the documents for conditional frequency distribution.
  
  Notes
  -----
  .. note:: Text documents must be vectorized before ``fit()``.
docstr_tok: ["The","fit","method","is","the","primary","drawing","input","for","the","frequency","distribution","visualization",".","It","requires","vectorized","lists","of","documents","and","a","list","of","features",",","which","are","the","actual","words","from","the","original","corpus","(","needed","to","label","the","x-axis","ticks",")",".","Parameters","--","--","--","--","--","X",":","ndarray","or","DataFrame","of","shape","n","x","m","A","matrix","of","n","instances","with","m","features","representing","the","corpus","of","frequency","vectorized","documents",".","y",":","ndarray","or","DataFrame","of","shape","n","Labels","for","the","documents","for","conditional","frequency","distribution",".","Notes","--","--","-","..","note",":",":","Text","documents","must","be","vectorized","before","``","fit","(",")","``","."]
code: def fit(self, X, y=None):
      """
      The fit method is the primary drawing input for the frequency
      distribution visualization. It requires vectorized lists of
      documents and a list of features, which are the actual words
      from the original corpus (needed to label the x-axis ticks).
  
      Parameters
      ----------
      X : ndarray or DataFrame of shape n x m
          A matrix of n instances with m features representing the corpus
          of frequency vectorized documents.
  
      y : ndarray or DataFrame of shape n
          Labels for the documents for conditional frequency distribution.
  
      Notes
      -----
      .. note:: Text documents must be vectorized before ``fit()``.
      """
  
      # Compute the conditional word frequency
      if y is not None:
          # Fit the frequencies
          self.conditional_freqdist_ = {}
  
          # Conditional frequency distribution
          self.classes_ = [str(label) for label in set(y)]
          for label in self.classes_:
              self.conditional_freqdist_[label] = self.count(
                  X[y == label]
              )
      else:
          # No conditional frequencies
          self.conditional_freqdist_ = None
  
      # Frequency distribution of entire corpus.
      self.freqdist_ = self.count(X)
      self.sorted_ = self.freqdist_.argsort()[::-1]  # Descending order
  
      # Compute the number of words, vocab, and hapaxes
      self.vocab_ = self.freqdist_.shape[0]
      self.words_ = self.freqdist_.sum()
      self.hapaxes_ = sum(1 for c in self.freqdist_ if c == 1)
  
      # Draw and ensure that we return self
      self.draw()
      return self
  
file_path: yellowbrick/yellowbrick/text/freqdist.py
imports: import numpy
  from operator import itemgetter
  from yellowbrick.text.base import TextVisualizer
  from yellowbrick.exceptions import YellowbrickValueError
label_desc: Use image node_id 3 for calling the FrequencyVisualizer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self