class_docstr: A Naive Bayes classifier.  Naive Bayes classifiers are
  paramaterized by two probability distributions:
  
    - P(label) gives the probability that an input will receive each
      label, given no information about the input's features.
  
    - P(fname=fval|label) gives the probability that a given feature
      (fname) will receive a given value (fval), given that the
      label (label).
  
  If the classifier encounters an input with a feature that has
  never been seen with any label, then rather than assigning a
  probability of 0 to all labels, it will ignore that feature.
  
  The feature value 'None' is reserved for unseen feature values;
  you generally should not use 'None' as a feature value for one of
  your own features.
class_docstr_tok: ["A","Naive","Bayes","classifier",".","Naive","Bayes","classifiers","are","paramaterized","by","two","probability","distributions",":","-","P","(","label",")","gives","the","probability","that","an","input","will","receive","each","label",",","given","no","information","about","the","input","'s","features",".","-","P","(","fname=fval|label",")","gives","the","probability","that","a","given","feature","(","fname",")","will","receive","a","given","value","(","fval",")",",","given","that","the","label","(","label",")",".","If","the","classifier","encounters","an","input","with","a","feature","that","has","never","been","seen","with","any","label",",","then","rather","than","assigning","a","probability","of","0","to","all","labels",",","it","will","ignore","that","feature",".","The","feature","value","'None","'","is","reserved","for","unseen","feature","values",";","you","generally","should","not","use","'None","'","as","a","feature","value","for","one","of","your","own","features","."]
docstr: Return a list of the 'most informative' features used by this
  classifier.  For the purpose of this function, the
  informativeness of a feature ``(fname,fval)`` is equal to the
  highest value of P(fname=fval|label), for any label, divided by
  the lowest value of P(fname=fval|label), for any label:
  
  |  max[ P(fname=fval|label1) / P(fname=fval|label2) ]
docstr_tok: ["Return","a","list","of","the","'most","informative","'","features","used","by","this","classifier",".","For","the","purpose","of","this","function",",","the","informativeness","of","a","feature","``","(","fname",",","fval",")","``","is","equal","to","the","highest","value","of","P","(","fname=fval|label",")",",","for","any","label",",","divided","by","the","lowest","value","of","P","(","fname=fval|label",")",",","for","any","label",":","|","max","[","P","(","fname=fval|label1",")","\/","P","(","fname=fval|label2",")","]"]
code: def most_informative_features(self, n=100):
      """
      Return a list of the 'most informative' features used by this
      classifier.  For the purpose of this function, the
      informativeness of a feature ``(fname,fval)`` is equal to the
      highest value of P(fname=fval|label), for any label, divided by
      the lowest value of P(fname=fval|label), for any label:
  
      |  max[ P(fname=fval|label1) / P(fname=fval|label2) ]
      """
      if hasattr(self, "_most_informative_features"):
          return self._most_informative_features[:n]
      else:
          # The set of (fname, fval) pairs used by this classifier.
          features = set()
          # The max & min probability associated w/ each (fname, fval)
          # pair.  Maps (fname,fval) -> float.
          maxprob = defaultdict(float)
          minprob = defaultdict(lambda: 1.0)
  
          for (
              label,
              fname,
          ), probdist in self._feature_probdist.items():
              for fval in probdist.samples():
                  feature = (fname, fval)
                  features.add(feature)
                  p = probdist.prob(fval)
                  maxprob[feature] = max(p, maxprob[feature])
                  minprob[feature] = min(p, minprob[feature])
                  if minprob[feature] == 0:
                      features.discard(feature)
  
          # Convert features to a list, & sort it by how informative
          # features are.
          self._most_informative_features = sorted(
              features,
              key=lambda feature_: (
                  minprob[feature_] / maxprob[feature_],
                  feature_[0],
                  feature_[1] in [None, False, True],
                  str(feature_[1]).lower(),
              ),
          )
      return self._most_informative_features[:n]
  
file_path: nltk/nltk/classify/naivebayes.py
imports: from collections import defaultdict
  from nltk.classify.api import ClassifierI
  from nltk.probability import DictionaryProbDist, ELEProbDist, FreqDist, sum_logs
label_desc: Use image node_id 6 for calling the NaiveBayesClassifier obj's underlying member method code with example usage: obj.most_informative_features(n) and returns: self, self