Package org.fnlp.ml.classifier.linear.inf

Examples of org.fnlp.ml.classifier.linear.inf.LinearMax


      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);
      Linear pclassifier = trainer.train(instset,instset);
      pipe.removeTargetPipe();
      pclassifier.setPipe(pipe);
View Full Code Here


    Generator featureGen = new SFGenerator();
    ZeroOneLoss loss = new ZeroOneLoss();
    LinearMaxPAUpdate update = new LinearMaxPAUpdate(loss);
   
   
    Inferencer msolver = new LinearMax(featureGen, al.size() );
    OnlineTrainer trainer = new OnlineTrainer(msolver, update, loss, af.size(), round,
        c);

    Linear classify = trainer.train(train, test);
    String modelFile = path+".m.gz";
View Full Code Here

  public OnlineTrainer(AlphabetFactory af, int iternum) {
    //默认特征生成器
    Generator gen = new SFGenerator();
    //默认推理器
    this.inferencer = new LinearMax(gen, af.getLabelSize());
    //默认损失函数
    this.loss =  new ZeroOneLoss();
    //默认参数更新策略
    this.update = new LinearMaxPAUpdate(loss);
    this.iternum = iternum;
View Full Code Here

      InstanceSet instset = readInstanceSet(pos);
      LabelAlphabet alphabet = factory.buildLabelAlphabet(pos);
      int ysize = alphabet.size();
      System.out.printf("Training with data: %s\n", pos);
      System.out.printf("Number of labels: %d\n", ysize);
      LinearMax solver = new LinearMax(generator, ysize);
      ZeroOneLoss loss = new ZeroOneLoss();
      Update update = new LinearMaxPAUpdate(loss);
      OnlineTrainer trainer = new OnlineTrainer(solver, update, loss,
          fsize, maxite, c);
      models[i] = trainer.train(instset, null);
View Full Code Here

    int fsize = features.size();
   
    LabelAlphabet la = factory.DefaultLabelAlphabet();
    int ysize = la.size();
    System.out.printf("开始训练");
    LinearMax solver = new LinearMax(generator, ysize);
    ZeroOneLoss loss = new ZeroOneLoss();
    Update update = new LinearMaxPAUpdate(loss);
    OnlineTrainer trainer = new OnlineTrainer(solver, update, loss,
        fsize, maxite, c);
    Linear models = trainer.train(instset, null);
View Full Code Here

TOP

Related Classes of org.fnlp.ml.classifier.linear.inf.LinearMax

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.