Package weka.datagenerators.clusterers
Class SubspaceCluster
- java.lang.Object
-
- weka.datagenerators.DataGenerator
-
- weka.datagenerators.ClusterGenerator
-
- weka.datagenerators.clusterers.SubspaceCluster
-
- All Implemented Interfaces:
Serializable,OptionHandler,Randomizable,RevisionHandler
public class SubspaceCluster extends ClusterGenerator
A data generator that produces data points in hyperrectangular subspace clusters. Valid options are:-h Prints this help.
-o <file> The name of the output file, otherwise the generated data is printed to stdout.
-r <name> The name of the relation.
-d Whether to print debug informations.
-S The seed for random function (default 1)
-a <num> The number of attributes (default 1).
-c Class Flag, if set, the cluster is listed in extra attribute.
-b <range> The indices for boolean attributes.
-m <range> The indices for nominal attributes.
-C <cluster-definition> A cluster definition of class 'SubspaceClusterDefinition' (definition needs to be quoted to be recognized as a single argument).
Options specific to weka.datagenerators.clusterers.SubspaceClusterDefinition:
-A <range> Uses a random uniform distribution for the instances in the cluster.
-U <range> Generates totally uniformly distributed instances in the cluster.
-G <range> Uses a Gaussian distribution for the instances in the cluster.
-D <num>,<num> The attribute min/max (-A and -U) or mean/stddev (-G) for the cluster.
-N <num>..<num> The range of number of instances per cluster (default 1..50).
-I Uses integer instead of continuous values (default continuous).
- Version:
- $Revision$
- Author:
- Gabi Schmidberger (gabi@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intCONTINUOUScluster subtype: continuousstatic intGAUSSIANcluster type: gaussianstatic intINTEGERcluster subtype: integerstatic Tag[]TAGS_CLUSTERSUBTYPEthe tags for the cluster typesstatic Tag[]TAGS_CLUSTERTYPEthe tags for the cluster typesstatic intTOTAL_UNIFORMcluster type: total uniformstatic intUNIFORM_RANDOMcluster type: uniform/random
-
Constructor Summary
Constructors Constructor Description SubspaceCluster()initializes the generator, sets the number of clusters to 0, since user has to specify them explicitly
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbooleanColsTipText()Returns the tip text for this propertyStringclusterDefinitionsTipText()Returns the tip text for this propertyInstancesdefineDataFormat()Initializes the format for the dataset produced.InstancegenerateExample()Generate an example of the dataset.InstancesgenerateExamples()Generate all examples of the dataset.StringgenerateFinished()Compiles documentation about the data generation after the generation processStringgenerateStart()Compiles documentation about the data generation before the generation processRangegetBooleanCols()returns the range of boolean attributes.ClusterDefinition[]getClusterDefinitions()returns the currently set clustersRangegetNominalCols()returns the range of nominal attributesint[]getNumValues()returns array that stores the number of values for a nominal attribute.String[]getOptions()Gets the current settings of the datagenerator.StringgetRevision()Returns the revision string.booleangetSingleModeFlag()Gets the single mode flag.StringglobalInfo()Returns a string describing this data generator.booleanisBoolean(int index)Returns true if attribute is booleanbooleanisNominal(int index)Returns true if attribute is nominalEnumeration<Option>listOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method for testing this class.StringnominalColsTipText()Returns the tip text for this propertyvoidsetBooleanCols(Range value)Sets which attributes are boolean.voidsetBooleanIndices(String rangeList)Sets which attributes are booleanvoidsetClusterDefinitions(ClusterDefinition[] value)sets the clusters to usevoidsetNominalCols(Range value)Sets which attributes are nominal.voidsetNominalIndices(String rangeList)Sets which attributes are nominalvoidsetOptions(String[] options)Parses a list of options for this object.-
Methods inherited from class weka.datagenerators.ClusterGenerator
classFlagTipText, getClassFlag, getNumAttributes, numAttributesTipText, setClassFlag, setNumAttributes
-
Methods inherited from class weka.datagenerators.DataGenerator
debugTipText, defaultOutput, enumToVector, formatTipText, getDatasetFormat, getDebug, getEpilogue, getNumExamplesAct, getOutput, getPrologue, getRandom, getRelationName, getSeed, makeData, outputTipText, randomTipText, relationNameTipText, runDataGenerator, seedTipText, setDatasetFormat, setDebug, setOutput, setRandom, setRelationName, setSeed
-
-
-
-
Field Detail
-
UNIFORM_RANDOM
public static final int UNIFORM_RANDOM
cluster type: uniform/random- See Also:
- Constant Field Values
-
TOTAL_UNIFORM
public static final int TOTAL_UNIFORM
cluster type: total uniform- See Also:
- Constant Field Values
-
GAUSSIAN
public static final int GAUSSIAN
cluster type: gaussian- See Also:
- Constant Field Values
-
TAGS_CLUSTERTYPE
public static final Tag[] TAGS_CLUSTERTYPE
the tags for the cluster types
-
CONTINUOUS
public static final int CONTINUOUS
cluster subtype: continuous- See Also:
- Constant Field Values
-
INTEGER
public static final int INTEGER
cluster subtype: integer- See Also:
- Constant Field Values
-
TAGS_CLUSTERSUBTYPE
public static final Tag[] TAGS_CLUSTERSUBTYPE
the tags for the cluster types
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this data generator.- Returns:
- a description of the data generator suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration<Option> listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClusterGenerator- Returns:
- an enumeration of all the available options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a list of options for this object. Valid options are:-h Prints this help.
-o <file> The name of the output file, otherwise the generated data is printed to stdout.
-r <name> The name of the relation.
-d Whether to print debug informations.
-S The seed for random function (default 1)
-a <num> The number of attributes (default 1).
-c Class Flag, if set, the cluster is listed in extra attribute.
-b <range> The indices for boolean attributes.
-m <range> The indices for nominal attributes.
-C <cluster-definition> A cluster definition of class 'SubspaceClusterDefinition' (definition needs to be quoted to be recognized as a single argument).
Options specific to weka.datagenerators.clusterers.SubspaceClusterDefinition:
-A <range> Uses a random uniform distribution for the instances in the cluster.
-U <range> Generates totally uniformly distributed instances in the cluster.
-G <range> Uses a Gaussian distribution for the instances in the cluster.
-D <num>,<num> The attribute min/max (-A and -U) or mean/stddev (-G) for the cluster.
-N <num>..<num> The range of number of instances per cluster (default 1..50).
-I Uses integer instead of continuous values (default continuous).
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClusterGenerator- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
setBooleanIndices
public void setBooleanIndices(String rangeList)
Sets which attributes are boolean- Parameters:
rangeList- a string representing the list of attributes. Since the string will typically come from a user, attributes are indexed from 1.
eg: first-3,5,6-last- Throws:
IllegalArgumentException- if an invalid range list is supplied
-
setBooleanCols
public void setBooleanCols(Range value)
Sets which attributes are boolean.- Parameters:
value- the range to use
-
getBooleanCols
public Range getBooleanCols()
returns the range of boolean attributes.- Returns:
- the range of boolean attributes
-
booleanColsTipText
public String booleanColsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNominalIndices
public void setNominalIndices(String rangeList)
Sets which attributes are nominal- Parameters:
rangeList- a string representing the list of attributes. Since the string will typically come from a user, attributes are indexed from 1.
eg: first-3,5,6-last- Throws:
IllegalArgumentException- if an invalid range list is supplied
-
setNominalCols
public void setNominalCols(Range value)
Sets which attributes are nominal.- Parameters:
value- the range to use
-
getNominalCols
public Range getNominalCols()
returns the range of nominal attributes- Returns:
- the range of nominal attributes
-
nominalColsTipText
public String nominalColsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getOptions
public String[] getOptions()
Gets the current settings of the datagenerator.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClusterGenerator- Returns:
- an array of strings suitable for passing to setOptions
- See Also:
DataGenerator.removeBlacklist(String[])
-
getClusterDefinitions
public ClusterDefinition[] getClusterDefinitions()
returns the currently set clusters- Returns:
- the currently set clusters
-
setClusterDefinitions
public void setClusterDefinitions(ClusterDefinition[] value) throws Exception
sets the clusters to use- Parameters:
value- the clusters do use- Throws:
Exception- if clusters are not the correct class
-
clusterDefinitionsTipText
public String clusterDefinitionsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getSingleModeFlag
public boolean getSingleModeFlag()
Gets the single mode flag.- Specified by:
getSingleModeFlagin classDataGenerator- Returns:
- true if methode generateExample can be used.
-
defineDataFormat
public Instances defineDataFormat() throws Exception
Initializes the format for the dataset produced.- Overrides:
defineDataFormatin classDataGenerator- Returns:
- the output data format
- Throws:
Exception- data format could not be defined- See Also:
DataGenerator.defaultRelationName()
-
isBoolean
public boolean isBoolean(int index)
Returns true if attribute is boolean- Parameters:
index- of the attribute- Returns:
- true if the attribute is boolean
-
isNominal
public boolean isNominal(int index)
Returns true if attribute is nominal- Parameters:
index- of the attribute- Returns:
- true if the attribute is nominal
-
getNumValues
public int[] getNumValues()
returns array that stores the number of values for a nominal attribute.- Returns:
- the array that stores the number of values for a nominal attribute
-
generateExample
public Instance generateExample() throws Exception
Generate an example of the dataset.- Specified by:
generateExamplein classDataGenerator- Returns:
- the instance generated
- Throws:
Exception- if format not defined or generating
examples one by one is not possible, because voting is chosen
-
generateExamples
public Instances generateExamples() throws Exception
Generate all examples of the dataset.- Specified by:
generateExamplesin classDataGenerator- Returns:
- the instance generated
- Throws:
Exception- if format not defined
-
generateFinished
public String generateFinished() throws Exception
Compiles documentation about the data generation after the generation process- Specified by:
generateFinishedin classDataGenerator- Returns:
- string with additional information about generated dataset
- Throws:
Exception- no input structure has been defined
-
generateStart
public String generateStart()
Compiles documentation about the data generation before the generation process- Specified by:
generateStartin classDataGenerator- Returns:
- string with additional information
-
getRevision
public String getRevision()
Returns the revision string.- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args- should contain arguments for the data producer:
-
-