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:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.Randomizable
,adams.core.SizeOfHandler
,adams.data.splitgenerator.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 adams.core.option.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.Instances
m_Data
the original dataset.protected boolean
m_Initialized
whether the iterator has been initialized.protected gnu.trove.list.TIntList
m_OriginalIndices
the original indicies.protected long
m_Seed
the seed value.protected boolean
m_UseViews
whether to use views.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSplitGenerator()
Initializes the generator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
canRandomize()
Returns whether randomization is enabled.protected abstract boolean
checkNext()
Returns true if the iteration has more elements.protected abstract WekaTrainTestSetContainer
createNext()
Creates the next result.void
defineOptions()
Adds options to the internal list of options.protected abstract void
doInitializeIterator()
Initializes the iterator, randomizes the data if required.weka.core.Instances
getData()
Returns the original data.long
getSeed()
Returns the seed value.boolean
getUseViews()
Returns whether to use views.boolean
hasNext()
Returns true if the iteration has more elements.protected void
initialize()
Initializes the members.void
initializeIterator()
Initializes the iterator, randomizes the data if required.WekaTrainTestSetContainer
next()
Returns the next element in the iteration.protected void
randomize(gnu.trove.list.TIntList indices, Random random)
Randomizes the indices using the given random number generator.void
remove()
Unsupported.protected void
reset()
Resets the generator.String
seedTipText()
Returns the tip text for this property.void
setData(weka.core.Instances value)
Sets the original data.void
setSeed(long value)
Sets the seed value.void
setUseViews(boolean value)
Sets whether to uses views only.String
toString()
Returns a short description of the generator.String
useViewsTipText()
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 java.util.Iterator
forEachRemaining
-
-
-
-
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 indicies.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classadams.core.option.AbstractOptionHandler
-
reset
protected void reset()
Resets the generator.- Overrides:
reset
in classadams.core.option.AbstractOptionHandler
-
setData
public void setData(weka.core.Instances value)
Sets the original data.- Specified by:
setData
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
setData
in interfaceSplitGenerator
- Parameters:
value
- the data
-
getData
public weka.core.Instances getData()
Returns the original data.- Specified by:
getData
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
getData
in interfaceSplitGenerator
- Returns:
- the data
-
setSeed
public void setSeed(long value)
Sets the seed value.- Specified by:
setSeed
in interfaceadams.core.Randomizable
- Parameters:
value
- the seed
-
getSeed
public long getSeed()
Returns the seed value.- Specified by:
getSeed
in interfaceadams.core.Randomizable
- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Specified by:
seedTipText
in interfaceadams.core.Randomizable
- 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:
setUseViews
in interfaceInstancesViewSupporter
- Parameters:
value
- true if to uses views
-
getUseViews
public boolean getUseViews()
Returns whether to use views.- Specified by:
getUseViews
in 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:
hasNext
in interfaceIterator<WekaTrainTestSetContainer>
- Specified by:
hasNext
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
hasNext
in 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:
initializeIterator
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
initializeIterator
in 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:
next
in interfaceIterator<WekaTrainTestSetContainer>
- Specified by:
next
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
next
in interfaceSplitGenerator
- Returns:
- the next element in the iteration.
- Throws:
NoSuchElementException
- iteration has no more elements.
-
remove
public void remove()
Unsupported.- Specified by:
remove
in interfaceIterator<WekaTrainTestSetContainer>
- Specified by:
remove
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
remove
in interfaceSplitGenerator
-
toString
public String toString()
Returns a short description of the generator.- Specified by:
toString
in interfaceadams.data.splitgenerator.SplitGenerator<weka.core.Instances,WekaTrainTestSetContainer>
- Specified by:
toString
in interfaceSplitGenerator
- Overrides:
toString
in classadams.core.option.AbstractOptionHandler
- Returns:
- a short description
-
-