data
Class DataBlock

java.lang.Object
  extended by data.DataBlock

public class DataBlock
extends java.lang.Object

A class for holding a block of data. The implication is that the fact that the data was generated in this block is of some significance, and so the integrity of this block , in terms of the order of data points, will be honored. Inputs and outputs are stored row-wise.

Author:
dgorur

Constructor Summary
DataBlock()
          Default constructor.
DataBlock(cern.colt.matrix.DoubleMatrix2D x, cern.colt.matrix.DoubleMatrix2D y)
          Constructs a DataBlock with the given matrices as inputs and outputs.
DataBlock(int inputDimension, int outputDimension, int blocksize)
          Creates a new DataBlock to hold blocksize input-output pairs, in the corresponding number of dimensions, respectively.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getBlocksize()
          Returns the block size of this DataBlock.
 DataPoint getDataPoint(int index)
          Gets the requested DataPoint.
 cern.colt.matrix.DoubleMatrix1D getInput(int index)
          Returns the inputs at the given index.
 int getInputDimension()
          Returns the input dimension.
 cern.colt.matrix.DoubleMatrix2D getInputs()
          Returns the inputs.
 cern.colt.matrix.DoubleMatrix1D getOutput(int index)
          Returns the outputs at the given index.
 int getOutputDimension()
          Returns the output dimension.
 cern.colt.matrix.DoubleMatrix2D getOutputs()
          Returns the outputs.
 void init()
          Init method.
 void setBlocksize(int blocksize)
          Sets the block size.
 void setInput(int index, double[] input)
          Sets the input at the given index.
 void setInput(int index, cern.colt.matrix.DoubleMatrix1D input)
          Sets the input at the given index.
 void setInputDimension(int inputDimension)
          Sets the input dimension.
 void setInputs(double[][] inputs)
          Sets the inputs.
 void setInputs(cern.colt.matrix.DoubleMatrix2D inputs)
          Sets the inputs.
 void setOutput(int index, double[] output)
          Sets the output at the given index.
 void setOutput(int index, cern.colt.matrix.DoubleMatrix1D output)
          Sets the output at the given index.
 void setOutputDimension(int outputDimension)
          Sets the output dimension.
 void setOutputs(double[][] outputs)
          Sets the outputs.
 void setOutputs(cern.colt.matrix.DoubleMatrix2D outputs)
          Sets the outputs.
 java.lang.String toString()
           
 void writeToFile(java.io.PrintWriter writer)
          Writes this DataBlock to human-readable form using the given PrintWriter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataBlock

public DataBlock()
Default constructor. Can then set inputs and outputs using setInputs(DoubleMatrix2D) and setOutputs(DoubleMatrix2D) methods.


DataBlock

public DataBlock(cern.colt.matrix.DoubleMatrix2D x,
                 cern.colt.matrix.DoubleMatrix2D y)
Constructs a DataBlock with the given matrices as inputs and outputs. Note: input and output matrices are interpreted row-wise: each row is one input/output.

Parameters:
x - the given matrix of inputs.
y - the given matrix of outputs.

DataBlock

public DataBlock(int inputDimension,
                 int outputDimension,
                 int blocksize)
Creates a new DataBlock to hold blocksize input-output pairs, in the corresponding number of dimensions, respectively.

Parameters:
inputDimension - the given input dimension.
outputDimension - the given output dimension.
blocksize - the given block size.
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getBlocksize

public int getBlocksize()
Returns the block size of this DataBlock.

Returns:
the block size.

getDataPoint

public DataPoint getDataPoint(int index)
Gets the requested DataPoint.

Parameters:
index - the index of the desired DataPoint.
Returns:
the requested DataPoint.

getInput

public cern.colt.matrix.DoubleMatrix1D getInput(int index)
Returns the inputs at the given index.

Parameters:
index - the given index.
Returns:
the input at that index.

getInputDimension

public int getInputDimension()
Returns the input dimension.

Returns:
the input dimension.

getInputs

public cern.colt.matrix.DoubleMatrix2D getInputs()
Returns the inputs.

Returns:
the inputs.

getOutput

public cern.colt.matrix.DoubleMatrix1D getOutput(int index)
Returns the outputs at the given index.

Parameters:
index - the given index.
Returns:
the output at that index.

getOutputDimension

public int getOutputDimension()
Returns the output dimension.

Returns:
the output dimension.

getOutputs

public cern.colt.matrix.DoubleMatrix2D getOutputs()
Returns the outputs.

Returns:
the outputs.

init

public void init()
Init method.


setBlocksize

public void setBlocksize(int blocksize)
Sets the block size.

Parameters:
blocksize - the given block size.

setInput

public void setInput(int index,
                     double[] input)
Sets the input at the given index.

Parameters:
index - the given index.
input - the given input.

setInput

public void setInput(int index,
                     cern.colt.matrix.DoubleMatrix1D input)
Sets the input at the given index.

Parameters:
index - the given index.
input - the given input.

setInputDimension

public void setInputDimension(int inputDimension)
Sets the input dimension.

Parameters:
inputDimension - the given input dimension

setInputs

public void setInputs(double[][] inputs)
Sets the inputs. This does NOT change inputDimension or blocksize because double[][] arrays can be ragged. Therefore, it just assigns values.

Parameters:
inputs - The given inputs.

setInputs

public void setInputs(cern.colt.matrix.DoubleMatrix2D inputs)
Sets the inputs. Changes the blocksize and inputDimension to match the supplied set of inputs.

Parameters:
inputs - the given inputs.

setOutput

public void setOutput(int index,
                      double[] output)
Sets the output at the given index.

Parameters:
index - the given index.
output - the given output.

setOutput

public void setOutput(int index,
                      cern.colt.matrix.DoubleMatrix1D output)
Sets the output at the given index.

Parameters:
index - the given index.
output - the given output.

setOutputDimension

public void setOutputDimension(int outputDimension)
Sets the output dimension.

Parameters:
outputDimension - the given output dimension.

setOutputs

public void setOutputs(double[][] outputs)
Sets the outputs.

Parameters:
outputs - the given outputs.

setOutputs

public void setOutputs(cern.colt.matrix.DoubleMatrix2D outputs)
Sets the outputs. This may change the output dimension, but not the block size. The idea is that a user may suddenly want to add another set of outputs for each input, but cannot add outputs for which there aren't any inputs.

Parameters:
outputs - the given outputs.

writeToFile

public void writeToFile(java.io.PrintWriter writer)
Writes this DataBlock to human-readable form using the given PrintWriter. This is not designed to be used for serialization.

Parameters:
writer - the given PrintWriter,

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object