Package sequence

Examples of sequence.LinearTagger


      in = new ObjectInputStream(new GZIPInputStream(new FileInputStream(
          fname)));
    } else {
      in = new ObjectInputStream(new FileInputStream(fname));
    }
    LinearTagger h = (LinearTagger) in.readObject();
    in.close();
    return h;
  }
View Full Code Here


    ArrayList<SequenceInstance> train = tmp[0];
    ArrayList<SequenceInstance> test = tmp[1];
    Alphabet xA = allData.get(0).xAlphabet;
    Alphabet yA = allData.get(0).yAlphabet;
    System.out.println("num Features = " + allData.get(0).xAlphabet.size());
    LinearTagger h;
     h = PartOfSpeech.trainCRF(train, xA, yA);
     System.out.println("CRF    Train Accuracy = "
     + StaticUtils.computeAccuracyS(h, train));
     System.out.println("CRF    Test  Accuracy = "
     + StaticUtils.computeAccuracyS(h, test));
View Full Code Here

  public static LinearTagger trainPerceptron(boolean doAveraging,
      int numIters, ArrayList<SequenceInstance> train, Alphabet xA,
      Alphabet yA) {
    Perceptron p = new Perceptron(doAveraging, numIters, xA, yA,
        new OneYwithXFeatureFunction(xA, yA));
    LinearTagger h = p.batchTrain(train);
    return h;
  }
View Full Code Here

  public static LinearTagger trainMira(boolean doAveraging, int numIters,
      ArrayList<SequenceInstance> train, Alphabet xA, Alphabet yA) {
    Mira p = new Mira(doAveraging, numIters, xA, yA,
        new TwoYwithXFeatureFunction(xA, yA), new HammingLoss());
    LinearTagger h = p.batchTrain(train);
    return h;
  }
View Full Code Here

  }

  public static LinearTagger trainCRF(ArrayList<SequenceInstance> train,
      Alphabet xA, Alphabet yA) {
    CRF crf = new CRF(10, xA, yA, new OneYwithXFeatureFunction(xA, yA));
    LinearTagger h = crf.batchTrain(train);
    return h;
  }
View Full Code Here

TOP

Related Classes of sequence.LinearTagger

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.