Class InstancesGroupedRandomSplitGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.indexedsplitsrunsgenerator.AbstractIndexedSplitsRunsGenerator
-
- adams.flow.transformer.indexedsplitsrunsgenerator.AbstractInstancesIndexedSplitsRunsGenerator
-
- adams.flow.transformer.indexedsplitsrunsgenerator.InstancesGroupedRandomSplitGenerator
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,Randomizable,SizeOfHandler,FlowContextHandler,IndexedSplitsRunsGenerator,InstancesIndexedSplitsRunsGenerator,Serializable
public class InstancesGroupedRandomSplitGenerator extends AbstractInstancesIndexedSplitsRunsGenerator implements Randomizable
Random split generator that works on Instances objects (groups instances).- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringm_Groupthe group expression.protected WekaAttributeIndexm_Indexthe index to use for grouping.protected doublem_Percentagethe percentage.protected booleanm_PreserveOrderwhether to preserve the order.protected BaseRegExpm_RegExpthe regular expression for the nominal/string attribute.protected longm_Seedthe seed value.-
Fields inherited from class adams.flow.transformer.indexedsplitsrunsgenerator.AbstractInstancesIndexedSplitsRunsGenerator
m_AddAttributeInformation, m_AddDatasetInformation
-
Fields inherited from class adams.flow.transformer.indexedsplitsrunsgenerator.AbstractIndexedSplitsRunsGenerator
m_FlowContext, m_MetaData
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.transformer.indexedsplitsrunsgenerator.InstancesIndexedSplitsRunsGenerator
DATASET_NAME, DATASET_NUMATTRIBUTES, DATASET_NUMINSTANCES, PREFIX_DATASET_ATTRIBUTE, SUFFIX_NAME, SUFFIX_TYPE
-
-
Constructor Summary
Constructors Constructor Description InstancesGroupedRandomSplitGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected IndexedSplitsRunsdoGenerate(Object data, MessageCollection errors)Generates the indexed splits.StringgetGroup()Returns the replacement string to use as group (eg '$2').WekaAttributeIndexgetIndex()Returns the attribute index to use for grouping.doublegetPercentage()Returns the split percentage.booleangetPreserveOrder()Returns whether to preserve the order.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.BaseRegExpgetRegExp()Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').longgetSeed()Returns the seed value.StringglobalInfo()Returns a string describing the object.StringgroupTipText()Returns the tip text for this property.StringindexTipText()Returns the tip text for this property.StringpercentageTipText()Returns the tip text for this property.StringpreserveOrderTipText()Returns the tip text for this property.StringregExpTipText()Returns the tip text for this property.StringseedTipText()Returns the tip text for this property.voidsetGroup(String value)Sets the replacement string to use as group (eg '$2').voidsetIndex(WekaAttributeIndex value)Sets the attribute index to use for grouping.voidsetPercentage(double value)Sets the split percentage.voidsetPreserveOrder(boolean value)Sets whether to preserve the order.voidsetRegExp(BaseRegExp value)Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').voidsetSeed(long value)Sets the seed value.-
Methods inherited from class adams.flow.transformer.indexedsplitsrunsgenerator.AbstractInstancesIndexedSplitsRunsGenerator
accepts, addAttributeInformationTipText, addDatasetInformationTipText, getAddAttributeInformation, getAddDatasetInformation, postGenerate, setAddAttributeInformation, setAddDatasetInformation
-
Methods inherited from class adams.flow.transformer.indexedsplitsrunsgenerator.AbstractIndexedSplitsRunsGenerator
check, generate, getFlowContext, getMetaData, metaDataTipText, setFlowContext, setMetaData
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.flow.core.FlowContextHandler
getFlowContext, setFlowContext
-
Methods inherited from interface adams.flow.transformer.indexedsplitsrunsgenerator.IndexedSplitsRunsGenerator
generate
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Percentage
protected double m_Percentage
the percentage.
-
m_Seed
protected long m_Seed
the seed value.
-
m_PreserveOrder
protected boolean m_PreserveOrder
whether to preserve the order.
-
m_Index
protected WekaAttributeIndex m_Index
the index to use for grouping.
-
m_RegExp
protected BaseRegExp m_RegExp
the regular expression for the nominal/string attribute.
-
m_Group
protected String m_Group
the group expression.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractInstancesIndexedSplitsRunsGenerator
-
setPercentage
public void setPercentage(double value)
Sets the split percentage.- Parameters:
value- the percentage (0-1)
-
getPercentage
public double getPercentage()
Returns the split percentage.- Returns:
- the percentage (0-1)
-
percentageTipText
public String percentageTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSeed
public void setSeed(long value)
Sets the seed value.- Specified by:
setSeedin interfaceRandomizable- Parameters:
value- the seed
-
getSeed
public long getSeed()
Returns the seed value.- Specified by:
getSeedin interfaceRandomizable- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Specified by:
seedTipTextin interfaceRandomizable- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPreserveOrder
public void setPreserveOrder(boolean value)
Sets whether to preserve the order.- Parameters:
value- true if to preserve order
-
getPreserveOrder
public boolean getPreserveOrder()
Returns whether to preserve the order.- Returns:
- true if to preserve order
-
preserveOrderTipText
public String preserveOrderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setIndex
public void setIndex(WekaAttributeIndex value)
Sets the attribute index to use for grouping.- Parameters:
value- the index
-
getIndex
public WekaAttributeIndex getIndex()
Returns the attribute index to use for grouping.- Returns:
- the index
-
indexTipText
public String indexTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRegExp
public void setRegExp(BaseRegExp value)
Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').- Parameters:
value- the expression
-
getRegExp
public BaseRegExp getRegExp()
Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').- Returns:
- the expression
-
regExpTipText
public String regExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setGroup
public void setGroup(String value)
Sets the replacement string to use as group (eg '$2').- Parameters:
value- the group
-
getGroup
public String getGroup()
Returns the replacement string to use as group (eg '$2').- Returns:
- the group
-
groupTipText
public String groupTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractInstancesIndexedSplitsRunsGenerator- Returns:
- null if no info available, otherwise short string
-
doGenerate
protected IndexedSplitsRuns doGenerate(Object data, MessageCollection errors)
Generates the indexed splits.- Specified by:
doGeneratein classAbstractIndexedSplitsRunsGenerator- Parameters:
data- the data to use for generating the splitserrors- for storing any errors occurring during processing- Returns:
- the splits or null in case of error
-
-