Class GroupedTrainTestSplit
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.preparefilebaseddataset.AbstractFileBasedDatasetPreparation<T>
-
- adams.flow.transformer.preparefilebaseddataset.AbstractRandomizableFileBasedDatasetPreparation<String[]>
-
- adams.flow.transformer.preparefilebaseddataset.TrainTestSplit
-
- adams.flow.transformer.preparefilebaseddataset.GroupedTrainTestSplit
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,Randomizable,SizeOfHandler,Serializable
public class GroupedTrainTestSplit extends TrainTestSplit
Generates a train/test split using the specified grouping.- 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 BaseRegExpm_RegExpthe regular expression for the nominal/string attribute.protected booleanm_RemoveExtensionwhether to remove the extension.protected booleanm_UseOnlyNamewhether to only use the name, not the path inthe grouping.-
Fields inherited from class adams.flow.transformer.preparefilebaseddataset.TrainTestSplit
m_Percentage, m_PreserveOrder
-
Fields inherited from class adams.flow.transformer.preparefilebaseddataset.AbstractRandomizableFileBasedDatasetPreparation
m_Seed
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description GroupedTrainTestSplit()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Classaccepts()Returns the class that the preparation scheme accepts as input.protected Stringcheck(String[] data)Hook method for checking the data.voiddefineOptions()Adds options to the internal list of options.protected List<FileBasedDatasetContainer>doPrepare(String[] data)Prepares the data.StringgetGroup()Returns the replacement string to use as group (eg '$2').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]+)-(.*)$').booleangetRemoveExtension()Returns whether to remove the extension from the filename before applying the regular expression.booleangetUseOnlyName()Returns whether to use only the file name, not the path, in the grouping..StringglobalInfo()Returns a string describing the object.StringgroupTipText()Returns the tip text for this property.StringregExpTipText()Returns the tip text for this property.StringremoveExtensionTipText()Returns the tip text for this property.voidsetGroup(String value)Sets the replacement string to use as group (eg '$2').voidsetRegExp(BaseRegExp value)Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').voidsetRemoveExtension(boolean value)Sets whether to remove the extension from the filename before applying the regular expression.voidsetUseOnlyName(boolean value)Sets whether to use only the file name, not the path, in the grouping.StringuseOnlyNameTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.preparefilebaseddataset.TrainTestSplit
getPercentage, getPreserveOrder, percentageTipText, preserveOrderTipText, setPercentage, setPreserveOrder
-
Methods inherited from class adams.flow.transformer.preparefilebaseddataset.AbstractRandomizableFileBasedDatasetPreparation
getSeed, seedTipText, setSeed
-
Methods inherited from class adams.flow.transformer.preparefilebaseddataset.AbstractFileBasedDatasetPreparation
prepare
-
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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_RegExp
protected BaseRegExp m_RegExp
the regular expression for the nominal/string attribute.
-
m_Group
protected String m_Group
the group expression.
-
m_UseOnlyName
protected boolean m_UseOnlyName
whether to only use the name, not the path inthe grouping.
-
m_RemoveExtension
protected boolean m_RemoveExtension
whether to remove the extension.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Overrides:
globalInfoin classTrainTestSplit- 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 classTrainTestSplit
-
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.
-
setUseOnlyName
public void setUseOnlyName(boolean value)
Sets whether to use only the file name, not the path, in the grouping.- Parameters:
value- true if to use only the name
-
getUseOnlyName
public boolean getUseOnlyName()
Returns whether to use only the file name, not the path, in the grouping..- Returns:
- true if to use only the name
-
useOnlyNameTipText
public String useOnlyNameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRemoveExtension
public void setRemoveExtension(boolean value)
Sets whether to remove the extension from the filename before applying the regular expression.- Parameters:
value- true if to remove the extension
-
getRemoveExtension
public boolean getRemoveExtension()
Returns whether to remove the extension from the filename before applying the regular expression.- Returns:
- true if to remove the extension
-
removeExtensionTipText
public String removeExtensionTipText()
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 classTrainTestSplit- Returns:
- null if no info available, otherwise short string
-
accepts
public Class accepts()
Returns the class that the preparation scheme accepts as input.- Overrides:
acceptsin classTrainTestSplit- Returns:
- the class
-
check
protected String check(String[] data)
Hook method for checking the data.- Overrides:
checkin classTrainTestSplit- Parameters:
data- the data to check- Returns:
- null if succesful, otherwise error message
-
doPrepare
protected List<FileBasedDatasetContainer> doPrepare(String[] data)
Prepares the data.- Overrides:
doPreparein classTrainTestSplit- Parameters:
data- the data to use- Returns:
- the generated container
-
-