Package opennlp.tools.ml.model

Examples of opennlp.tools.ml.model.RealValueFileEventStream


  }

  @Test
  public void testValueAtNonInitialPoint01() throws IOException {
    // given
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
    DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
    NegLogLikelihood objectFunction = new NegLogLikelihood(testDataIndexer);
    // when
    double[] nonInitialPoint = new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
View Full Code Here


  }

  @Test
  public void testValueAtNonInitialPoint02() throws IOException {
    // given
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
    DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
    NegLogLikelihood objectFunction = new NegLogLikelihood(testDataIndexer);
    // when
    double[] nonInitialPoint = new double[] { 3, 2, 3, 2, 3, 2, 3, 2, 3, 2 };
View Full Code Here

  }

  @Test
  public void testGradientAtInitialPoint() throws IOException {
    // given
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
    DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
    NegLogLikelihood objectFunction = new NegLogLikelihood(testDataIndexer);
    // when
    double[] gradientAtInitialPoint = objectFunction.gradientAt(objectFunction.getInitialPoint());
View Full Code Here

  }

  @Test
  public void testGradientAtNonInitialPoint() throws IOException {
    // given
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt", "UTF-8");
    DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
    NegLogLikelihood objectFunction = new NegLogLikelihood(testDataIndexer);
    // when
    double[] nonInitialPoint = new double[] { 0.2, 0.5, 0.2, 0.5, 0.2, 0.5, 0.2, 0.5, 0.2, 0.5 };
View Full Code Here

  private static int ITERATIONS = 50;
 
  @Test
  public void testTrainModelReturnsAQNModel() throws Exception {
    // given
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt")
    DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
    // when
    QNModel trainedModel = new QNTrainer(false).trainModel(ITERATIONS, testDataIndexer);
    // then
View Full Code Here

  }

  @Test
  public void testInTinyDevSet() throws Exception {
    // given
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt")
    DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
    // when
    QNModel trainedModel = new QNTrainer(15, true).trainModel(ITERATIONS, testDataIndexer);
    String[] features2Classify = new String[] {
View Full Code Here

  }
 
  @Test
  public void testModel() throws IOException {
      // given
      RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
          "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt")
      DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
      // when
      QNModel trainedModel = new QNTrainer(15, true).trainModel(
          ITERATIONS, testDataIndexer);
View Full Code Here

  }
 
  @Test
  public void testSerdeModel() throws IOException {
      // given
      RealValueFileEventStream rvfes1 = new RealValueFileEventStream(
          "src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt")
      DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
      // when
      QNModel trainedModel = new QNTrainer(5, 700, true).trainModel(ITERATIONS, testDataIndexer);
     
View Full Code Here

public class RealValueModelTest extends TestCase {

  public void testRealValuedWeightsVsRepeatWeighting() throws IOException {
    GISModel realModel;
    RealValueFileEventStream rvfes1 = new RealValueFileEventStream("src/test/resources/data/opennlp/maxent/real-valued-weights-training-data.txt");
    try {
      realModel = GIS.trainModel(100,new OnePassRealValueDataIndexer(rvfes1,1));
    } finally {
      rvfes1.close();
    }

    GISModel repeatModel;
    FileEventStream rvfes2 = new FileEventStream("src/test/resources/data/opennlp/maxent/repeat-weighting-training-data.txt");
    try {
View Full Code Here

public class RealValueFileEventStreamTest extends TestCase {

  public void testLastLineBug() throws IOException {
    OnePassRealValueDataIndexer indexer;
    RealValueFileEventStream rvfes;
   
    rvfes = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/io/rvfes-bug-data-ok.txt");
    try {
      indexer = new OnePassRealValueDataIndexer(rvfes, 1);
    } finally {
      rvfes.close();
    }
    assertEquals(1, indexer.getOutcomeLabels().length);

    rvfes = new RealValueFileEventStream(
        "src/test/resources/data/opennlp/maxent/io/rvfes-bug-data-broken.txt");
    try {
      indexer = new OnePassRealValueDataIndexer(rvfes, 1);
    } finally {
      rvfes.close();
    }
    assertEquals(1, indexer.getOutcomeLabels().length);
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.ml.model.RealValueFileEventStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.