Package org.apache.mahout.math.list

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


    super.readFields(in);
    VectorWritable temp = new VectorWritable();
    temp.readFields(in);
    this.setCenter(temp.get());
    int numpoints = in.readInt();
    this.boundPoints = new IntArrayList();
    for (int i = 0; i < numpoints; i++) {
      this.boundPoints.add(in.readInt());
    }
  }
View Full Code Here


    }

    log.info("Number of unique items {}", attributeFrequency.size());

    if (returnableFeatures == null || returnableFeatures.isEmpty()) {
      returnableFeatures = new IntArrayList();
      for (int j = 0; j < attributeFrequency.size(); j++) {
        returnableFeatures.add(j);
      }
    }
View Full Code Here

    // Constructing initial FPTree from the list of transactions
    int i = 0;
    while (transactions.hasNext()) {
      Pair<IntArrayList,Long> transaction = transactions.next();
      IntArrayList iArr = transaction.getFirst();
      tree.accumulate(iArr, transaction.getSecond());
      i++;
      if (i % 10000 == 0) {
        log.info("FPTree Building: Read {} Transactions", i);
      }
View Full Code Here

  }

  /* Y' Y */
  private Matrix getYtransposeY(OpenIntObjectHashMap<Vector> Y) {

    IntArrayList indexes = Y.keys();
    indexes.quickSort();
    int numIndexes = indexes.size();

    double[][] YtY = new double[numFeatures][numFeatures];

    // Compute Y'Y by dot products between the 'columns' of Y
    for (int i = 0; i < numFeatures; i++) {
      for (int j = i; j < numFeatures; j++) {
        double dot = 0;
        for (int k = 0; k < numIndexes; k++) {
          Vector row = Y.get(indexes.getQuick(k));
          dot += row.getQuick(i) * row.getQuick(j);
        }
        YtY[i][j] = dot;
        if (i != j) {
          YtY[j][i] = dot;
View Full Code Here

                                          + "thisTree=" + this + '\n');
    }
    counts.set(targetAttr, 0L);

    FPTree toRet = new FPTree(counts, minSupport);
    IntArrayList attrLst = new IntArrayList();
    for (FPNode currNode : attrNodeLists.get(targetAttr)) {
      long count = currNode.count();
      attrLst.clear();
      while (currNode != root) {
        if (currNode.count() < count) {
          throw new IllegalStateException();
        }
        attrLst.add(currNode.attribute());
        currNode = currNode.parent();
      }

      toRet.accumulate(attrLst, count);     
    }   
View Full Code Here

    if (items == null) {
      // at root
      if (node != root) {
        throw new IllegalStateException();
      }
      items = new IntArrayList();
    } else {
      items.add(attribute);
    }
    long added = 0;
    for (FPNode child : node.children()) {
View Full Code Here

      if (fMap.containsKey(item) && !item.trim().isEmpty()) {
        itemSet.add(fMap.get(item));
      }
    }

    IntArrayList itemArr = new IntArrayList(itemSet.size());
    itemSet.keys(itemArr);
    itemArr.sort();

    OpenIntHashSet groups = new OpenIntHashSet();
    for (int j = itemArr.size() - 1; j >= 0; j--) {
      // generate group dependent shards
      int item = itemArr.get(j);
      int groupID = PFPGrowth.getGroup(item, maxPerGroup);
       
      if (!groups.contains(groupID)) {
        IntArrayList tempItems = new IntArrayList(j + 1);
        tempItems.addAllOfFromTo(itemArr, 0, j);
        context.setStatus("Parallel FPGrowth: Generating Group Dependent transactions for: " + item);
        wGroupID.set(groupID);
        context.write(wGroupID, new TransactionTree(tempItems, 1L));
      }
      groups.add(groupID);
View Full Code Here

          }
        }
        if (facets != null) {
          List<String> keyList = Lists.newArrayListWithCapacity(facets.size());

          IntArrayList valueList = new IntArrayList(facets.size());
          facets.pairsSortedByKey(keyList, valueList);
          writer.append("-----Facets---\n");
          writer.append("Key\t\tCount\n");
          int i = 0;
          for (String key : keyList) {
            writer.append(key).append("\t\t").append(String.valueOf(valueList.get(i++))).append('\n');
          }
        }
      }
      writer.flush();
View Full Code Here

    return clone;
  }

  @Override
  public Iterator<MatrixSlice> iterator() {
    final IntArrayList keys = new IntArrayList(rowVectors.size());
    rowVectors.keys(keys);
    return new AbstractIterator<MatrixSlice>() {
      private int slice;
      @Override
      protected MatrixSlice computeNext() {
        if (slice >= rowVectors.size()) {
          return endOfData();
        }
        int i = keys.get(slice);
        Vector row = rowVectors.get(i);
        slice++;
        return new MatrixSlice(row, i);
      }
    };
View Full Code Here

      }
    } while (sum == transactionTree.count(childId));

    Iterator<int[]> it = depth.iterator();
    it.next();
    IntArrayList data = new IntArrayList();
    while (it.hasNext()) {
      data.add(transactionTree.attribute(it.next()[0]));
    }

    Pair<IntArrayList,Long> returnable = new Pair<IntArrayList,Long>(data, transactionTree.count(childId) - sum);

    int[] top = depth.peek();
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.list.IntArrayList

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.