Examples of LongArrayList


Examples of org.apache.mahout.math.list.LongArrayList

   * (8,6,7)</tt>
   *
   * @param keyList the list to be filled, can have any size.
   */
  public void keysSortedByValue(ByteArrayList keyList) {
    pairsSortedByValue(keyList, new LongArrayList(size()));
  }
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

   * #forEachKey(ByteProcedure)}. <p> This method can be used to iterate over the values of the receiver.
   *
   * @return the values.
   */
  public LongArrayList values() {
    LongArrayList list = new LongArrayList(size());
    values(list);
    return list;
  }
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

   * (8,6,7)</tt>
   *
   * @param keyList the list to be filled, can have any size.
   */
  public void keysSortedByValue(CharArrayList keyList) {
    pairsSortedByValue(keyList, new LongArrayList(size()));
  }
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

   * #forEachKey(CharProcedure)}. <p> This method can be used to iterate over the values of the receiver.
   *
   * @return the values.
   */
  public LongArrayList values() {
    LongArrayList list = new LongArrayList(size());
    values(list);
    return list;
  }
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

   * #forEachKey(LongProcedure)}. <p> This method can be used to iterate over the keys of the receiver.
   *
   * @return the keys.
   */
  public LongArrayList keys() {
    LongArrayList list = new LongArrayList(size());
    keys(list);
    return list;
  }
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

  /**
   * Returns a string representation of the receiver, containing the String representation of each key-value pair,
   * sorted ascending by key.
   */
  public String toString() {
    LongArrayList theKeys = keys();
    //theKeys.sort();

    StringBuilder buf = new StringBuilder();
    buf.append('[');
    int maxIndex = theKeys.size() - 1;
    for (int i = 0; i <= maxIndex; i++) {
      long key = theKeys.get(i);
      buf.append(String.valueOf(key));
      buf.append("->");
      buf.append(String.valueOf(get(key)));
      if (i < maxIndex) {
        buf.append(", ");
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

  /**
   * Returns a string representation of the receiver, containing the String representation of each key-value pair,
   * sorted ascending by value.
   */
  public String toStringByValue() {
    LongArrayList theKeys = new LongArrayList();
    keysSortedByValue(theKeys);

    StringBuilder buf = new StringBuilder();
    buf.append('[');
    int maxIndex = theKeys.size() - 1;
    for (int i = 0; i <= maxIndex; i++) {
      long key = theKeys.get(i);
      buf.append(String.valueOf(key));
      buf.append("->");
      buf.append(String.valueOf(get(key)));
      if (i < maxIndex) {
        buf.append(", ");
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

   * Note that the counts in attrCounts are assumed to be complete;
   * they are not updated as the tree is modified.
   */
  public FPTree(long[] attrCounts, long minSupport) {
    this.root = new FPNode(null, -1, 0);
    this.attrCountList = new LongArrayList();
    for (int i = 0; i < attrCounts.length; i++)
      if (attrCounts[i] > 0) {
        if (attrCountList.size() < (i+1)) {
          attrCountList.setSize(i+1);
        }
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

  /**
   * Returns a conditional FP tree based on the targetAttr, containing
   * only items that are more frequent.
   */
  public FPTree createMoreFreqConditionalTree(int targetAttr) {
    LongArrayList counts = new LongArrayList();
    List<FPNode> nodeList = (List<FPNode>) attrNodeLists.get(targetAttr);

    for (FPNode currNode : nodeList) {
      long pathCount = currNode.count();
      while (currNode != root) {
        int currAttr = currNode.attribute();
        if (counts.size() <= currAttr) {
          counts.setSize(currAttr+1);
        }
        long count = counts.get(currAttr);
        counts.set(currNode.attribute(), count + pathCount);
        currNode = currNode.parent();
      }
    }
    if (counts.get(targetAttr) != attrCountList.get(targetAttr))
      throw new IllegalStateException("mismatched counts for targetAttr="
                                      +targetAttr+", ("+counts.get(targetAttr)
                                      +" != "+attrCountList.get(targetAttr)+"); "
                                      +"thisTree="+this+"\n");
    counts.set(targetAttr, 0L);

    FPTree toRet = new FPTree(counts, minSupport);
    IntArrayList attrLst = new IntArrayList();
    for (FPNode currNode : (List<FPNode>) attrNodeLists.get(targetAttr)) {
      long count = currNode.count();
View Full Code Here

Examples of org.apache.mahout.math.list.LongArrayList

   */
  public Pair<FPTree, FPTree> splitSinglePrefix() {
    if (root.numChildren() != 1) {
      return new Pair<FPTree, FPTree>(null, this);
    }
    LongArrayList pAttrCountList = new LongArrayList();
    LongArrayList qAttrCountList = attrCountList.copy();

    FPNode currNode = root;
    while (currNode.numChildren() == 1) {
      currNode = currNode.children().iterator().next();
      if (pAttrCountList.size() <= currNode.attribute())
        pAttrCountList.setSize(currNode.attribute()+1);
      pAttrCountList.set(currNode.attribute(), currNode.count());
      qAttrCountList.set(currNode.attribute(), 0);
    }

    FPTree pTree = new FPTree(pAttrCountList, minSupport);
    FPTree qTree = new FPTree(qAttrCountList, minSupport);
    recursivelyAddPrefixPats(pTree, qTree, root, null);
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.