A simple C++ library for maximum entropy classification



Developed at:
University of Tokyo, Department of Computer Science,
Tsujii laboratory

Overview

This is a simple C++ library for maximum entropy classifiers (also known as "multinomial logistic regression"). The main features of this library are:

How to use

This software is currently tested only on linux and gcc.

1. Download the latest version

2. Expand the archive

> tar xvzf maxent-X.X.tar.gz

3. Compile

> cd maxent-X.X/
> make

4. Run the sample program

> ./bicycle

Example

#include <string>
#include <list>
#include <cstdio>
#include "maxent.h"

using namespace std;

void make_training_data(ME_Model & model)
{
  ME_Sample s1("CAR");
  s1.add_feature("four wheels");
  s1.add_feature("blue");

  ME_Sample s2("CAR");
  s2.add_feature("four wheels");
  s2.add_feature("red");

  ME_Sample s3("BICYCLE");
  s3.add_feature("two wheels");
  s3.add_feature("red");

  ME_Sample s4("BICYCLE");
  s4.add_feature("two wheels");
  s4.add_feature("yellow");

  model.add_training_sample(s1);
  model.add_training_sample(s2);
  model.add_training_sample(s3);
  model.add_training_sample(s4);
}

int main()
{
  ME_Model model;
  make_training_data(model);
  model.train();

  ME_Sample s;
  s.add_feature("two wheels");
  s.add_feature("blue");

  // classifying a sample
  model.classify(s);
  cout << endl << "it's a " << s.label << " !" << endl << endl;
}

References

[1] Jun'ichi Kazama and Jun'ichi Tsujii. 2003. Evaluation and Extension of Maximum Entropy Models with Inequality Constraints, In Proceedings of EMNLP, pp. 137-144.

[2] Stanley F. Chen and Ronald Rosenfeld. 1999. A Gaussian Prior for Smoothing Maximum Entropy Models, Technical Report CMU-CS-99-108, Computer Science Department, Carnegie Mellon University.

[3] Jorge Nocedal. 1980. Updating Quasi-Newton Matrices with Limited Storage, Mathematics of Computation, Vol. 35, No. 151, pp. 773-782.

[4] Galen Andrew and Jianfeng Gao. 2007. Scalable training of L1-regularized log-linear models, In Proceedings of ICML.

[5] Yoshimasa Tsuruoka, Jun'ichi Tsujii, and Sophia Ananiadou. 2009. Stochastic Gradient Descent Training for L1-regularized Log-linear Models with Cumulative Penalty, In Proceedings of ACL-IJCNLP, pp. 477-485


This page is maintained by Yoshimasa Tsuruoka