new TokenSequence2FeatureVectorSequence() });
return p;
}
public void testAddOrderNStates() {
Pipe p = makeSpacePredictionPipe();
InstanceList instances = new InstanceList(p);
instances.addThruPipe(new ArrayIterator(data));
InstanceList[] lists = instances.split(new java.util.Random(678),
new double[] { .5, .5 });
// Compare 3 CRFs trained with addOrderNStates, and make sure
// that having more features leads to a higher likelihood
CRF crf1 = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
crf1.addOrderNStates(lists[0], new int[] { 1, },
new boolean[] { false, }, "START", null, null, false);
new CRFTrainerByLabelLikelihood(crf1).trainIncremental(lists[0]);
CRF crf2 = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
crf2.addOrderNStates(lists[0], new int[] { 1, 2, }, new boolean[] {
false, true }, "START", null, null, false);
new CRFTrainerByLabelLikelihood(crf2).trainIncremental(lists[0]);
CRF crf3 = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
crf3.addOrderNStates(lists[0], new int[] { 1, 2, }, new boolean[] {
false, false }, "START", null, null, false);
new CRFTrainerByLabelLikelihood(crf3).trainIncremental(lists[0]);
// Prevent cached values