}
public void testEstimating ()
{
Alphabet dict = new Alphabet ();
Multinomial.Estimator e = new Multinomial.LaplaceEstimator (dict);
FeatureSequence fs = new FeatureSequence (dict);
fs.add (dict.lookupIndex ("a"));
fs.add (dict.lookupIndex ("n"));
fs.add (dict.lookupIndex ("d"));
fs.add (dict.lookupIndex ("r"));
fs.add (dict.lookupIndex ("e"));
fs.add (dict.lookupIndex ("w"));
fs.add (dict.lookupIndex ("m"));
fs.add (dict.lookupIndex ("c"));
fs.add (dict.lookupIndex ("c"));
fs.add (dict.lookupIndex ("a"));
fs.add (dict.lookupIndex ("l"));
fs.add (dict.lookupIndex ("l"));
fs.add (dict.lookupIndex ("u"));
fs.add (dict.lookupIndex ("m"));
//System.out.println (fs.toString());
e.increment (fs);
assertTrue (e.size() == 10);
Multinomial m = e.estimate ();
assertTrue (m.size() == 10);
assertTrue (m.probability (dict.lookupIndex ("a")) == (2.0+1)/(14.0+10));
assertTrue (m.probability ("w") == (1.0+1)/(14.0+10));
Multinomial.Logged ml = new Multinomial.Logged (m);
assertTrue (m.logProbability ("w") == ml.logProbability ("w"));
}