org.apache.mahout.classifier.df.data
Class DataUtils

java.lang.Object
  extended by org.apache.mahout.classifier.df.data.DataUtils

public final class DataUtils
extends Object

Helper methods that deals with data lists and arrays of values


Method Summary
static void add(int[] array1, int[] array2)
          foreach i : array1[i] += array2[i]
static void dec(int[] array1, int[] array2)
          foreach i : array1[i] -= array2[i]
static int maxindex(Random rng, int[] values)
          return the index of the maximum of the array, breaking ties randomly
static int sum(int[] values)
          Computes the sum of the values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sum

public static int sum(int[] values)
Computes the sum of the values


add

public static void add(int[] array1,
                       int[] array2)
foreach i : array1[i] += array2[i]


dec

public static void dec(int[] array1,
                       int[] array2)
foreach i : array1[i] -= array2[i]


maxindex

public static int maxindex(Random rng,
                           int[] values)
return the index of the maximum of the array, breaking ties randomly

Parameters:
rng - used to break ties
Returns:
index of the maximum


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.