public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); return trainModel(iterations, indexer); }
@Test public void testTrainModelReturnsAQNModel() throws Exception { // given RealValueFileEventStream rvfes1 = new RealValueFileEventStream( "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt"); testDataIndexer.index(rvfes1); // when QNModel trainedModel = new QNTrainer(false).trainModel(ITERATIONS, testDataIndexer); // then Assert.assertNotNull(trainedModel); }
@Test public void testModel() throws IOException { // given RealValueFileEventStream rvfes1 = new RealValueFileEventStream( "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt"); testDataIndexer.index(rvfes1); // when QNModel trainedModel = new QNTrainer(15, true).trainModel( ITERATIONS, testDataIndexer); Assert.assertFalse(trainedModel.equals(null)); }
@Test public void testQNOnPrepAttachData() throws IOException { DataIndexer indexer = new TwoPassDataIndexer(); TrainingParameters indexingParameters = new TrainingParameters(); indexingParameters.put(AbstractTrainer.CUTOFF_PARAM, 1); indexingParameters.put(AbstractDataIndexer.SORT_PARAM, false); indexer.init(indexingParameters, new HashMap<>()); indexer.index(PrepAttachDataUtil.createTrainingStream()); AbstractModel model = new QNTrainer(true).trainModel(100, indexer ); PrepAttachDataUtil.testModel(model, 0.8155484030700668); }
testDataIndexer.index(rvfes1); QNModel trainedModel = new QNTrainer(5, 700, true).trainModel(ITERATIONS, testDataIndexer);
@Test public void testInTinyDevSet() throws Exception { // given RealValueFileEventStream rvfes1 = new RealValueFileEventStream( "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt"); testDataIndexer.index(rvfes1);; // when QNModel trainedModel = new QNTrainer(15, true).trainModel(ITERATIONS, testDataIndexer); String[] features2Classify = new String[] { "feature2","feature3", "feature3", "feature3","feature3", "feature3", "feature3","feature3", "feature3", "feature3","feature3", "feature3"}; double[] eval = trainedModel.eval(features2Classify); // then Assert.assertNotNull(eval); }
public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); return trainModel(iterations, indexer); }
public AbstractModel doTrain(DataIndexer indexer) throws IOException { int iterations = getIterations(); return trainModel(iterations, indexer); }