O'Reilly logo

Python Text Processing with NLTK 2.0 Cookbook by Jacob Perkins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Training a maximum entropy classifier

The third classifier which we will cover is the MaxentClassifier, also known as a conditional exponential classifier. The maximum entropy classifier converts labeled feature sets to vectors using encoding. This encoded vector is then used to calculate weights for each feature that can then be combined to determine the most likely label for a feature set.

Getting ready

The MaxentClassifier requires the numpy package, and optionally the scipy package. This is because the feature encodings use numpy arrays. Having scipy installed also means you will be able to use faster algorithms that consume less memory. You can find installation for both at http://www.scipy.org/Installing_SciPy.

Tip

Many of the algorithms can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required