Package org.apache.mahout.math.list

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


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


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

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

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

   *                    <tt>[0.0,1.0]</tt>.
   * @return the quantiles.
   */
  public static DoubleArrayList quantiles(DoubleArrayList sortedData, DoubleArrayList percentages) {
    int s = percentages.size();
    DoubleArrayList quantiles = new DoubleArrayList(s);

    for (int i = 0; i < s; i++) {
      quantiles.add(quantile(sortedData, percentages.get(i)));
    }

    return quantiles;
  }
View Full Code Here

    // assertion: splitValues is sorted ascending.
    int noOfBins = splitters.size() + 1;

    DoubleArrayList[] bins = new DoubleArrayList[noOfBins];
    for (int i = noOfBins; --i >= 0;) {
      bins[i] = new DoubleArrayList();
    }

    int listSize = sortedList.size();
    int nextStart = 0;
    int i = 0;
View Full Code Here

   * @param values The values to be filled into the new list.
   * @return a new list.
   */
  public org.apache.mahout.math.list.DoubleArrayList toList(DoubleMatrix1D values) {
    int size = values.size();
    DoubleArrayList list = new DoubleArrayList(size);
    list.setSize(size);
    for (int i = size; --i >= 0;) {
      list.set(i, values.get(i));
    }
    return list;
  }
View Full Code Here

      double v1 = entropy.get(trueValue, 1);
      entropy.set(trueValue, 1, (Math.log(limited) - v1) / samples + v1);
    }

    // add to buffers
    DoubleArrayList buf = scores[trueValue];
    if (buf.size() >= maxBufferSize) {
      // but if too many points are seen, we insert into a random
      // place and discard the predecessor.  The random place could
      // be anywhere, possibly not even in the buffer.
      // this is a special case of Knuth's permutation algorithm
      // but since we don't ever shuffle the first maxBufferSize
      // samples, the result isn't just a fair sample of the prefixes
      // of all permutations.  The CONTENTs of the result, however,
      // will be a fair and uniform sample of maxBufferSize elements
      // chosen from all elements without replacement
      int index = rand.nextInt(samples);
      if (index < buf.size()) {
        buf.set(index, score);
      }
    } else {
      // for small buffers, we collect all points without permuting
      // since we sort the data later, permuting now would just be
      // pedantic
      buf.add(score);
    }
  }
View Full Code Here

      double v1 = entropy.get(trueValue, 1);
      entropy.set(trueValue, 1, (Math.log(limited) - v1) / samples + v1);
    }

    // add to buffers
    DoubleArrayList buf = scores[trueValue];
    if (buf.size() >= maxBufferSize) {
      // but if too many points are seen, we insert into a random
      // place and discard the predecessor.  The random place could
      // be anywhere, possibly not even in the buffer.
      // this is a special case of Knuth's permutation algorithm
      // but since we don't ever shuffle the first maxBufferSize
      // samples, the result isn't just a fair sample of the prefixes
      // of all permutations.  The CONTENTs of the result, however,
      // will be a fair and uniform sample of maxBufferSize elements
      // chosen from all elements without replacement
      int index = rand.nextInt(samples);
      if (index < buf.size()) {
        buf.set(index, score);
      }
    } else {
      // for small buffers, we collect all points without permuting
      // since we sort the data later, permuting now would just be
      // pedantic
      buf.add(score);
    }
  }
View Full Code Here

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

TOP

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

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.