Examples of ZeroOneLoss


Examples of org.fnlp.ml.loss.ZeroOneLoss


      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();
View Full Code Here

Examples of org.fnlp.ml.loss.ZeroOneLoss

    float c = 1.0f;
    int round = 20;
   
    BaseGenerator featureGen = new BaseGenerator();
    ZeroOneLoss loss = new ZeroOneLoss();
    Inferencer msolver = new MultiLinearMax(featureGen, al, null,2);

    PATrainer trainer = new PATrainer(msolver, featureGen, loss, round,c, null);
    Linear pclassifier = trainer.train(train, null);
   
View Full Code Here

Examples of org.fnlp.ml.loss.ZeroOneLoss

    float c = 1.0f;
    int round = 20;
   
    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,
View Full Code Here

Examples of org.fnlp.ml.loss.ZeroOneLoss

    float c = 1.0f;
    int round = 10;
   
    BaseGenerator featureGen = new BaseGenerator();
    ZeroOneLoss loss = new ZeroOneLoss();
    Inferencer msolver = new MultiLinearMax(featureGen, lf, null,2);

    PATrainer trainer = new PATrainer(msolver, featureGen, loss, round,c, null);
    Linear pclassifier = trainer.train(trainset, null);
    String modelFile = "./tmp/m.gz";
View Full Code Here

Examples of org.fnlp.ml.loss.ZeroOneLoss

    //默认特征生成器
    Generator gen = new SFGenerator();
    //默认推理器
    this.inferencer = new LinearMax(gen, af.getLabelSize());
    //默认损失函数
    this.loss =  new ZeroOneLoss();
    //默认参数更新策略
    this.update = new LinearMaxPAUpdate(loss);
    this.iternum = iternum;
    this.c = 0.1f;
    weights = (float[]) inferencer.getWeights();
View Full Code Here

Examples of org.fnlp.ml.loss.ZeroOneLoss

      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);
      instset = null;
View Full Code Here

Examples of org.fnlp.ml.loss.ZeroOneLoss

   
    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);
    instset = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.