Package org.apache.mahout.common

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


    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

  @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

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

      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;
    }
    throw new RuntimeException("Unrecognized Tuple: " + key);   
View Full Code Here

    }
    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;
    }
    throw new RuntimeException("Unrecognized Tuple: " + key);   
  }
View Full Code Here

      SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);

      // the key is label,feature
      while (reader.next(key, value)) {

        datastore.loadFeatureWeight(key.stringAt(2), key.stringAt(1), value
            .get());

      }
    }
  }
View Full Code Here

      SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);

      // the key is label,feature
      while (reader.next(key, value)) {

        datastore.loadFeatureWeight(key.stringAt(2), key.stringAt(1), value
            .get());

      }
    }
  }
View Full Code Here

      // the key is either _label_ or label,feature
      long count = 0;
      while (reader.next(key, value)) {

        if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) { // Sum of
                                                                  // weights for
                                                                  // a Feature
          datastore.setSumFeatureWeight(key.stringAt(1), value.get());
          count++;
          if (count % 50000 == 0) {
View Full Code Here

      while (reader.next(key, value)) {

        if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) { // Sum of
                                                                  // weights for
                                                                  // a Feature
          datastore.setSumFeatureWeight(key.stringAt(1), value.get());
          count++;
          if (count % 50000 == 0) {
            log.info("Read {} feature weights", count);
          }
        }
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.