title: Improve accuracy Naive Bayes Classifier
body: <p>I wrote a simple document classifier and I am currently testing it on the Brown Corpus. However, my accuracy is still very low (0.16). I've already excluded stopwords. Any other ideas on how to improve the classifier's performance?</p>
  
  <pre><code>import nltk, random
  
  from nltk.corpus import brown, stopwords
  
  
  
  documents = [(list(brown.words(fileid)), category)
          for category in brown.categories()
          for fileid in brown.fileids(category)]
  
  
  random.shuffle(documents)
  
  stop = set(stopwords.words('english'))
  
  
  all_words = nltk.FreqDist(w.lower() for w in brown.words() if w in stop) 
  
  word_features = list(all_words.keys())[:3000]
  
  def document_features(document):
      document_words = set(document)
      features = {}
      for word in word_features:
         features['contains(%s)' % word] = (word in document_words)
      return features
  
  featuresets = [(document_features(d), c) for (d,c) in documents] 
  
  train_set, test_set = featuresets[100:], featuresets[:100]
  
  classifier = nltk.NaiveBayesClassifier.train(train_set)
  
  print(nltk.classify.accuracy(classifier, test_set))
  </code></pre>