Package org.fnlp.ml.types.alphabet

Examples of org.fnlp.ml.types.alphabet.LabelAlphabet


   *
   * @param eval
   */
  public Linear train(InstanceSet trainingList, Evaluation eval) {
    System.out.println("Sample Size: " + trainingList.size());
    LabelAlphabet labels = trainingList.getAlphabetFactory().DefaultLabelAlphabet();

    System.out.println("Class Size: " + labels.size());

    if(!incremental){
      // 初始化权重向量到类中心
      weights = Mean.mean(trainingList, tree);
      msolver.setWeight(weights);
View Full Code Here


    String pos = state.getLeftPos();
    int lpos = postagAlphabet.lookupIndex(pos);
    if(lpos==-1)
      throw new UnsupportedDataTypeException("不支持词性:"+pos);
    LabelAlphabet actionList = factory.buildLabelAlphabet(pos);
   
    Predict<Integer> ret = models[lpos].classify(inst, actionList.size());
    Object[] guess = ret.labels;
   
    float[][] result = new float[2][actionList.size()];
    float total = 0;
    for (int i = 0; i < guess.length; i++) {
      if(guess[i]==null) //bug:可能为空,待修改。 xpqiu
        break;
      String action = actionList.lookupString((Integer)guess[i]);
      result[0][i] = 0;
      if (action.matches("L"))
        result[0][i] = 1;
      else if (action.matches("R"))
        result[0][i] = 2;
View Full Code Here

TOP

Related Classes of org.fnlp.ml.types.alphabet.LabelAlphabet

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.