Class CrossValidation
- 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.CrossValidation
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,Randomizable
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
GroupedCrossValidation
public class CrossValidation extends AbstractRandomizableFileBasedDatasetPreparation<String[]>
Generates cross-validation folds.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_ActualNumFolds
the actual number of folds.protected int
m_NumFolds
the number of folds.protected boolean
m_Randomize
whether to randomize the data.-
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 CrossValidation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class
accepts()
Returns the class that the preparation scheme accepts as input.protected String
check(String[] data)
Hook method for checking the data.void
defineOptions()
Adds options to the internal list of options.protected List<FileBasedDatasetContainer>
doPrepare(String[] data)
Prepares the data.int
getActualNumFolds()
Returns the actual number of folds used (eg when using LOO).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.String
globalInfo()
Returns a string describing the object.String
numFoldsTipText()
Returns the tip text for this property.String
randomizeTipText()
Returns the tip text for this property.protected void
reset()
Resets the scheme.void
setNumFolds(int value)
Sets the number of folds to use.void
setRandomize(boolean value)
Sets whether to randomize the data.-
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, 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
-
-
-
-
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 classAbstractRandomizableFileBasedDatasetPreparation<String[]>
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
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.
-
getActualNumFolds
public int getActualNumFolds()
Returns the actual number of folds used (eg when using LOO).- Returns:
- the actual number of folds, -1 if not yet calculated
-
setRandomize
public void setRandomize(boolean value)
Sets whether to randomize the data.- Parameters:
value
- true if to randomize the data
-
getRandomize
public boolean getRandomize()
Returns whether to randomize the data.- Returns:
- true if to randomize the data
-
randomizeTipText
public String randomizeTipText()
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 classAbstractFileBasedDatasetPreparation<String[]>
- Returns:
- null if no info available, otherwise short string
-
accepts
public Class accepts()
Returns the class that the preparation scheme accepts as input.- Specified by:
accepts
in classAbstractFileBasedDatasetPreparation<String[]>
- Returns:
- the class
-
check
protected String check(String[] data)
Hook method for checking the data.- Overrides:
check
in classAbstractFileBasedDatasetPreparation<String[]>
- Parameters:
data
- the data to check- Returns:
- null if succesful, otherwise error message
-
doPrepare
protected List<FileBasedDatasetContainer> doPrepare(String[] data)
Prepares the data.- Specified by:
doPrepare
in classAbstractFileBasedDatasetPreparation<String[]>
- Parameters:
data
- the data to use- Returns:
- the generated container
-
-