Training weights (or parameter estimation) for your Dyna program can be carried out in various ways under various circumstances. Here are some of the possibilities.
- You have labeled data (e.g., a treebank), and you want the weights to be interpreted as conditional probabilities (e.g., PCFG rewrite rules). In this case, parameter estimation might involve counting the instances of each rule in the treebank and renormalizing the counts, maybe with smoothing. Depending on your file format, you should be able to write a short Perl script to compute the parameters. There are many different ways to smooth, though, and they often involve parameter tuning on a development dataset.
- You have labeled data (e.g., a treebank), and you want to use a log-linear (or "max-ent", also known as a conditional random field for structured models like HMMs and PCFGs). In this case, parameter estimation is more involved; you might wish to use a gradient method or iterative scaling.
- You have only unlabeled data (e.g., a corpus of sentences), and you want to train weights using the Expectation-Maximization algorithm or some other kind of unsupervised learning.
- You have a mixture of labeled and unlabeled data, and you want to train weights.
DynaMITE, the Dyna Module for Iterative Training and Estimation, is a C++ library provided with Dyna that can help in all of these cases, providing a generic implementation of EM and gradient-based training for log-linear models, smoothing, and other weight training techniques.