Examples of stringAt()


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

                                                                   conf)) {
      StringTuple key = record.getFirst();
      DoubleWritable value = record.getSecond();
      // Count of Documents in a Label
      if (key.stringAt(0).equals(BayesConstants.LABEL_COUNT)) {
        labelDocumentCounts.put(key.stringAt(1), value.get());
      }
    }
    return labelDocumentCounts;
  }
 
View Full Code Here

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

                                                                   conf)) {
      StringTuple key = record.getFirst();
      DoubleWritable value = record.getSecond();
      if (weightSum.size() > 1) {
        throw new IllegalStateException("Incorrect Sum File");
      } else if (key.stringAt(0).equals(BayesConstants.TOTAL_SUM)) {
        weightSum.put(BayesConstants.TOTAL_SUM, value.get());
      }
    }
    return weightSum.get(BayesConstants.TOTAL_SUM);
  }
View Full Code Here

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

      if (weightSum.size() > 1) {
        throw new IllegalStateException("Incorrect vocabCount File");
      }
      StringTuple key = record.getFirst();
      DoubleWritable value = record.getSecond();
      if (key.stringAt(0).equals(BayesConstants.FEATURE_SET_SIZE)) {
        weightSum.put(BayesConstants.FEATURE_SET_SIZE, value.get());
      }
    }
    return weightSum.get(BayesConstants.FEATURE_SET_SIZE);
  }
View Full Code Here

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

                                                                   null,
                                                                   true,
                                                                   conf)) {
      StringTuple key = record.getFirst();
      DoubleWritable value = record.getSecond();
      String correctLabel = key.stringAt(1);
      String classifiedLabel = key.stringAt(2);
      Map<String,Integer> rowMatrix = confusionMatrix.get(correctLabel);
      if (rowMatrix == null) {
        rowMatrix = Maps.newHashMap();
      }
View Full Code Here

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

                                                                   true,
                                                                   conf)) {
      StringTuple key = record.getFirst();
      DoubleWritable value = record.getSecond();
      String correctLabel = key.stringAt(1);
      String classifiedLabel = key.stringAt(2);
      Map<String,Integer> rowMatrix = confusionMatrix.get(correctLabel);
      if (rowMatrix == null) {
        rowMatrix = Maps.newHashMap();
      }
      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() == 1) && key.stringAt(0).equals(BayesConstants.FEATURE_SET_SIZE)) {
      return "trainer-vocabCount/" + name;
    } else {
      return "trainer-tfIdf/" + name;
    }
  }
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() == 1) && key.stringAt(0).equals(BayesConstants.TOTAL_SUM)) {
      return "Sigma_kSigma_j/" + name;
    } else {
      if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) {
        return "Sigma_j/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.LABEL_SUM)) {
View Full Code Here

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

    StringTuple key = (StringTuple) k;
   
    if ((key.length() == 1) && key.stringAt(0).equals(BayesConstants.TOTAL_SUM)) {
      return "Sigma_kSigma_j/" + name;
    } else {
      if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) {
        return "Sigma_j/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.LABEL_SUM)) {
        return "Sigma_k/" + name;
      } else {
        throw new IllegalArgumentException("Unexpected StringTuple: " + key);
View Full Code Here

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

    if ((key.length() == 1) && key.stringAt(0).equals(BayesConstants.TOTAL_SUM)) {
      return "Sigma_kSigma_j/" + name;
    } else {
      if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) {
        return "Sigma_j/" + name;
      } else if (key.stringAt(0).equals(BayesConstants.LABEL_SUM)) {
        return "Sigma_k/" + name;
      } else {
        throw new IllegalArgumentException("Unexpected StringTuple: " + key);
      }
    }
View Full Code Here

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
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.