csli.util.classify.stanford
Class WindowBuffer

java.lang.Object
  extended by csli.util.classify.stanford.WindowBuffer

public class WindowBuffer
extends Object

A 2-dimensional buffer which efficiently calculates the column rows/sums during the shift/add operation


Constructor Summary
WindowBuffer(int i, int j)
          A 2-dimensional buffer
 
Method Summary
 void add(double[] newValues)
          Add a new instance to the buffer.
 void add(Double[] newValues)
          Add a new instance to the buffer.
 void add(List<Double> newValues)
          Add a new instance to the buffer.
 void clear()
          Fill the buffer with zeros
 int[] getMaxInds()
           
 double[] getMaxs()
           
 double[] getProducts()
           
 Integer[][] getSortInds()
           
 double[] getSums()
           
 double getValue(int i, int j)
           
 int length()
           
 String toString()
           
 int width()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WindowBuffer

public WindowBuffer(int i,
                    int j)
A 2-dimensional buffer

Parameters:
i - the length of the buffer (number of rows/stored instances)
j - the width of the buffer (number of columns/features per instance)
Method Detail

clear

public void clear()
Fill the buffer with zeros


add

public void add(List<Double> newValues)
Add a new instance to the buffer. This will shift each instance (row) down by one, and add the new instance (row) at the end

Parameters:
newValues - a data list of length ncolumns

add

public void add(Double[] newValues)
Add a new instance to the buffer. This will shift each instance (row) down by one, and add the new instance (row) at the end

Parameters:
newValues - a data array of length ncolumns

add

public void add(double[] newValues)
Add a new instance to the buffer. This will shift each instance (row) down by one, and add the new instance (row) at the end

Parameters:
newValues - a data array of length ncolumns

getValue

public double getValue(int i,
                       int j)
Parameters:
i - the row (historical data instance, oldest = 0)
j - the column (feature)
Returns:
the value for a particular row & column

getSums

public double[] getSums()
Returns:
the sums for each column (feature)

getProducts

public double[] getProducts()
Returns:
the products for each column (feature)

getMaxs

public double[] getMaxs()
Returns:
the maximum values for each column (feature)

getMaxInds

public int[] getMaxInds()
Returns:
the row (instance) indices of the maximum values for each column (feature)

getSortInds

public Integer[][] getSortInds()
Returns:
a per-column array of row index arrays which contain the indices of the sorted (highest first) values for each column

length

public int length()
Returns:
the length of the buffer (number of rows/data instances)

width

public int width()
Returns:
the width of the buffer (number of columns/features)

toString

public String toString()
Overrides:
toString in class Object