Class ModelOutputEvaluator
java.lang.Object
cc.mallet.fst.TransducerEvaluator
org.coordinatekit.crf.mallet.train.ModelOutputEvaluator
An evaluator that writes the current transducer (model) to file using Java serialization.
This evaluator serializes the transducer at specified iteration intervals, allowing model checkpoints to be saved during training. The serialized models can later be deserialized for inference or to resume training.
Output files are named using the pattern {prefix}_iter{N}.{suffix}, where N is the
iteration number.
Example usage:
ModelOutputConfiguration config = ModelOutputConfiguration.builder().outputDirectory(Path.of("models"))
.filePrefix("crf_model").fileSuffix("ser").iterationInterval(10).build();
ModelOutputEvaluator evaluator = new ModelOutputEvaluator(config);
// Add to trainer
trainer.addEvaluator(evaluator);
- See Also:
-
Field Summary
Fields inherited from class cc.mallet.fst.TransducerEvaluator
instanceListDescriptions, instanceLists -
Constructor Summary
ConstructorsConstructorDescriptionModelOutputEvaluator(ModelOutputConfiguration configuration) Creates a new model output evaluator with the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidevaluate(cc.mallet.fst.TransducerTrainer trainer) voidevaluateInstanceList(cc.mallet.fst.TransducerTrainer trainer, cc.mallet.types.InstanceList instances, String description) Methods inherited from class cc.mallet.fst.TransducerEvaluator
preamble, precondition
-
Constructor Details
-
ModelOutputEvaluator
Creates a new model output evaluator with the specified configuration.- Parameters:
configuration- the evaluator configuration
-
-
Method Details
-
evaluateInstanceList
public void evaluateInstanceList(cc.mallet.fst.TransducerTrainer trainer, cc.mallet.types.InstanceList instances, String description) - Specified by:
evaluateInstanceListin classcc.mallet.fst.TransducerEvaluator
-
evaluate
public void evaluate(cc.mallet.fst.TransducerTrainer trainer) - Overrides:
evaluatein classcc.mallet.fst.TransducerEvaluator
-