package de.ugoe.cs.eventbench.commands; import java.util.List; import java.util.Random; import de.ugoe.cs.eventbench.models.PredictionByPartialMatch; import de.ugoe.cs.eventbench.models.TrieBasedModel; import de.ugoe.cs.util.console.Console; /** *

* Command that trains Prediction by Partial Match (PPM) models. *

* * @author Steffen Herbold * @version 2.0 */ public class CMDtrainPPM extends AbstractTrainCommand { /** *

* Escape probability of the PPM model. *

*/ double probEscape; /** *

* Maximal Markov order of the PPM model. *

*/ int maxOrder; /** *

* Minimal Markov order of the PPM model. Default: 0 *

*/ int minOrder = 0; /* * (non-Javadoc) * * @see de.ugoe.cs.util.console.Command#help() */ @Override public void help() { Console.println("Usage: trainPPM {}"); } /** *

* Handles the parameters probEscape, maxOrder, and minOrder. *

* * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#handleOptionalParameters(java.util.List) */ @Override void handleAdditionalParameters(List parameters) throws Exception { probEscape = Double.parseDouble((String) parameters.get(2)); maxOrder = Integer.parseInt((String) parameters.get(3)); if (parameters.size() == 5) { minOrder = Integer.parseInt((String) parameters.get(4)); } } /* * (non-Javadoc) * * @see de.ugoe.cs.eventbench.commands.AbstractTrainCommand#createModel() */ @Override TrieBasedModel createModel() { return new PredictionByPartialMatch(maxOrder, minOrder, new Random(), probEscape); } }