Package org.fnlp.data.reader

Examples of org.fnlp.data.reader.SimpleFileReader


      ARClassifier tc = new ARClassifier();
      tc.train();
      Linear cl =Linear.loadFrom(modelFile);
      int i = 0;int j = 0;double ij = 0.0;int kk = 0;int jj = 0;int nn = 0;int n = 0;
      InstanceSet test = new InstanceSet(cl.getPipe(),cl.getAlphabetFactory());
      SimpleFileReader sfr = new SimpleFileReader("../tmp/ar-train.txt",true);
     
      ArrayList<Instance> list1 = new ArrayList<Instance>();
      while (sfr.hasNext())
      {
        list1.add(sfr.next());
      }
      List<String>[] str1 = new List[list1.size()];
      String[] str2 = new String[list1.size()];
      Iterator it = list1.iterator();
      while(it.hasNext()){
View Full Code Here


      SeriesPipes pipe = new SeriesPipes(new Pipe[]{lpipe,fpipe});



      InstanceSet instset = new InstanceSet(pipe,factory);
      instset.loadThruStagePipes(new SimpleFileReader(trainFile," ",true,Type.LabelData));
      Generator gen = new SFGenerator();
      ZeroOneLoss l = new ZeroOneLoss();
      Inferencer ms = new LinearMax(gen, factory.getLabelSize());
      Update update = new LinearMaxPAUpdate(l);
      OnlineTrainer trainer = new OnlineTrainer(ms, update,l, factory.getFeatureSize(), 50,0.005f);
View Full Code Here

    //构造转换器组
    Pipe pipe = new SeriesPipes(new Pipe[]{lpipe,fpipe});
   
    //构建训练集
    train = new InstanceSet(pipe, factory);
    SimpleFileReader reader = new SimpleFileReader (path,true);
    train.loadThruStagePipes(reader);
    al.setStopIncrement(true);
   
    //构建测试集
    test = new InstanceSet(pipe, factory);   
    reader = new SimpleFileReader (path,true);
    test.loadThruStagePipes(reader)

    System.out.println("Train Number: " + train.size());
    System.out.println("Test Number: " + test.size());
    System.out.println("Class Number: " + al.size());
View Full Code Here

    //构造转换器组
    Pipe pipe = new SeriesPipes(new Pipe[]{lpipe,fpipe});
   
    //构建训练集
    train = new InstanceSet(pipe, factory);
    SimpleFileReader reader = new SimpleFileReader (path,true);
    train.loadThruStagePipes(reader);
    al.setStopIncrement(true);
   
    //构建测试集
    test = new InstanceSet(pipe, factory);   
    reader = new SimpleFileReader (path,true);
    test.loadThruStagePipes(reader)

    System.out.println("Train Number: " + train.size());
    System.out.println("Test Number: " + test.size());
    System.out.println("Class Number: " + al.size());
View Full Code Here

TOP

Related Classes of org.fnlp.data.reader.SimpleFileReader

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.