/** * Creates a new model with the specified parameters, outcome names, and * predicate/feature labels. * * @param params * The parameters of the model. * @param predLabels * The names of the predicates used in this model. * @param outcomeNames * The names of the outcomes this model predicts. */ public GISModel(Context[] params, String[] predLabels, String[] outcomeNames) { this(params, predLabels, outcomeNames, new UniformPrior()); }
/** * Train a model using the GIS algorithm. * * @param iterations The number of GIS iterations to perform. * @param di The data indexer used to compress events in memory. * @return The newly trained model, which can be used immediately or saved * to disk using an opennlp.tools.ml.maxent.io.GISModelWriter object. */ public GISModel trainModel(int iterations, DataIndexer di) { return trainModel(iterations, di, new UniformPrior(), 1); }
/** * Train a model using the GIS algorithm. * * @param iterations The number of GIS iterations to perform. * @param di The data indexer used to compress events in memory. * @param threads * @return The newly trained model, which can be used immediately or saved * to disk using an opennlp.tools.ml.maxent.io.GISModelWriter object. */ public GISModel trainModel(int iterations, DataIndexer di, int threads) { return trainModel(iterations, di, new UniformPrior(), threads); }
/** * Creates a new model with the specified parameters, outcome names, and * predicate/feature labels. * * @param params * The parameters of the model. * @param predLabels * The names of the predicates used in this model. * @param outcomeNames * The names of the outcomes this model predicts. */ public GISModel(Context[] params, String[] predLabels, String[] outcomeNames) { this(params, predLabels, outcomeNames, new UniformPrior()); }
/** * Creates a new model with the specified parameters, outcome names, and * predicate/feature labels. * * @param params * The parameters of the model. * @param predLabels * The names of the predicates used in this model. * @param outcomeNames * The names of the outcomes this model predicts. */ public GISModel(Context[] params, String[] predLabels, String[] outcomeNames) { this(params, predLabels, outcomeNames, new UniformPrior()); }
@Test public void testMaxentOnPrepAttachData() throws IOException { testDataIndexer.index(PrepAttachDataUtil.createTrainingStream()); // this shows why the GISTrainer should be a AbstractEventTrainer. // TODO: make sure that the trainingParameter cutoff and the // cutoff value passed here are equal. AbstractModel model = new GISTrainer(true).trainModel(100, testDataIndexer, new UniformPrior(), 1); PrepAttachDataUtil.testModel(model, 0.7997028967566229); }
@Test public void testMaxentOnPrepAttachData2Threads() throws IOException { testDataIndexer.index(PrepAttachDataUtil.createTrainingStream()); AbstractModel model = new GISTrainer(true).trainModel(100, testDataIndexer, new UniformPrior(), 2); PrepAttachDataUtil.testModel(model, 0.7997028967566229); }
/** * Train a model using the GIS algorithm. * * @param iterations The number of GIS iterations to perform. * @param di The data indexer used to compress events in memory. * @param threads * @return The newly trained model, which can be used immediately or saved * to disk using an opennlp.tools.ml.maxent.io.GISModelWriter object. */ public GISModel trainModel(int iterations, DataIndexer di, int threads) { return trainModel(iterations, di, new UniformPrior(), threads); }
/** * Train a model using the GIS algorithm. * * @param iterations The number of GIS iterations to perform. * @param di The data indexer used to compress events in memory. * @return The newly trained model, which can be used immediately or saved * to disk using an opennlp.tools.ml.maxent.io.GISModelWriter object. */ public GISModel trainModel(int iterations, DataIndexer di) { return trainModel(iterations, di, new UniformPrior(), 1); }
/** * Train a model using the GIS algorithm. * * @param iterations The number of GIS iterations to perform. * @param di The data indexer used to compress events in memory. * @return The newly trained model, which can be used immediately or saved * to disk using an opennlp.tools.ml.maxent.io.GISModelWriter object. */ public GISModel trainModel(int iterations, DataIndexer di) { return trainModel(iterations, di, new UniformPrior(), 1); }
/** * Train a model using the GIS algorithm. * * @param iterations The number of GIS iterations to perform. * @param di The data indexer used to compress events in memory. * @param threads * @return The newly trained model, which can be used immediately or saved * to disk using an opennlp.tools.ml.maxent.io.GISModelWriter object. */ public GISModel trainModel(int iterations, DataIndexer di, int threads) { return trainModel(iterations, di, new UniformPrior(), threads); }
trainer.setSmoothingObservation(SMOOTHING_OBSERVATION); if (modelPrior == null) { modelPrior = new UniformPrior();