Tuesday, September 16, 2008

Aggregate bigram model and EM

If anyone is interested in playing with the aggregate bigram model, I've got an implementation that you can download and build (provided you have a c++ compiler). Here's the source code. If you want a sample corpus to train on, here's the Brown corpus, and here's some test data. This isn't written to be useful except as a way to play with ABMs, which have kind of strange behavior that might be worth exploring.

To get things running, after downloading, you might try the following on a Unixy terminal (like one of the Linux machines in the lab) or in a Mac OS X terminal:

g++ -O3 -o abm abm.cc
./abm brown.txt chomsky.txt


This will compile the ABM trainer, build a model using the Brown corpus, and then evaluate the model on the contents of chomsky.txt. If you want to change aspects of the model or training (the number of classes, the initialization strategy, the number of iterations), you'll need to edit abm.cc and make changes to the relevant variables and recompile.

1 comment:

Philip said...

Thanks, Chris!

Note that if you have a mac, you can play around with this even if you have no clue at all about C++, programming, etc. To do this, you just need to download the three files Chris gave into a folder, bring up a terminal window, and use 'cd' (change directory) to get into the folder. Then you can compile and run as he suggests.

If you don't have the g++ compiler, it's on the "developer tools" disk that came with your Mac OSX operating system.