Package org.fnlp.ml.feature

Examples of org.fnlp.ml.feature.SFGenerator




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


    System.out.println("Class Number: " + al.size());

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

  public int iternum;
  protected float[] weights;

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

    LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag");

    IFeatureAlphabet features = factory.DefaultFeatureAlphabet();

    SFGenerator generator = new SFGenerator();
    Linear[] models = new Linear[postagAlphabet.size()];
    int fsize = features.size();

    for (int i = 0; i < postagAlphabet.size(); i++) {
      String pos = postagAlphabet.lookupString(i);
View Full Code Here

  public void train(String dataFile, int maxite, float c) throws IOException {
   
    InstanceSet instset =  buildInstanceList(dataFile);
    IFeatureAlphabet features = factory.DefaultFeatureAlphabet();

    SFGenerator generator = new SFGenerator();
    int fsize = features.size();
   
    LabelAlphabet la = factory.DefaultLabelAlphabet();
    int ysize = la.size();
    System.out.printf("开始训练");
View Full Code Here

TOP

Related Classes of org.fnlp.ml.feature.SFGenerator

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.