Package weka.classifiers
Class AbstractSplitGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- weka.classifiers.AbstractSplitGenerator
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,Randomizable,SizeOfHandler,SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>,InstancesViewSupporter,Serializable,Iterator<WekaTrainTestSetContainer>,SplitGenerator
- Direct Known Subclasses:
BestBinnedNumericClassRandomSplitGenerator,BinnedNumericClassCrossValidationFoldGenerator,BinnedNumericClassRandomSplitGenerator,DefaultCrossValidationFoldGenerator,DefaultRandomSplitGenerator,GroupedBinnedNumericClassCrossValidationFoldGenerator,GroupedBinnedNumericClassRandomSplitGenerator,GroupedCrossValidationFoldGenerator,GroupedCrossValidationFoldGeneratorUsingNumericClassValues,GroupedRandomSplitGenerator,LeaveOneOutByValueGenerator,MultiLevelSplitGenerator
public abstract class AbstractSplitGenerator extends AbstractOptionHandler implements SplitGenerator
Ancestor for helper classes that generates dataset splits.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.core.Instancesm_Datathe original dataset.protected booleanm_Initializedwhether the iterator has been initialized.protected gnu.trove.list.TIntListm_OriginalIndicesthe original indices.protected int[][]m_OriginalIndicesPerFoldthe original indices per fold.protected longm_Seedthe seed value.protected booleanm_UseViewswhether to use views.-
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 Modifier Constructor Description protectedAbstractSplitGenerator()Initializes the generator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleancanRandomize()Returns whether randomization is enabled.protected abstract booleancheckNext()Returns true if the iteration has more elements.protected abstract WekaTrainTestSetContainercreateNext()Creates the next result.voiddefineOptions()Adds options to the internal list of options.protected abstract voiddoInitializeIterator()Initializes the iterator, randomizes the data if required.weka.core.InstancesgetData()Returns the original data.longgetSeed()Returns the seed value.booleangetUseViews()Returns whether to use views.booleanhasNext()Returns true if the iteration has more elements.protected voidinitialize()Initializes the members.voidinitializeIterator()Initializes the iterator, randomizes the data if required.WekaTrainTestSetContainernext()Returns the next element in the iteration.protected voidrandomize(gnu.trove.list.TIntList indices, Random random)Randomizes the indices using the given random number generator.voidremove()Unsupported.protected voidreset()Resets the generator.StringseedTipText()Returns the tip text for this property.voidsetData(weka.core.Instances value)Sets the original data.voidsetSeed(long value)Sets the seed value.voidsetUseViews(boolean value)Sets whether to uses views only.StringtoString()Returns a short description of the generator.StringuseViewsTipText()Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine
-
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 java.util.Iterator
forEachRemaining
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Seed
protected long m_Seed
the seed value.
-
m_UseViews
protected boolean m_UseViews
whether to use views.
-
m_Data
protected weka.core.Instances m_Data
the original dataset.
-
m_Initialized
protected boolean m_Initialized
whether the iterator has been initialized.
-
m_OriginalIndices
protected gnu.trove.list.TIntList m_OriginalIndices
the original indices.
-
m_OriginalIndicesPerFold
protected int[][] m_OriginalIndicesPerFold
the original indices per fold.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
reset
protected void reset()
Resets the generator.- Overrides:
resetin classAbstractOptionHandler
-
setData
public void setData(weka.core.Instances value)
Sets the original data.- Specified by:
setDatain interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
setDatain interfaceSplitGenerator- Parameters:
value- the data
-
getData
public weka.core.Instances getData()
Returns the original data.- Specified by:
getDatain interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
getDatain interfaceSplitGenerator- Returns:
- the data
-
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.
-
setUseViews
public void setUseViews(boolean value)
Sets whether to uses views only.- Specified by:
setUseViewsin interfaceInstancesViewSupporter- Parameters:
value- true if to uses views
-
getUseViews
public boolean getUseViews()
Returns whether to use views.- Specified by:
getUseViewsin interfaceInstancesViewSupporter- Returns:
- true if to uses views
-
useViewsTipText
public String useViewsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
canRandomize
protected abstract boolean canRandomize()
Returns whether randomization is enabled.- Returns:
- true if to randomize
-
checkNext
protected abstract boolean checkNext()
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)- Returns:
- true if the iterator has more elements.
-
hasNext
public boolean hasNext()
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)- Specified by:
hasNextin interfaceIterator<WekaTrainTestSetContainer>- Specified by:
hasNextin interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
hasNextin interfaceSplitGenerator- Returns:
- true if the iterator has more elements.
-
randomize
protected void randomize(gnu.trove.list.TIntList indices, Random random)Randomizes the indices using the given random number generator.- Parameters:
indices- the indices to randomize inplacerandom- the random number generator to use
-
doInitializeIterator
protected abstract void doInitializeIterator()
Initializes the iterator, randomizes the data if required.- See Also:
canRandomize()
-
initializeIterator
public void initializeIterator()
Initializes the iterator, randomizes the data if required.- Specified by:
initializeIteratorin interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
initializeIteratorin interfaceSplitGenerator- See Also:
canRandomize()
-
createNext
protected abstract WekaTrainTestSetContainer createNext()
Creates the next result.- Returns:
- the next result
-
next
public WekaTrainTestSetContainer next()
Returns the next element in the iteration.- Specified by:
nextin interfaceIterator<WekaTrainTestSetContainer>- Specified by:
nextin interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
nextin interfaceSplitGenerator- Returns:
- the next element in the iteration.
- Throws:
NoSuchElementException- iteration has no more elements.
-
remove
public void remove()
Unsupported.- Specified by:
removein interfaceIterator<WekaTrainTestSetContainer>- Specified by:
removein interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
removein interfaceSplitGenerator
-
toString
public String toString()
Returns a short description of the generator.- Specified by:
toStringin interfaceSplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>- Specified by:
toStringin interfaceSplitGenerator- Overrides:
toStringin classAbstractOptionHandler- Returns:
- a short description
-
-