statistics
Class DataSet

java.lang.Object
  extended by statistics.DataSet

public class DataSet
extends java.lang.Object


Field Summary
 java.util.ArrayList<Sample> samples
           
 java.util.HashMap<java.lang.Integer,java.util.ArrayList<Sample>> samplesByClass
           
 
Constructor Summary
DataSet(java.lang.String name)
           
 
Method Summary
 void addRandomSamples(DensityDiagonal d, int c, int n)
          Randomly add Gaussian distributed samples to the data set according to the mean and covariance given by the density
 void addSample(Sample s)
           
 void fromAsciiFile(java.lang.String fileName, int labelPos)
          Load a data set from an ASCII file.
 java.lang.String getDataSetName()
           
 int getMaximumId()
          Determine the highest registered class ID
 int getNumberOfClasses()
           
 int getNumberOfSamples()
           
 java.lang.String idToName(int id)
          Resolve a class ID to its original class string
 int nameToId(java.lang.String id)
          Resolve a class string to its internal class ID.
 void setDataSetName(java.lang.String name)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

samples

public java.util.ArrayList<Sample> samples

samplesByClass

public java.util.HashMap<java.lang.Integer,java.util.ArrayList<Sample>> samplesByClass
Constructor Detail

DataSet

public DataSet(java.lang.String name)
Method Detail

addRandomSamples

public void addRandomSamples(DensityDiagonal d,
                             int c,
                             int n)
Randomly add Gaussian distributed samples to the data set according to the mean and covariance given by the density

Parameters:
d - Location to generate samples
c - class ID for the generated samples
n - number of samples to generate

addSample

public void addSample(Sample s)

fromAsciiFile

public void fromAsciiFile(java.lang.String fileName,
                          int labelPos)
                   throws DataSetException
Load a data set from an ASCII file. The expected format is one sample per line, features separated by (arbitrary) whitespace. The position of the label starts at 0.

Parameters:
fileName - path to data file, use "-" to read from STDIN
labelPos - column of the label string, starting with 1
Throws:
DataSetException

getDataSetName

public java.lang.String getDataSetName()

getMaximumId

public int getMaximumId()
Determine the highest registered class ID

Returns:
class ID

getNumberOfClasses

public int getNumberOfClasses()

getNumberOfSamples

public int getNumberOfSamples()

idToName

public java.lang.String idToName(int id)
                          throws DataSetException
Resolve a class ID to its original class string

Parameters:
id -
Returns:
original class name
Throws:
DataSetException

nameToId

public int nameToId(java.lang.String id)
Resolve a class string to its internal class ID. If this is the first request for this class name, a new ID is generated.

Parameters:
id -
Returns:
unique numeric class ID

setDataSetName

public void setDataSetName(java.lang.String name)

toString

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