Class InstancesGroupedCrossValidationFoldGenerator
- 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.InstancesGroupedCrossValidationFoldGenerator
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,OptionalRandomizable
,QuickInfoSupporter
,Randomizable
,SizeOfHandler
,FlowContextHandler
,IndexedSplitsRunsGenerator
,InstancesIndexedSplitsRunsGenerator
,Serializable
public class InstancesGroupedCrossValidationFoldGenerator extends AbstractInstancesIndexedSplitsRunsGenerator implements OptionalRandomizable
Split generator that generates folds for cross-validation for Instances objects.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Group
the group expression.protected WekaAttributeIndex
m_Index
the index to use for grouping.protected int
m_NumFolds
the number of folds.protected boolean
m_Randomize
whether to randomize the data.protected BaseRegExp
m_RegExp
the regular expression for the nominal/string attribute.protected long
m_Seed
the seed value.protected boolean
m_Stratify
whether to stratify the data (in case of nominal class).-
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 InstancesGroupedCrossValidationFoldGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
check(Object data)
Checks whether the data can be processed.void
defineOptions()
Adds options to the internal list of options.protected IndexedSplitsRuns
doGenerate(Object data, MessageCollection errors)
Generates the indexed splits.String
getGroup()
Returns the replacement string to use as group (eg '$2').WekaAttributeIndex
getIndex()
Returns the attribute index to use for grouping.int
getNumFolds()
Returns the number of folds.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.boolean
getRandomize()
Returns whether to randomize the data.BaseRegExp
getRegExp()
Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').long
getSeed()
Returns the seed value.boolean
getStratify()
Returns whether to stratify the data (in case of nominal class).String
globalInfo()
Returns a string describing the object.String
groupTipText()
Returns the tip text for this property.String
indexTipText()
Returns the tip text for this property.String
numFoldsTipText()
Returns the tip text for this property.String
randomizeTipText()
Returns the tip text for this property.String
regExpTipText()
Returns the tip text for this property.String
seedTipText()
Returns the tip text for this property.void
setGroup(String value)
Sets the replacement string to use as group (eg '$2').void
setIndex(WekaAttributeIndex value)
Sets the attribute index to use for grouping.void
setNumFolds(int value)
Sets the number of folds to use.void
setRandomize(boolean value)
Sets whether to randomize the data.void
setRegExp(BaseRegExp value)
Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').void
setSeed(long value)
Sets the seed value.void
setStratify(boolean value)
Sets whether to stratify the data (nominal class).String
stratifyTipText()
Returns the tip text for this property.-
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
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_NumFolds
protected int m_NumFolds
the number of folds.
-
m_Randomize
protected boolean m_Randomize
whether to randomize the data.
-
m_Seed
protected long m_Seed
the seed value.
-
m_Stratify
protected boolean m_Stratify
whether to stratify the data (in case of nominal class).
-
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:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractInstancesIndexedSplitsRunsGenerator
-
setNumFolds
public void setNumFolds(int value)
Sets the number of folds to use.- Parameters:
value
- the number of folds, less than 2 for LOO
-
getNumFolds
public int getNumFolds()
Returns the number of folds.- Returns:
- the number of folds
-
numFoldsTipText
public String numFoldsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRandomize
public void setRandomize(boolean value)
Sets whether to randomize the data.- Specified by:
setRandomize
in interfaceOptionalRandomizable
- Parameters:
value
- true if to randomize the data
-
getRandomize
public boolean getRandomize()
Returns whether to randomize the data.- Specified by:
getRandomize
in interfaceOptionalRandomizable
- Returns:
- true if to randomize the data
-
randomizeTipText
public String randomizeTipText()
Returns the tip text for this property.- Specified by:
randomizeTipText
in interfaceOptionalRandomizable
- 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:
setSeed
in interfaceRandomizable
- Parameters:
value
- the seed
-
getSeed
public long getSeed()
Returns the seed value.- Specified by:
getSeed
in interfaceRandomizable
- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Specified by:
seedTipText
in interfaceRandomizable
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStratify
public void setStratify(boolean value)
Sets whether to stratify the data (nominal class).- Parameters:
value
- whether to stratify the data (nominal class)
-
getStratify
public boolean getStratify()
Returns whether to stratify the data (in case of nominal class).- Returns:
- true if to stratify
-
stratifyTipText
public String stratifyTipText()
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:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractInstancesIndexedSplitsRunsGenerator
- Returns:
- null if no info available, otherwise short string
-
check
protected String check(Object data)
Checks whether the data can be processed.- Overrides:
check
in classAbstractIndexedSplitsRunsGenerator
- Parameters:
data
- the data to check- Returns:
- null if checks passed, otherwise error message
-
doGenerate
protected IndexedSplitsRuns doGenerate(Object data, MessageCollection errors)
Generates the indexed splits.- Specified by:
doGenerate
in 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
-
-