data
Class DataPoint

java.lang.Object
  extended by data.DataPoint
All Implemented Interfaces:
VariableInputDimension, VariableOutputDimension

public class DataPoint
extends java.lang.Object
implements VariableInputDimension, VariableOutputDimension

Class to store an input-output pair, called a DataPoint. Both inputs and outputs can be vectors, but they have to be vectors of doubles.

Author:
dgorur

Constructor Summary
DataPoint()
          Void constructor.
DataPoint(int inputDimension, int outputDimension)
          Creates a new DataPoint in the given number of input and output dimensions.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 double[] getInput()
          Returns the input.
 double getInput(int index)
          Returns the desired component of the input
 int getInputDimension()
          Returns the input dimension.
 cern.colt.matrix.DoubleMatrix1D getInputVec()
          Returns the input as a DoubleMatrix1D.
 double[] getOutput()
          Returns the output.
 double getOutput(int index)
          Returns the desired component of the output.
 int getOutputDimension()
          Returns the output dimension.
 cern.colt.matrix.DoubleMatrix1D getOutputVec()
          Returns the output as a DoubleMatrix1D.
 void setInput(double[] input)
          Sets the input.
 void setInput(cern.colt.matrix.DoubleMatrix1D input)
          Sets the input.
 void setInput(int index, double val)
          Sets the specified component of the input to the given value.
 void setInputDimension(int inputDimension)
          Sets the input dimension.
 void setOutput(double[] output)
          Sets the output.
 void setOutput(cern.colt.matrix.DoubleMatrix1D output)
          Sets the output.
 void setOutput(int index, double val)
          Sets the specified component of the output to the given value.
 void setOutputDimension(int outputDimension)
          Sets the output dimension.
 java.lang.String toString()
           
 void writeToFile(java.io.PrintWriter writer)
          Writes a human-readable form of this DataPoint using the given PrintWriter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataPoint

public DataPoint()
Void constructor. Can then invoke setInput(DoubleMatrix1D) and setOutput(int, double) methods.


DataPoint

public DataPoint(int inputDimension,
                 int outputDimension)
Creates a new DataPoint in the given number of input and output dimensions.

Parameters:
inputDimension - the given number of input dimensions.
outputDimension - the given number of output dimensions.
Method Detail

equals

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

getInput

public double[] getInput()
Returns the input.

Returns:
the input.

getInput

public double getInput(int index)
Returns the desired component of the input

Parameters:
index - the index of the desired component of the input.
Returns:
the value of the specified component of the input.

getInputDimension

public int getInputDimension()
Returns the input dimension.

Returns:
the input dimension.

getInputVec

public cern.colt.matrix.DoubleMatrix1D getInputVec()
Returns the input as a DoubleMatrix1D.

Returns:
the input as a DoubleMatrix1D.

getOutput

public double[] getOutput()
Returns the output.

Returns:
the output.

getOutput

public double getOutput(int index)
Returns the desired component of the output.

Parameters:
index - the index of the desired output.
Returns:
the value of the indexed output.

getOutputDimension

public int getOutputDimension()
Returns the output dimension.

Returns:
the output dimension.

getOutputVec

public cern.colt.matrix.DoubleMatrix1D getOutputVec()
Returns the output as a DoubleMatrix1D.

Returns:
the output as a DoubleMatrix1D.

setInput

public void setInput(double[] input)
Sets the input. Values are copied. Since

Parameters:
input - the given input.

setInput

public void setInput(cern.colt.matrix.DoubleMatrix1D input)
Sets the input. Values are copied. The user can change the input dimensionality using this method.

Parameters:
input - the given input.

setInput

public void setInput(int index,
                     double val)
Sets the specified component of the input to the given value.

Parameters:
index - the index of the component to set.
val - the value to set.

setInputDimension

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

Specified by:
setInputDimension in interface VariableInputDimension
Parameters:
inputDimension - the given input dimension.

setOutput

public void setOutput(double[] output)
Sets the output. Values are copied.

Parameters:
output - the given output.

setOutput

public void setOutput(cern.colt.matrix.DoubleMatrix1D output)
Sets the output. The user can change the output dimensionality using this method.

Parameters:
output - the given output.

setOutput

public void setOutput(int index,
                      double val)
Sets the specified component of the output to the given value.

Parameters:
index - index of the output to set.
val - the value of the output to set.

setOutputDimension

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

Specified by:
setOutputDimension in interface VariableOutputDimension
Parameters:
outputDimension - the given output dimension.

toString

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

writeToFile

public void writeToFile(java.io.PrintWriter writer)
Writes a human-readable form of this DataPoint using the given PrintWriter. Note: this is not designed to be used for serialization.

Parameters:
writer - the given PrintWriter.