public class DataSet extends java.lang.Object implements OptionHandler
Modifier and Type | Field and Description |
---|---|
protected Attributes |
attributes
the Attributes object for attribute attributes, types, and domains
|
protected Examples |
examples
the examples
|
protected java.lang.String |
name
the name of this data set
|
protected java.util.Random |
random
a random number generator
|
protected long |
seed
default random seed
|
Constructor and Description |
---|
DataSet()
Default constructor.
|
DataSet(Attributes attributes)
Explicit constructor.
|
DataSet(Attributes attributes,
java.lang.String filename)
Explicit constructor.
|
DataSet(java.lang.String filename)
Explicit constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DataSet dataset)
Adds the examples of the specified data set to this data set.
|
void |
add(Example example)
Adds the specified example to this data set.
|
Attributes |
getAttributes()
Gets the attributes of this DataSet object.
|
Examples |
getExamples()
Gets the examples of this data set.
|
boolean |
getHasNominalAttributes()
Returns true if this data set has nominal attributes; returns false
otherwise.
|
boolean |
getHasNumericAttributes()
Returns true if this data set has numeric attributes; returns false
otherwise.
|
long |
getSeed()
Gets the seed for this data set.
|
void |
load(java.lang.String filename)
Loads a data set from the specified file.
|
static void |
main(java.lang.String[] args) |
private void |
parse(java.util.Scanner scanner)
Parses the header for a data set.
|
void |
setOptions(java.lang.String[] options)
Sets the options for this data set.
|
void |
setRandom(java.util.Random random)
Sets the random number generator for this data set.
|
void |
setSeed(long seed)
Sets the random number seed for this data set.
|
java.lang.String |
toString()
Returns a string representation of the data set in a format similar
to that of the file format.
|
protected java.lang.String name
protected Attributes attributes
protected Examples examples
protected long seed
protected java.util.Random random
public DataSet()
public DataSet(java.lang.String filename) throws java.lang.Exception
filename
- the name of the file containing this data's informationjava.lang.Exception
- if an exception occurspublic DataSet(Attributes attributes) throws java.lang.Exception
attributes
- the attributes for this data setjava.lang.Exception
- if an exception occurspublic DataSet(Attributes attributes, java.lang.String filename) throws java.lang.Exception
attributes
- the attributes for this data setfilename
- the name of the file containing this data set's examplesjava.lang.Exception
- if an exception occurspublic void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
options
- the argumentsjava.lang.Exception
- if an exception occurspublic void setRandom(java.util.Random random)
random
- the specified random number generatorpublic void setSeed(long seed)
seed
- the seedpublic long getSeed()
public Attributes getAttributes()
public boolean getHasNumericAttributes()
public boolean getHasNominalAttributes()
public void load(java.lang.String filename) throws java.lang.Exception
filename
- the file from which to readjava.lang.Exception
- if an exception occurspublic void add(Example example) throws java.lang.Exception
example
- the example to be addedjava.lang.Exception
- if an exception occurspublic void add(DataSet dataset) throws java.lang.Exception
dataset
- the data set to be addedjava.lang.Exception
- if an exception occurspublic Examples getExamples()
private void parse(java.util.Scanner scanner) throws java.lang.Exception
scanner
- a scanner containing the data set's tokensjava.lang.Exception
- if an exception occurspublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)