|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcosc575.p1.DataSet
public class DataSet
Implements a class for storing examples for machine-learning methods.
Field Summary | |
---|---|
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 Summary | |
---|---|
DataSet()
Default constructor. |
|
DataSet(Attributes attributes)
Explicit constructor. |
|
DataSet(Attributes attributes,
java.lang.String filename)
Explicit constructor. |
|
DataSet(java.lang.String filename)
Explicit constructor. |
Method Summary | |
---|---|
void |
add(DataSet dataset)
Adds the examples of the data set to this data set. |
void |
add(Example example)
Adds an example to this data set. |
Attributes |
getAttributes()
Gets the attributes of this DataSet object. |
Examples |
getExamples()
Gets the examples of this data set. |
boolean |
getHasDiscreteAttributes()
Returns true if this data set has discrete attributes; returns false otherwise. |
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 examples 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[] args)
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected Attributes attributes
protected Examples examples
protected long seed
protected java.util.Random random
Constructor Detail |
---|
public DataSet()
public DataSet(java.lang.String filename) throws java.lang.Exception
filename
- the name of the file containing this data's information
java.lang.Exception
- if an exception occurspublic DataSet(Attributes attributes) throws java.lang.Exception
attributes
- the attributes for this data set
java.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 examples
java.lang.Exception
- if an exception occursMethod Detail |
---|
public void setOptions(java.lang.String[] args) throws java.lang.Exception
setOptions
in interface OptionHandler
args
- the arguments
java.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 getHasDiscreteAttributes()
public boolean getHasNominalAttributes()
public void load(java.lang.String filename) throws java.lang.Exception
filename
- the file from which to read
java.lang.Exception
- if an exception occurspublic void add(Example example) throws java.lang.Exception
example
- the example to be added
java.lang.Exception
- if an exception occurspublic void add(DataSet dataset) throws java.lang.Exception
dataset
- the data set to be added
java.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 tokens
java.lang.Exception
- if an exception occurspublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |