org.jscience.computing.kmeans
Class DataSet

java.lang.Object
  extended by org.jscience.computing.kmeans.DataSet
Direct Known Subclasses:
Cluster

public class DataSet
extends java.lang.Object

Represents the dataset of samples. A container for Data objects.


Field Summary
protected  java.util.Vector dataset
          The coordinates in this dataset
 
Constructor Summary
DataSet(java.lang.String filename)
          Constructs a new dataset by reading a description from a file.
DataSet(java.util.Vector collection)
          Constructs a dataset from a vector of samples.
 
Method Summary
 int dimension()
          Access the dimension of the samples in the dataset.
 java.util.Iterator iterator()
          Get an iterator for this dataset.
 int numSamples()
          Access the number of samples in the dataset.
 java.util.Iterator randomIterator()
          Get an iterator for this dataset that iterates in a random order.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataset

protected java.util.Vector dataset
The coordinates in this dataset

Constructor Detail

DataSet

public DataSet(java.util.Vector collection)
Constructs a dataset from a vector of samples.

Parameters:
collection - The collection of samples in this dataset.

DataSet

public DataSet(java.lang.String filename)
        throws java.io.FileNotFoundException,
               java.io.IOException,
               java.lang.Exception
Constructs a new dataset by reading a description from a file.

Parameters:
filename - The filename containing the dataset.
Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.Exception
Method Detail

numSamples

public int numSamples()
Access the number of samples in the dataset.

Returns:
The number of samples in the dataset.

dimension

public int dimension()
Access the dimension of the samples in the dataset.

Returns:
The dimensionality of the samples in the dataset.

iterator

public java.util.Iterator iterator()
Get an iterator for this dataset.

Returns:
An iterator of the Data items in this collection.

randomIterator

public java.util.Iterator randomIterator()
Get an iterator for this dataset that iterates in a random order.

Returns:
A random iterator of the dataset items.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
The string representation of this dataset.