public class TestInstances extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, OptionHandler, RevisionHandler
-relation <name> The name of the data set.
-seed <num> The seed value.
-num-instances <num> The number of instances in the datasets (default 20).
-class-type <num> The class type, see constants in weka.core.Attribute (default 1=nominal).
-class-values <num> The number of classes to generate (for nominal classes only) (default 2).
-class-index <num> The class index, with -1=last, (default -1).
-no-class Doesn't include a class attribute in the output.
-nominal <num> The number of nominal attributes (default 1).
-nominal-values <num> The number of values for nominal attributes (default 2).
-numeric <num> The number of numeric attributes (default 0).
-string <num> The number of string attributes (default 0).
-words <comma-separated-list> The words to use in string attributes.
-word-separators <chars> The word separators to use in string attributes.
-date <num> The number of date attributes (default 0).
-relational <num> The number of relational attributes (default 0).
-relational-nominal <num> The number of nominal attributes in a rel. attribute (default 1).
-relational-nominal-values <num> The number of values for nominal attributes in a rel. attribute (default 2).
-relational-numeric <num> The number of numeric attributes in a rel. attribute (default 0).
-relational-string <num> The number of string attributes in a rel. attribute (default 0).
-relational-date <num> The number of date attributes in a rel. attribute (default 0).
-num-instances-relational <num> The number of instances in relational/bag attributes (default 10).
-multi-instance Generates multi-instance data.
-W <classname> The Capabilities handler to base the dataset on. The other parameters can be used to override the ones determined from the handler. Additional parameters for handler can be passed on after the '--'.
CheckClassifier
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
CLASS_IS_LAST
can be used for settting the class attribute index to last
|
static java.lang.String |
DEFAULT_SEPARATORS
the default word separators used in strings
|
static java.lang.String[] |
DEFAULT_WORDS
the default list of words used in strings
|
static int |
NO_CLASS
can be used to avoid generating a class attribute
|
Constructor and Description |
---|
TestInstances()
the default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
assign(TestInstances t)
updates itself with all the settings from the given TestInstances
object
|
java.lang.Object |
clone()
creates a clone of the current object
|
static TestInstances |
forCapabilities(Capabilities c)
returns a TestInstances instance setup already for the the given
capabilities.
|
Instances |
generate()
Generates a new dataset
|
Instances |
generate(java.lang.String namePrefix)
generates a new dataset.
|
int |
getClassIndex()
returns the current class index (0-based), -1 is last attribute
|
int |
getClassType()
returns the current class type
|
Instances |
getData()
returns the current dataset, can be null
|
CapabilitiesHandler |
getHandler()
returns the current set CapabilitiesHandler to generate the dataset
for, can be null
|
boolean |
getMultiInstance()
Gets whether multi-instance data (with a fixed structure) is generated
|
boolean |
getNoClass()
whether no class attribute is generated
|
int |
getNumAttributes()
returns the overall number of attributes (incl.
|
int |
getNumClasses()
returns the current number of classes
|
int |
getNumDate()
returns the current number of date attributes
|
int |
getNumInstances()
returns the current number of instances to produce
|
int |
getNumInstancesRelational()
returns the current number of instances in relational/bag attributes to produce
|
int |
getNumNominal()
returns the current number of nominal attributes
|
int |
getNumNominalValues()
returns the current number of values for nominal attributes
|
int |
getNumNumeric()
returns the current number of numeric attributes
|
int |
getNumRelational()
returns the current number of relational attributes
|
int |
getNumRelationalDate()
returns the current number of date attributes in a relational attribute
|
int |
getNumRelationalNominal()
returns the current number of nominal attributes in a relational attribute
|
int |
getNumRelationalNominalValues()
returns the current number of values for nominal attributes in a relational attribute
|
int |
getNumRelationalNumeric()
returns the current number of numeric attributes in a relational attribute
|
int |
getNumRelationalString()
returns the current number of string attributes in a relational attribute
|
int |
getNumString()
returns the current number of string attributes
|
java.lang.String[] |
getOptions()
Gets the current settings of this object.
|
java.lang.String |
getRelation()
returns the current name of the relation
|
Instances |
getRelationalClassFormat()
returns the current strcuture of the relational class attribute, can
be null
|
Instances |
getRelationalFormat(int index)
returns the format for the specified relational attribute, can be null
|
java.lang.String |
getRevision()
Returns the revision string.
|
int |
getSeed()
returns the current seed value
|
java.lang.String |
getWords()
returns the words used for assembling strings in a comma-separated list.
|
java.lang.String |
getWordSeparators()
returns the word separators (chars) to use for assembling strings.
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
for running the class from commandline, prints the generated data
to stdout
|
void |
setClassIndex(int value)
sets the class index (0-based)
|
void |
setClassType(int value)
sets the class attribute type
|
void |
setHandler(CapabilitiesHandler value)
sets the Capabilities handler to generate the data for
|
void |
setMultiInstance(boolean value)
sets whether multi-instance data should be generated (with a fixed
data structure)
|
void |
setNoClass(boolean value)
whether to have no class, e.g., for clusterers; otherwise the class
attribute index is set to last
|
void |
setNumClasses(int value)
sets the number of classes
|
void |
setNumDate(int value)
sets the number of date attributes
|
void |
setNumInstances(int value)
sets the number of instances to produce
|
void |
setNumInstancesRelational(int value)
sets the number of instances in relational/bag attributes to produce
|
void |
setNumNominal(int value)
sets the number of nominal attributes
|
void |
setNumNominalValues(int value)
sets the number of values for nominal attributes
|
void |
setNumNumeric(int value)
sets the number of numeric attributes
|
void |
setNumRelational(int value)
sets the number of relational attributes
|
void |
setNumRelationalDate(int value)
sets the number of date attributes in a relational attribute
|
void |
setNumRelationalNominal(int value)
sets the number of nominal attributes in a relational attribute
|
void |
setNumRelationalNominalValues(int value)
sets the number of values for nominal attributes in a relational attribute
|
void |
setNumRelationalNumeric(int value)
sets the number of numeric attributes in a relational attribute
|
void |
setNumRelationalString(int value)
sets the number of string attributes in a relational attribute
|
void |
setNumString(int value)
sets the number of string attributes
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setRelation(java.lang.String value)
sets the name of the relation
|
void |
setRelationalClassFormat(Instances value)
sets the structure for the relational class attribute
|
void |
setRelationalFormat(int index,
Instances value)
sets the structure for the bags for the relational attribute
|
void |
setSeed(int value)
sets the seed value for the random number generator
|
void |
setWords(java.lang.String value)
Sets the comma-separated list of words to use for generating strings.
|
void |
setWordSeparators(java.lang.String value)
sets the word separators (chars) to use for assembling strings.
|
java.lang.String |
toString()
returns a string representation of the object
|
public static final int CLASS_IS_LAST
setClassIndex(int)
,
Constant Field Valuespublic static final int NO_CLASS
setClassIndex(int)
,
Constant Field Valuespublic static final java.lang.String[] DEFAULT_WORDS
public static final java.lang.String DEFAULT_SEPARATORS
public java.lang.Object clone()
clone
in class java.lang.Object
public void assign(TestInstances t)
t
- the object to get the settings frompublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-relation <name> The name of the data set.
-seed <num> The seed value.
-num-instances <num> The number of instances in the datasets (default 20).
-class-type <num> The class type, see constants in weka.core.Attribute (default 1=nominal).
-class-values <num> The number of classes to generate (for nominal classes only) (default 2).
-class-index <num> The class index, with -1=last, (default -1).
-no-class Doesn't include a class attribute in the output.
-nominal <num> The number of nominal attributes (default 1).
-nominal-values <num> The number of values for nominal attributes (default 2).
-numeric <num> The number of numeric attributes (default 0).
-string <num> The number of string attributes (default 0).
-words <comma-separated-list> The words to use in string attributes.
-word-separators <chars> The word separators to use in string attributes.
-date <num> The number of date attributes (default 0).
-relational <num> The number of relational attributes (default 0).
-relational-nominal <num> The number of nominal attributes in a rel. attribute (default 1).
-relational-nominal-values <num> The number of values for nominal attributes in a rel. attribute (default 2).
-relational-numeric <num> The number of numeric attributes in a rel. attribute (default 0).
-relational-string <num> The number of string attributes in a rel. attribute (default 0).
-relational-date <num> The number of date attributes in a rel. attribute (default 0).
-num-instances-relational <num> The number of instances in relational/bag attributes (default 10).
-multi-instance Generates multi-instance data.
-W <classname> The Capabilities handler to base the dataset on. The other parameters can be used to override the ones determined from the handler. Additional parameters for handler can be passed on after the '--'.
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setRelation(java.lang.String value)
value
- the name of the relationpublic java.lang.String getRelation()
public void setSeed(int value)
value
- the seedpublic int getSeed()
public void setNumInstances(int value)
value
- the number of instancespublic int getNumInstances()
public void setClassType(int value)
value
- the class attribute typepublic int getClassType()
public void setNumClasses(int value)
value
- the number of classespublic int getNumClasses()
public void setClassIndex(int value)
value
- the class indexCLASS_IS_LAST
,
NO_CLASS
public int getClassIndex()
CLASS_IS_LAST
,
NO_CLASS
public void setNoClass(boolean value)
value
- whether to have no classCLASS_IS_LAST
,
NO_CLASS
public boolean getNoClass()
public void setNumNominal(int value)
value
- the number of nominal attributespublic int getNumNominal()
public void setNumNominalValues(int value)
value
- the number of valuespublic int getNumNominalValues()
public void setNumNumeric(int value)
value
- the number of numeric attributespublic int getNumNumeric()
public void setNumString(int value)
value
- the number of string attributespublic int getNumString()
public void setWords(java.lang.String value)
value
- the list of wordsjava.lang.IllegalArgumentException
- if not at least 2 words are providedpublic java.lang.String getWords()
public void setWordSeparators(java.lang.String value)
value
- the characters to use as separatorspublic java.lang.String getWordSeparators()
public void setNumDate(int value)
value
- the number of date attributespublic int getNumDate()
public void setNumRelational(int value)
value
- the number of relational attributespublic int getNumRelational()
public void setNumRelationalNominal(int value)
value
- the number of nominal attributespublic int getNumRelationalNominal()
public void setNumRelationalNominalValues(int value)
value
- the number of valuespublic int getNumRelationalNominalValues()
public void setNumRelationalNumeric(int value)
value
- the number of numeric attributespublic int getNumRelationalNumeric()
public void setNumRelationalString(int value)
value
- the number of string attributespublic int getNumRelationalString()
public void setNumRelationalDate(int value)
value
- the number of date attributespublic int getNumRelationalDate()
public void setNumInstancesRelational(int value)
value
- the number of instancespublic int getNumInstancesRelational()
public void setMultiInstance(boolean value)
value
- whether multi-instance data is generatedpublic boolean getMultiInstance()
public void setRelationalFormat(int index, Instances value)
index
- the index of the relational attributevalue
- the new structurepublic Instances getRelationalFormat(int index)
index
- the index of the relational attributepublic void setRelationalClassFormat(Instances value)
value
- the structure for the relational attributepublic Instances getRelationalClassFormat()
public int getNumAttributes()
public Instances getData()
public void setHandler(CapabilitiesHandler value)
value
- the handler to generate the data forpublic CapabilitiesHandler getHandler()
public Instances generate() throws java.lang.Exception
java.lang.Exception
- if something goes wrongpublic Instances generate(java.lang.String namePrefix) throws java.lang.Exception
namePrefix
- the prefix to add to the name of an attributejava.lang.Exception
- if something goes wrongpublic static TestInstances forCapabilities(Capabilities c)
c
- the capabilities to base the TestInstances onpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the commandline parametersjava.lang.Exception
- if something goes wrong