Package cc.mallet.pipe

Examples of cc.mallet.pipe.Pipe


    assertEquals(0.9409, eval.getAccuracy("Test"), 0.001);

  }

  public void testPrint() {
    Pipe p = new SerialPipes(new Pipe[] {
        new CharSequence2TokenSequence("."), new TokenText(),
        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenSequence2FeatureVectorSequence(),
        new PrintInputAndTarget(), });
    InstanceList one = new InstanceList(p);
View Full Code Here


    mcrf.setParameters(params);
    crf.print();
  }

  public void testCopyStatesAndWeights() {
    Pipe p = new SerialPipes(new Pipe[] {
        new CharSequence2TokenSequence("."), new TokenText(),
        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenSequence2FeatureVectorSequence(),
        new PrintInputAndTarget(), });
    InstanceList one = new InstanceList(p);
View Full Code Here

  }

  static String toy = "A a\nB b\nC c\nD d\nB b\nC c\n";

  public void testStartState() {
    Pipe p = new SerialPipes(new Pipe[] {
        new LineGroupString2TokenSequence(),
        new TokenSequenceMatchDataAndTarget(Pattern
            .compile("^(\\S+) (.*)"), 2, 1),
        new TokenSequenceParseFeatureString(false), new TokenText(),
        new TokenSequence2FeatureVectorSequence(true, false),
View Full Code Here

    assertEquals(-3.09104245335831, maxable.getValue(), 1e-4);
  }

  // Tests that setWeightsDimensionDensely respects featureSelections
  public void testDenseFeatureSelection() {
    Pipe p = makeSpacePredictionPipe();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));

    // Test that dense observations wights aren't added for
View Full Code Here

    assertEquals(nParams2, nParams1 + 4);

  }

  public void testXis() {
    Pipe p = makeSpacePredictionPipe();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));

    CRF crf1 = new CRF(p, null);
View Full Code Here

  public static Test suite() {
    return new TestSuite(TestCRF.class);
  }

  public void testStateAddWeights() {
    Pipe p = makeSpacePredictionPipe(); // This used to be
    // MEMM.makeSpacePredictionPipe(),
    // but I don't know why -akm 12/2007
    InstanceList training = new InstanceList(p);
    training.addThruPipe(new ArrayIterator(data)); // This used to be
    // MEMM.data, but I
View Full Code Here

   *   This is useful if you have a CRF hat has been trained from a single pipe, which you need to split up
   *    int feature and tokenization pipes
   */
  public void slicePipes (int num)
  {
    Pipe fpipe = getFeaturePipe ();
    if (!(fpipe instanceof SerialPipes))
      throw new IllegalArgumentException ("slicePipes: FeaturePipe must be a SerialPipes.");
    SerialPipes sp = (SerialPipes) fpipe;
    ArrayList pipes = new ArrayList ();
    for (int i = 0; i < num; i++) {
View Full Code Here

  public void run () {
    Alphabet alphabet = dictOfSize(20);
   
    // TRAIN
    Clustering training = sampleClustering(alphabet);   
    Pipe clusterPipe = new OverlappingFeaturePipe();
    System.err.println("Training with " + training);
    InstanceList trainList = new InstanceList(clusterPipe);
    trainList.addThruPipe(new ClusterSampleIterator(training, random, 0.5, 100));
    System.err.println("Created " + trainList.size() + " instances.");
    Classifier me = new MaxEntTrainer().train(trainList);
View Full Code Here

  private File outputDir = new File ("extract");

   public void testSpaceViewer () throws IOException
   {
     Pipe pipe = TestMEMM.makeSpacePredictionPipe ();
     String[] data0 = { TestCRF.data[0] };
     String[] data1 = { TestCRF.data[1] };

     InstanceList training = new InstanceList (pipe);
     training.addThruPipe (new ArrayIterator (data0));
View Full Code Here

  private static File latticeFile = new File ("lattice.html");
  private static File htmlDir = new File ("html/");

  public void testSpaceViewer () throws FileNotFoundException
  {
    Pipe pipe = TestMEMM.makeSpacePredictionPipe ();
    String[] data0 = { TestCRF.data[0] };
    String[] data1 = { TestCRF.data[1] };

    InstanceList training = new InstanceList (pipe);
    training.addThruPipe (new ArrayIterator (data0));
View Full Code Here

TOP

Related Classes of cc.mallet.pipe.Pipe

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.