Package org.fnlp.ml.classifier.linear.update

Examples of org.fnlp.ml.classifier.linear.update.LinearMaxPAUpdate


      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);
      factory.setStopIncrement(true);
View Full Code Here


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

    //默认推理器
    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();
    if (weights == null) {
      weights = new float[af.getFeatureSize()];
View Full Code Here

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

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

TOP

Related Classes of org.fnlp.ml.classifier.linear.update.LinearMaxPAUpdate

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.