Examples of stringAt()


Examples of org.apache.mahout.common.StringTuple.stringAt()

    StringTuple ta = (StringTuple) a;
    StringTuple tb = (StringTuple) b;
    Preconditions.checkArgument(ta.length() >= 2 && ta.length() <= 3 && tb.length() >= 2 && tb.length() <= 3, "StringTuple length out of bounds");
    // token
    String tmpa = ta.length() == 2 ? ta.stringAt(1) : ta.stringAt(2);
    String tmpb = tb.length() == 2 ? tb.stringAt(1) : tb.stringAt(2);
    int cmp = tmpa.compareTo(tmpb);
    if (cmp != 0) {
      return cmp;
    }
   
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

    if (cmp != 0) {
      return cmp;
    }
   
    // type, FEATURE_TF first, then FEATURE_COUNT, then DF or anything else.
    cmp = ta.stringAt(0).compareTo(tb.stringAt(0));
    if (cmp != 0) {
      if (ta.stringAt(0).equals(BayesConstants.FEATURE_TF)) {
        return -1;
      } else if (tb.stringAt(0).equals(BayesConstants.FEATURE_TF)) {
        return 1;
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

    // type, FEATURE_TF first, then FEATURE_COUNT, then DF or anything else.
    cmp = ta.stringAt(0).compareTo(tb.stringAt(0));
    if (cmp != 0) {
      if (ta.stringAt(0).equals(BayesConstants.FEATURE_TF)) {
        return -1;
      } else if (tb.stringAt(0).equals(BayesConstants.FEATURE_TF)) {
        return 1;
      } else if (ta.stringAt(0).equals(BayesConstants.FEATURE_COUNT)) {
        return -1;
      } else if (tb.stringAt(0).equals(BayesConstants.FEATURE_COUNT)) {
        return 1;
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

        return -1;
      } else if (tb.stringAt(0).equals(BayesConstants.FEATURE_TF)) {
        return 1;
      } else if (ta.stringAt(0).equals(BayesConstants.FEATURE_COUNT)) {
        return -1;
      } else if (tb.stringAt(0).equals(BayesConstants.FEATURE_COUNT)) {
        return 1;
      } else {
        return cmp;
      }
    }
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

      }
    }

    // label or empty.
    tmpa = ta.length() == 2 ? "" : ta.stringAt(1);
    tmpb = tb.length() == 2 ? "" : tb.stringAt(1);
   
    cmp = tmpa.compareTo(tmpb);
    return cmp;
  }
 
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

   
    for (FileStatus fileStatus : outputFiles) {
      Path path = fileStatus.getPath();
      SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
      while (reader.next(key, value)) {
        String correctLabel = key.stringAt(1);
        String classifiedLabel = key.stringAt(2);
        Map<String,Integer> rowMatrix = confusionMatrix.get(correctLabel);
        if (rowMatrix == null) {
          rowMatrix = new HashMap<String,Integer>();
        }
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

    for (FileStatus fileStatus : outputFiles) {
      Path path = fileStatus.getPath();
      SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
      while (reader.next(key, value)) {
        String correctLabel = key.stringAt(1);
        String classifiedLabel = key.stringAt(2);
        Map<String,Integer> rowMatrix = confusionMatrix.get(correctLabel);
        if (rowMatrix == null) {
          rowMatrix = new HashMap<String,Integer>();
        }
        Integer count = Double.valueOf(value.get()).intValue();
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

 
  @Override
  protected String generateFileNameForKeyValue(WritableComparable<?> k, Writable v, String name) {
    StringTuple key = (StringTuple) k;
    if (key.length() == 3) {
      if (key.stringAt(0).equals(BayesConstants.WEIGHT)) {
        return "trainer-wordFreq/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.DOCUMENT_FREQUENCY)) {
        return "trainer-termDocCount/" + name;
      }
    } else if (key.length() == 2) {
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

  protected String generateFileNameForKeyValue(WritableComparable<?> k, Writable v, String name) {
    StringTuple key = (StringTuple) k;
    if (key.length() == 3) {
      if (key.stringAt(0).equals(BayesConstants.WEIGHT)) {
        return "trainer-wordFreq/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.DOCUMENT_FREQUENCY)) {
        return "trainer-termDocCount/" + name;
      }
    } else if (key.length() == 2) {
      if (key.stringAt(0).equals(BayesConstants.FEATURE_COUNT)) {
        return "trainer-featureCount/" + name;
View Full Code Here

Examples of org.apache.mahout.common.StringTuple.stringAt()

        return "trainer-wordFreq/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.DOCUMENT_FREQUENCY)) {
        return "trainer-termDocCount/" + name;
      }
    } else if (key.length() == 2) {
      if (key.stringAt(0).equals(BayesConstants.FEATURE_COUNT)) {
        return "trainer-featureCount/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.LABEL_COUNT)) {
        return "trainer-docCount/" + name;
      }
    }
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.