title: Python Maxent Classifier
body: <p>I've been using the maxent classifier in python and its failing and I don't understand why.</p>
  
  <p>I'm using the movie reviews corpus.
  (total noob)</p>
  
  <pre><code>import nltk.classify.util
  from nltk.classify import MaxentClassifier
  from nltk.corpus import movie_reviews
  
  def word_feats(words):
   return dict([(word, True) for word in words])
  
  negids = movie_reviews.fileids('neg')
  posids = movie_reviews.fileids('pos')
  
  negfeats = [(word_feats(movie_reviews.words(fileids=[f])), 'neg') for f in negids]
  posfeats = [(word_feats(movie_reviews.words(fileids=[f])), 'pos') for f in posids]
  
  negcutoff = len(negfeats)*3/4
  poscutoff = len(posfeats)*3/4
  
  trainfeats = negfeats[:negcutoff] + posfeats[:poscutoff]
  classifier = MaxentClassifier.train(trainfeats)
  </code></pre>
  
  <p>This is the error (I know I'm doing this wrong please link to how Maxent works)</p>
  
  <blockquote>
    <p>Warning (from warnings module):
      File "C:\Python27\lib\site-packages\nltk\classify\maxent.py", line 1334
        sum1 = numpy.sum(exp_nf_delta * A, axis=0)
    RuntimeWarning: invalid value encountered in multiply</p>
    
    <p>Warning (from warnings module):
      File "C:\Python27\lib\site-packages\nltk\classify\maxent.py", line 1335
        sum2 = numpy.sum(nf_exp_nf_delta * A, axis=0)
    RuntimeWarning: invalid value encountered in multiply</p>
    
    <p>Warning (from warnings module):
      File "C:\Python27\lib\site-packages\nltk\classify\maxent.py", line 1341
        deltas -= (ffreq_empirical - sum1) / -sum2
    RuntimeWarning: invalid value encountered in divide</p>
  </blockquote>